ci #110
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: ci | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 1 * * 0' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
# https://docs.docker.com/build/ci/github-actions/share-image-jobs/ | |
# just using caches instead of artifact upload. | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- | |
name: Create docker cache folder | |
run: mkdir -p /tmp/docker | |
- | |
name: Restore docker image | |
id: cache-docker | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/docker | |
key: ${{ runner.os }}-docker-${{ hashFiles('builder.Dockerfile') }} | |
- | |
name: Build docker builder-image | |
if: steps.cache-docker.outputs.cache-hit != 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: builder.Dockerfile | |
tags: practical-zephyr-builder:latest | |
outputs: type=docker,dest=/tmp/docker/${{ runner.os }}-builder-image.tar | |
build: | |
runs-on: ubuntu-latest | |
needs: docker-build | |
strategy: | |
fail-fast: false | |
matrix: | |
tuple: | |
- { root: '00_basics', invoke: 'ci' } | |
- { root: '01_kconfig', invoke: 'ci' } | |
- { root: '02_devicetree_basics', invoke: 'ci' } | |
- { root: '03_devicetree_semantics', invoke: 'ci' } | |
- { root: '04_practice', invoke: 'ci' } | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- | |
name: Restore docker image | |
id: cache-docker | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/docker | |
key: ${{ runner.os }}-docker-${{ hashFiles('builder.Dockerfile') }} | |
- | |
name: Load image | |
run: | | |
docker load --input /tmp/docker/${{ runner.os }}-builder-image.tar | |
docker image ls -a | |
- | |
name: Build | |
run: | | |
docker run \ | |
--rm \ | |
--platform linux/amd64 \ | |
--workdir /workspaces/practical-zephyr \ | |
-v ${{ github.workspace }}:/workspaces/practical-zephyr \ | |
practical-zephyr-builder:latest \ | |
/bin/bash -c "cd ${{ matrix.tuple.root }} && invoke ${{ matrix.tuple.invoke }}" |