Skip to content

Commit

Permalink
Fix build scripts etc..
Browse files Browse the repository at this point in the history
- Fix build scripts
- Update parts of doc
- Add cache
  • Loading branch information
argerus committed Mar 28, 2024
1 parent 032eca7 commit 3f96bf7
Show file tree
Hide file tree
Showing 15 changed files with 337 additions and 229 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
**/target/

9 changes: 6 additions & 3 deletions .github/workflows/check_license.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
name: spdx
name: Check SPDX headers

on:
pull_request
pull_request:
workflow_call:


concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
check-spdx-headers:
name: Check SPDX headers

runs-on: ubuntu-latest

steps:

- name: Checkout code
uses: actions/checkout@v4
with:
Expand Down
67 changes: 47 additions & 20 deletions .github/workflows/kuksa_databroker-cli_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/

name: kuksa_databroker-cli_build
name: Build kuksa-databroker-cli

on:
push:
Expand All @@ -32,37 +32,59 @@ concurrency:

jobs:
lint:
name: Linting
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: databroker-cli-lint-${{ hashFiles('**/Cargo.lock') }}
- name: cargo fmt
working-directory: ${{github.workspace}}
run: cargo fmt -- --check
- name: cargo clippy
working-directory: ${{github.workspace}}
run: cargo clippy --all-targets -- -W warnings -D warnings

check_ghcr_push:
name: Check access rights
uses: eclipse-kuksa/kuksa-actions/.github/workflows/check_ghcr_push.yml@2
secrets: inherit

# Run on selfhosted, because our runner has native ARM build in a remote
# builder (no need for qemu)
build-container:
name: Build multiarch container
runs-on: ubuntu-latest
needs: check_ghcr_push

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: databroker-cli-release-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}

- name: Install build prerequisites
working-directory: ${{github.workspace}}/
run: |
which cargo-license || cargo install cargo-license
which cross || cargo install cross
- name: Building
working-directory: ${{github.workspace}}/
run: |
cargo install cargo-license cross
./build-all-targets-cli.sh
- name: Docker meta
Expand All @@ -71,7 +93,7 @@ jobs:
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/eclipse-kuksa/kuksa-databrokerdatabroker-cli
ghcr.io/eclipse-kuksa/kuksa-databroker-cli
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
Expand All @@ -80,9 +102,6 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -95,7 +114,7 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build kuksa.val databroker CLI container and push to ghcr.io (and ttl.sh)
- name: Build kuksa-databroker-cli container and push to ghcr.io (and ttl.sh)
id: ghcr-build
if: needs.check_ghcr_push.outputs.push == 'true'
uses: docker/build-push-action@v5
Expand All @@ -109,13 +128,13 @@ jobs:
push: true
tags: |
${{ steps.meta.outputs.tags }}
ttl.sh/kuksa.val/kuksa-databroker-cli-${{github.sha}}
ttl.sh/eclipse-kuksa/kuksa-databroker-cli-${{github.sha}}
labels: ${{ steps.meta.outputs.labels }}
# Provenance to solve that an unknown/unkown image is shown on ghcr.io
# Same problem as described in https://github.com/orgs/community/discussions/45969
provenance: false

- name: Build ephemeral KUKSA Databroker container and push to ttl.sh
- name: Build ephemeral kuksa-databroker-cli container and push to ttl.sh
if: needs.check_ghcr_push.outputs.push == 'false'
id: tmp-build
uses: docker/build-push-action@v5
Expand All @@ -127,7 +146,7 @@ jobs:
file: ./Dockerfile-cli
context: .
push: true
tags: "ttl.sh/kuksa.val/kuksa-databroker-cli-${{github.sha}}"
tags: "ttl.sh/eclipse-kuksa/kuksa-databroker-cli-${{github.sha}}"
labels: ${{ steps.meta.outputs.labels }}
# Provenance to solve that an unknown/unkown image is shown on ghcr.io
# Same problem as described in https://github.com/orgs/community/discussions/45969
Expand All @@ -137,7 +156,7 @@ jobs:
- name: Posting message
uses: ./.github/actions/post-container-location
with:
image: ttl.sh/kuksa.val/kuksa-databroker-cli-${{github.sha}}
image: ttl.sh/eclipse-kuksa/kuksa-databroker-cli-${{github.sha}}

- name: "Archiving AMD64 artifacts"
uses: actions/upload-artifact@v4
Expand All @@ -154,22 +173,30 @@ jobs:
- name: "Archiving RISCV64 artifacts"
uses: actions/upload-artifact@v4
with:
name: databroker--cli-riscv64
name: databroker-cli-riscv64
path: ${{github.workspace}}/dist/riscv64


bom:
name: Bill of Material Check
name: Check Bill of Material
runs-on: ubuntu-latest
needs: build-container

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: databroker-cli-bom-${{ hashFiles('**/Cargo.lock') }}

- name: "Createbom: License check and Dash output generation"
working-directory: ${{github.workspace}}/createbom
run: |
cargo install cargo-license
which cargo-license || cargo install cargo-license
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-deps ../databroker
- name: Dash license check
Expand Down
Loading

0 comments on commit 3f96bf7

Please sign in to comment.