Skip to content

Apply suggestions from code review #36

Apply suggestions from code review

Apply suggestions from code review #36

name: Checkbox Snap daily cross-builds
permissions:
contents: read
on:
workflow_dispatch:
inputs:
store_upload:
description: 'Should the workflow upload to the store?'
default: false
required: false
type: boolean
workflow_call:
inputs:
store_upload:
description: 'Should the workflow upload to the store?'
default: false
required: false
type: boolean
secrets:
SNAPCRAFT7_CREDS:
required: true
GITHUB_TOKEN:

Check failure on line 22 in .github/workflows/checkbox-daily-cross-builds.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/checkbox-daily-cross-builds.yaml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
required: true
jobs:
snap-runtime:
strategy:
fail-fast: false
matrix:
release: [16, 18, 20, 22, 24]
arch: [armhf]
include:
# other confs built natively in checkbox-daily-native-builds.yaml
- release: 16
arch: amd64
- release: 16
arch: arm64
# uc16 needs ubuntu20 because we need cgroup v1 to build it
runs-on: ${{ matrix.release == 16 && 'ubuntu-20.04' || 'ubuntu-latest' }}
timeout-minutes: 1200 #20h, this will timeout sooner due to inner timeouts
name: Runtime ${{ matrix.release }} (${{ matrix.arch }})
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Copy over the common files for series ${{ matrix.release }}
run: |
cd checkbox-core-snap/
sudo apt update && sudo apt install -qq -y python3-setuptools-scm
./prepare.sh series${{ matrix.release }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- id: snap_build
name: Build (retries on fail)
uses: Wandalen/wretry.action@v3.4.0_js_action
with:
attempt_limit: 5
action: canonical/snapcraft-multiarch-action@v1
with: |
architecture: ${{ matrix.arch }}
path: checkbox-core-snap/series${{ matrix.release }}
- uses: actions/upload-artifact@v4
name: Upload logs on failure
if: failure()
with:
name: runtime-build-log-${{ matrix.release }}-${{ matrix.arch }}
path: |
/home/runner/.cache/snapcraft/log/
/home/runner/.local/state/snapcraft/log/
checkbox-core-snap/series${{ matrix.release }}/checkbox*.txt
- uses: actions/upload-artifact@v4
name: Upload the snap as artifact
with:
name: runtime_snap${{ matrix.release }}_${{ matrix.arch }}.snap
path: ${{ steps.snap_build.outputs.snap }}
- name: Publish track
if: inputs.store_upload
uses: canonical/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT7_CREDS }}
with:
snap: ${{ steps.snap_build.outputs.snap }}
release: latest/edge
snap-frontend:
strategy:
fail-fast: false
matrix:
type: [classic, uc]
release: [16, 18, 20, 22, 24]
arch: [armhf, amd64, arm64]
exclude:
# other confs built natively in checkbox-daily-native-builds.yaml
- release: 18
arch: amd64
- release: 18
arch: arm64
- release: 20
arch: amd64
- release: 20
arch: arm64
- release: 22
arch: amd64
- release: 22
arch: arm64
- release: 24
arch: amd64
- release: 24
arch: arm64
# uc16 needs ubuntu20 because we need cgroup v1 to build it
runs-on: ${{ matrix.release == 16 && 'ubuntu-20.04' || 'ubuntu-latest' }}
timeout-minutes: 1200 #20h, this will timeout sooner due to inner timeouts
name: Frontend ${{ matrix.type }}${{ matrix.release }} (${{ matrix.arch }})
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Copy over the common files for series ${{ matrix.type }}${{ matrix.release }}
run: |
cd checkbox-snap/
sudo apt update && sudo apt install -qq -y python3-setuptools-scm
./prepare_${{ matrix.type }}.sh series_${{ matrix.type }}${{ matrix.release }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- id: snap_build
name: Build (retries on fail)
uses: Wandalen/wretry.action@v3.4.0_js_action
with:
attempt_limit: 5
action: canonical/snapcraft-multiarch-action@v1
with: |
architecture: ${{ matrix.arch }}
path: checkbox-snap/series_${{ matrix.type }}${{ matrix.release }}
- uses: actions/upload-artifact@v4
name: Upload logs on failure
if: failure()
with:
name: frontend-build-log-${{ matrix.type }}${{ matrix.release }}-${{ matrix.arch }}
path: |
/home/runner/.cache/snapcraft/log/
/home/runner/.local/state/snapcraft/log/
checkbox-snap/series_${{ matrix.type }}${{ matrix.release }}/checkbox*.txt
- uses: actions/upload-artifact@v4
name: Upload the snaps as artefacts
with:
name: frontend_snaps_${{ matrix.type }}${{ matrix.release }}_${{matrix.arch}}.snap
path: ${{ steps.snap_build.outputs.snap }}
- name: Publish track
# this is done this way because the store doesn't allow the same artifact to be uploaded twice
if: inputs.store_upload && (matrix.release != 24 || matrix.type != 'classic')
uses: canonical/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT7_CREDS }}
with:
snap: ${{ steps.snap_build.outputs.snap }}
# channel is ucXX for uc snaps and XX.04 for classic snaps
release: ${{ matrix.type == 'uc' && format('uc{0}', matrix.release) || format('{0}.04', matrix.release) }}/edge
- name: Publish track + latest
if: inputs.store_upload && matrix.release == 24 && matrix.type == 'classic'
uses: canonical/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT7_CREDS }}
with:
snap: ${{ steps.snap_build.outputs.snap }}
# classic 24.04 is published to latest/edge as well
release: 24.04/edge,latest/edge