Build, test and publish snap #87
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Snap Tester | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allow manual trigger | |
workflow_dispatch: | |
env: | |
SNAP_AMD64: chip-tool_${{ github.run_number}}_amd64.snap | |
SNAP_ARM64: chip-tool_${{ github.run_number}}_arm64.snap | |
jobs: | |
build: | |
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.SNAP_AMD64 }} | |
path: ${{ steps.snapcraft.outputs.snap }} | |
if-no-files-found: error | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Download locally built snap | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.SNAP_AMD64 }} | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.*' | |
cache: false | |
- name: Run tests | |
shell: bash | |
working-directory: tests | |
env: | |
SKIP_TEARDOWN_REMOVAL: true | |
LOCAL_SERVICE_SNAP: ../chip-tool_*.snap | |
run: | | |
go test -failfast -p 1 -timeout 30m -v | |
- name: Upload snap logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs | |
path: tests/*.log | |
build-arm64: | |
needs: test | |
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: build | |
with: | |
architecture: arm64 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.SNAP_ARM64 }} | |
path: ${{ steps.build.outputs.snap }} | |
publish-snap: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download locally built snap | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.SNAP_AMD64 }} | |
- uses: snapcore/action-publish@v1 | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} | |
with: | |
snap: ${{ needs.build.outputs.snap }} | |
release: edge/ieng-1057 |