This repository has been archived by the owner on Nov 14, 2024. It is now read-only.
Container CI #575
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: Container CI | |
on: | |
push: | |
paths: | |
- ".devcontainer/Dockerfile" | |
pull_request: | |
paths: | |
- ".devcontainer/Dockerfile" | |
schedule: | |
- cron: "50 7 * * *" | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Cancel any currently running workflows from the same PR, branch, or | |
# tag when a new workflow is triggered. | |
# | |
# https://stackoverflow.com/a/66336834 | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
jobs: | |
docker-checks: | |
name: Build project using the generated Dockerfile | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
board: ["esp32", "esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32s2", "esp32s3"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: /home/runner/work/esp-template/esp-template/github-esp-template | |
- uses: Swatinem/rust-cache@v2 | |
- name: Setup | cargo-generate (binaries) | |
id: binaries | |
continue-on-error: true | |
run: | | |
sudo curl -L "https://github.com/cargo-generate/cargo-generate/releases/latest/download/cargo-generate-$(git ls-remote --refs --sort="version:refname" --tags "https://github.com/cargo-generate/cargo-generate" | cut -d/ -f3- | tail -n1)-x86_64-unknown-linux-gnu.tar.gz" -o "/home/runner/.cargo/bin/cargo-generate.tar.gz" | |
tar xf "/home/runner/.cargo/bin/cargo-generate.tar.gz" -C /home/runner/.cargo/bin | |
chmod u+x /home/runner/.cargo/bin/cargo-generate | |
- name: Setup | cargo-generate (cargo) | |
if: steps.binaries.outcome != 'success' | |
run: cargo install cargo-generate | |
- name: Generate | |
if: matrix.board == 'esp32h2' | |
run: cargo generate --path /home/runner/work/esp-template/esp-template/github-esp-template --allow-commands --name test-${{ matrix.board }} --vcs none --silent -d mcu=${{ matrix.board }} -d advanced=true -d devcontainer=true -d wokwi=false -d alloc=false -d ci=false | |
- name: Generate | |
if: matrix.board != 'esp32h2' | |
run: cargo generate --path /home/runner/work/esp-template/esp-template/github-esp-template --allow-commands --name test-${{ matrix.board }} --vcs none --silent -d mcu=${{ matrix.board }} -d advanced=true -d wifi=false -d devcontainer=true -d wokwi=false -d alloc=false -d ci=false | |
- name: Update ownership | |
run: | | |
sudo chown 1000:1000 -R test-${{ matrix.board }} | |
- uses: docker/build-push-action@v6 | |
with: | |
context: . | |
tags: test-${{ matrix.board }}:latest | |
build-args: | | |
ESP_BOARD=${{ matrix.board }} | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
file: test-${{ matrix.board }}/.devcontainer/Dockerfile | |
push: false | |
- name: Run the build process with Docker | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: test-${{ matrix.board }}:latest | |
options: -u esp -v ${{ github.workspace }}/test-${{ matrix.board }}:/home/esp/test-${{ matrix.board }} | |
run: | | |
cd /home/esp/test-${{ matrix.board }} | |
bash -c 'source /home/esp/export-esp.sh && cargo build' |