Skip to content

CI

CI #660

Workflow file for this run

---
name: CI
on:
push:
paths-ignore:
- "**/README.md"
pull_request:
branches: [main]
paths-ignore:
- "**/README.md"
schedule:
- cron: "50 7 * * *"
workflow_dispatch:
jobs:
projects:
name: "${{ matrix.project.name }} | ${{ matrix.project.mcu }} | ${{ matrix.project.id }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
# Templates
- name: template
id: "341952531613614675"
mcu: esp32
target: "xtensa-esp32-none-elf"
- name: template
id: "341956530834244180"
mcu: esp32c3
target: "riscv32imc-unknown-none-elf"
## Rust Board
- name: template
id: "341957109819114067"
mcu: esp32c3
target: "riscv32imc-unknown-none-elf"
- name: template
id: "377857146822034433"
mcu: esp32c6
target: "riscv32imac-unknown-none-elf"
- name: template
id: "379094104004151297"
mcu: esp32h2
target: "riscv32imac-unknown-none-elf"
- name: template
id: "341955277702038100"
mcu: esp32s2
target: "xtensa-esp32s2-none-elf"
- name: template
id: "349566517066596948"
mcu: esp32s3
target: "xtensa-esp32s3-none-elf"
# Examples
- name: blinky
id: "341952826535051858"
mcu: esp32
target: "xtensa-esp32-none-elf"
- name: blinky
id: "341956526159692371"
mcu: esp32c3
target: "riscv32imc-unknown-none-elf"
- name: blinky
id: "378092585951093761"
mcu: esp32c6
target: "riscv32imac-unknown-none-elf"
- name: blinky
id: "379361473820314625"
mcu: esp32h2
target: "riscv32imac-unknown-none-elf"
- name: blinky
id: "341955297469792851"
mcu: esp32s2
target: "xtensa-esp32s2-none-elf"
- name: blinky
id: "349568945405035090"
mcu: esp32s3
target: "xtensa-esp32s3-none-elf"
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Download project code
run: |
wget -q -O ${{ matrix.project.mcu }}_${{ matrix.project.id }}.zip https://wokwi.com/api/projects/${{ matrix.project.id }}/zip
unzip ${{ matrix.project.mcu }}_${{ matrix.project.id }}.zip -d ${{ matrix.project.mcu }}_${{ matrix.project.id }}
- name: Create wokwi.toml
run: echo -e "[wokwi]\nversion = 1\nfirmware = 'rust_project_${{ matrix.project.mcu }}'\nelf = 'rust_project_${{ matrix.project.mcu }}'" > ${{ matrix.project.mcu }}_${{ matrix.project.id }}/wokwi.toml
- name: Update ownership
run: |
sudo chown 1000:1000 -R ${{ matrix.project.mcu }}_${{ matrix.project.id }}
- name: Pull Docker image
run: docker image pull wokwi/builder-rust-nostd-esp
- name: Test code example in Docker image
uses: addnab/docker-run-action@v3
with:
image: wokwi/builder-rust-nostd-esp
options: -u esp -v ${{ github.workspace }}:/home/esp/workspace
run: |
. /home/esp/export-esp.sh
cp /home/esp/workspace/${{ matrix.project.mcu }}_${{ matrix.project.id }}/*.rs rust-project-${{ matrix.project.mcu }}/src/
cat /home/esp/workspace/${{ matrix.project.mcu }}_${{ matrix.project.id }}/Cargo.toml > rust-project-${{ matrix.project.mcu }}/Cargo.toml
cd rust-project-${{ matrix.project.mcu }}
cargo build --release || exit 1
cp target/${{ matrix.project.target }}/release/rust_project_${{ matrix.project.mcu }} /home/esp/workspace/${{ matrix.project.mcu }}_${{ matrix.project.id }}
- name: Wokwi CI check (template)
if: matrix.project.name == 'template'
uses: wokwi/wokwi-ci-action@v1
with:
token: ${{ secrets.WOKWI_CLI_TOKEN }}
path: ${{ matrix.project.mcu }}_${{ matrix.project.id }}
timeout: 10000
expect_text: 'Hello world!'
fail_text: 'Error'
- name: Wokwi CI check (blinky)
if: matrix.project.name == 'blinky'
uses: wokwi/wokwi-ci-action@v1
with:
token: ${{ secrets.WOKWI_CLI_TOKEN }}
path: ${{ matrix.project.mcu }}_${{ matrix.project.id }}
timeout: 10000
scenario: ../blinky.test.yaml
fail_text: 'Error'
- name: Upload source code
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.project.name }}_${{ matrix.project.mcu }}_${{ matrix.project.id }}
path: ${{ matrix.project.mcu }}_${{ matrix.project.id }}