From 926ca8aa97ba8a64929ad2b646f87a70e0e4d0aa Mon Sep 17 00:00:00 2001 From: JP Meijers Date: Thu, 6 Jun 2024 13:27:45 +0200 Subject: [PATCH] Add github workflow based on chip-tool --- .github/workflows/build-and-publish-snap.yml | 93 ++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/build-and-publish-snap.yml diff --git a/.github/workflows/build-and-publish-snap.yml b/.github/workflows/build-and-publish-snap.yml new file mode 100644 index 0000000..6455284 --- /dev/null +++ b/.github/workflows/build-and-publish-snap.yml @@ -0,0 +1,93 @@ +name: Build and test snap + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + # Allow manual trigger + workflow_dispatch: + +env: + ARTIFACT_AMD64: matter-all-clusters-app_${{ github.run_number}}_amd64 + ARTIFACT_ARM64: matter-all-clusters-app_${{ github.run_number}}_arm64 + +jobs: + build-amd64: + outputs: + snap: ${{ steps.snapcraft.outputs.snap }} + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build snap + uses: snapcore/action-build@v1 + id: snapcraft + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ARTIFACT_AMD64 }} + path: ${{ steps.snapcraft.outputs.snap }} + if-no-files-found: error + + publish-amd64: + needs: build-amd64 + runs-on: ubuntu-latest + steps: + - name: Download locally built snap + uses: actions/download-artifact@v4 + with: + name: ${{ env.ARTIFACT_AMD64 }} + + - uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} + with: + snap: ${{ needs.build-amd64.outputs.snap }} + release: edge/ieng-1031 + + build-arm64: + # We do not start the long running arm64 build unless the amd64 build has passed. + needs: build-amd64 + outputs: + snap: ${{ steps.snapcraft.outputs.snap }} + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Build snap + uses: diddlesnaps/snapcraft-multiarch-action@v1 + id: snapcraft + with: + architecture: arm64 + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ARTIFACT_ARM64 }} + path: ${{ steps.snapcraft.outputs.snap }} + + publish-arm64: + needs: [build-arm64] + runs-on: ubuntu-latest + steps: + - name: Download locally built snap + uses: actions/download-artifact@v4 + with: + name: ${{ env.ARTIFACT_ARM64 }} + + - uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} + with: + snap: ${{ needs.build-arm64.outputs.snap }} + release: edge/ieng-1031 +