Merge pull request #393 from Community-PIO-CH32V/master #98
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: Build CI | |
on: [push, pull_request] | |
jobs: | |
find-examples: # Job that list subdirectories | |
runs-on: ubuntu-latest | |
outputs: | |
dir: ${{ steps.set-dirs.outputs.dir }} # generate output name dir by using inner step output | |
steps: | |
- uses: actions/checkout@v4 | |
- id: set-dirs # Give it an id to handle to get step outputs in the outputs key above | |
run: echo "::set-output name=dir::$(find examples* -name Makefile -print0 |xargs -0 -n 1 dirname | jq -R -s -c 'split("\n")[:-1]')" | |
# Define step output named dir base on ls command transformed to JSON thanks to jq | |
# Build using native Makefile buildsystem | |
makefile-build: | |
needs: [find-examples] # Depends on previous job | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
example: ${{fromJson(needs.find-examples.outputs.dir)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: sudo apt-get update && sudo apt-get install -y build-essential make libnewlib-dev gcc-riscv64-unknown-elf libusb-1.0-0-dev libudev-dev | |
- name: Build ${{ matrix.example }} | |
run: cd ${{ matrix.example }} && make V=1 -j3 $(basename ${{ matrix.example }}.elf) && riscv64-unknown-elf-size $(basename ${{ matrix.example }}.elf) | |
# Build using PlatformIO | |
pio-build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Build PlatformIO Project | |
run: pio run -v |