Merge pull request #533 from niklasweber/use_workflow_matrix

Use a matrix instead of defining each job manually
This commit is contained in:
sanni 2022-09-24 21:54:10 +02:00 committed by GitHub
commit 0b79ae4eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 69 deletions

View File

@ -1,48 +0,0 @@
name: Build
on:
workflow_call:
inputs:
hwVersion:
description: "The version of the hardware to compile for (e.g. HW5, HW4, ...)"
required: true
type: string
env:
ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Arduino CLI
uses: arduino/setup-arduino-cli@v1
- name: Install platform
run: |
arduino-cli core update-index
arduino-cli core install arduino:avr
- name: Install libraries
run: |
arduino-cli lib install \
"SdFat" \
"Adafruit SSD1306" \
"Adafruit GFX Library" \
"Adafruit BusIO" \
"U8g2" \
"Adafruit NeoPixel" \
"RotaryEncoder" \
"Etherkit Si5351" \
"RTClib" \
"FreqCount"
- name: Checkout
uses: actions/checkout@v3
- name: Compile
run: |
cd Cart_Reader/
# Select hardware version by uncommenting it (using regular expression)
sed -i 's/^\/\/[\t ]*#define ${{ inputs.hwVersion }}/#define ${{ inputs.hwVersion }}/g' Cart_Reader.ino
arduino-cli compile --fqbn arduino:avr:mega

View File

@ -1,29 +1,50 @@
name: CI name: CI
on: [push] on:
push:
pull_request:
env:
ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL: false
jobs: jobs:
HW5: ci:
uses: ./.github/workflows/build.yml name: ${{ matrix.hwVersion }}
with: runs-on: ubuntu-latest
hwVersion: "HW5" strategy:
matrix:
hwVersion: [HW5, HW4, HW3, HW2, HW1]
HW4: steps:
uses: ./.github/workflows/build.yml - name: Install Arduino CLI
with: uses: arduino/setup-arduino-cli@v1
hwVersion: "HW4"
HW3: - name: Install platform
uses: ./.github/workflows/build.yml run: |
with: arduino-cli core update-index
hwVersion: "HW3" arduino-cli core install arduino:avr
HW2: - name: Install libraries
uses: ./.github/workflows/build.yml run: |
with: arduino-cli lib install \
hwVersion: "HW2" "SdFat" \
"Adafruit SSD1306" \
"Adafruit GFX Library" \
"Adafruit BusIO" \
"U8g2" \
"Adafruit NeoPixel" \
"RotaryEncoder" \
"Etherkit Si5351" \
"RTClib" \
"FreqCount"
HW1: - name: Checkout
uses: ./.github/workflows/build.yml uses: actions/checkout@v3
with:
hwVersion: "HW1" - name: Compile
run: |
cd Cart_Reader/
# Select hardware version by uncommenting it (using regular expression)
sed -i 's/^\/\/[\t ]*#define ${{ matrix.hwVersion }}/#define ${{ matrix.hwVersion }}/g' Cart_Reader.ino
arduino-cli compile --fqbn arduino:avr:mega