This repository has been archived by the owner on Nov 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
73 lines (70 loc) · 3.19 KB
/
ci_docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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 -d logging=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 -d logging=false
- name: Update ownership
run: |
sudo chown 1000:1000 -R test-${{ matrix.board }}
- uses: docker/build-push-action@v4
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'