cartreader/.github/workflows/ci.yml
Ancyker 2b01f7fc4d
Add checks for unsafe configurations
* Fixes #929
* Updated `ci.yml` to define `GITHUB_CI`
* Compilation will now error if VSELECT is enabled on hardware versions that don't support it (any version other than HW5).
  * HW4 and SERIAL might work but are untested. The error message for these versions reflects this.
* Erroring when unsafe configurations are defined can be overridden by defining `ALLOW_UNSAFE_CONFIG` which will throw a warning instead.
  * This should only be done if trying to implement or test on a currently unsupported platform.
  * If both `GITHUB_CI` and `ALLOW_UNSAFE_CONFIG` are defined an error will be thrown causing the CI tests to fail. This is just in case someone makes a commit with it defined.
2024-06-02 11:56:08 -04:00

51 lines
1.2 KiB
YAML

name: CI
on:
push:
pull_request:
env:
ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL: false
jobs:
ci:
name: ${{ matrix.hwVersion }}
runs-on: ubuntu-latest
strategy:
matrix:
hwVersion: [HW5, HW4, HW3, HW2, HW1]
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 ${{ matrix.hwVersion }}/#define ${{ matrix.hwVersion }}/g' Config.h
arduino-cli compile --fqbn arduino:avr:mega --warnings all --build-property compiler.cpp.extra_flags="-DGITHUB_CI"