From 54fafc397bb8541ec46df15cc0e431c48437b9cc Mon Sep 17 00:00:00 2001 From: Macpie Date: Fri, 16 Feb 2024 17:07:01 -0800 Subject: [PATCH 1/3] Build and push tagged images to quay --- .github/workflows/docker.yml | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..b0fbc64 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,48 @@ +on: + pull_request: + push: + branches: [main] + tags: ["v*"] + +name: docker + +jobs: + docker_buildx: + runs-on: ubuntu-22.04 + steps: + - name: Setup | Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + + - name: Setup | Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup | Docker + uses: docker/setup-buildx-action@v2 + with: + platforms: linux/amd64,linux/arm64 + + - name: Setup | Quay.io + uses: docker/login-action@v2 + with: + registry: quay.io + username: ${{ secrets.QUAY_MINER_USER }} + password: ${{ secrets.QUAY_MINER_UPLOAD_TOKEN }} + + - name: Setup | Image Tag + if: github.event_name != 'pull_request' + run: echo "image_tag=$(git describe)" >> $GITHUB_ENV + + # We publish all builds to the test-images repo. + - name: Build | Test Image + uses: docker/build-push-action@v3 + with: + push: true + platforms: linux/amd64,linux/arm64 + labels: VERSION=${{ env.image_tag }} + tags: quay.io/team-helium/test-images:virtual-lorawan-device-${{ env.image_tag }} + cache-from: type=gha + cache-to: type=gha,mode=max From 548e330953706e91b14eab8084526ac5f6a05e9f Mon Sep 17 00:00:00 2001 From: Macpie Date: Tue, 20 Feb 2024 09:51:37 -0800 Subject: [PATCH 2/3] Add hygiene step --- .github/workflows/docker.yml | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b0fbc64..8851564 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,7 +7,41 @@ on: name: docker jobs: - docker_buildx: + hygiene: + runs-on: ubuntu-22.04 + + steps: + - name: Setup | Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + + - name: Setup | Checkout + uses: actions/checkout@v3 + + - name: Setup | Rust + uses: dtolnay/rust-toolchain@stable + with: + components: clippy, rustfmt + + - name: Setup | Tools + run: sudo apt-get install -y protobuf-compiler libtss2-dev + + - name: Setup | Cache + uses: Swatinem/rust-cache@v2 + + - name: Build | Hygiene + run: | + cargo fmt -- --check + cargo clippy --all-features -- -D clippy::all + + - name: Build | Test + run: | + cargo test + + docker_build: + # Ensure we don't publish images until we pass clippy. + needs: [hygiene] runs-on: ubuntu-22.04 steps: - name: Setup | Cancel Previous Runs From fef6648385d126e693e4cd800474757555125fad Mon Sep 17 00:00:00 2001 From: Macpie Date: Tue, 20 Feb 2024 10:19:45 -0800 Subject: [PATCH 3/3] Remove arm --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8851564..e9fd805 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -57,7 +57,7 @@ jobs: - name: Setup | Docker uses: docker/setup-buildx-action@v2 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 - name: Setup | Quay.io uses: docker/login-action@v2 @@ -75,7 +75,7 @@ jobs: uses: docker/build-push-action@v3 with: push: true - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 labels: VERSION=${{ env.image_tag }} tags: quay.io/team-helium/test-images:virtual-lorawan-device-${{ env.image_tag }} cache-from: type=gha