From bf8e651a89a4d78259f88f30c5265cc3dc32b342 Mon Sep 17 00:00:00 2001 From: tx_haggis <13982343+adbancroft@users.noreply.github.com> Date: Fri, 18 Oct 2024 08:24:38 -0500 Subject: [PATCH] Unit test Pull Requests (#1255) * Only need a single simulator test environment. (now that PIO have fixed their SimAVR tooling). * Run unit tests on PRs using SimAVR. --- .github/workflows/sim-unit-tests.yml | 34 ++++++++++++++++++++++++++++ platformio.ini | 18 --------------- 2 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/sim-unit-tests.yml diff --git a/.github/workflows/sim-unit-tests.yml b/.github/workflows/sim-unit-tests.yml new file mode 100644 index 0000000000..ce6b129346 --- /dev/null +++ b/.github/workflows/sim-unit-tests.yml @@ -0,0 +1,34 @@ +name: Unit Tests + +on: + # Trigger the workflow on pull request + pull_request: + # Or push to non-master branch + push: + branches-ignore: [ master ] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + Simulator-Unit-Test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install PlatformIO + run: | + python -m pip install --upgrade pip + pip install --upgrade platformio + pip install wheel + platformio upgrade + platformio pkg update + + - name: Run Simulator Unit Tests + run: | + platformio test -v -e megaatmega2560_sim_unittest \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 4acd71609d..5f1cfb372d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -35,9 +35,6 @@ build_flags = ${env:megaatmega2560.build_flags} -DINJ_CHANNELS=8 -DIGN_CHANNELS= [env:megaatmega2560_sim_unittest] extends = env:megaatmega2560 build_src_flags = ${env:megaatmega2560.build_src_flags} -DSIMULATOR - -[env:megaatmega2560_sim_unittest_windows] -extends = env:megaatmega2560_sim_unittest build_type = test platform_packages = platformio/tool-simavr @@ -52,21 +49,6 @@ test_testing_command = 16000000L ${platformio.build_dir}/${this.__env__}/firmware.elf -[env:megaatmega2560_sim_unittest_ubuntu] -; PlatformIO SimAvr package doesn't run in Ubuntu: -; error while loading shared libraries: libsimavr.so.1: cannot open shared object file: No such file or directory -; -; So instead we manually install SimAVR ('sudo apt-get install -y simavr') -; and run the unit tests using that instead. -extends = env:megaatmega2560_sim_unittest_windows -test_testing_command = - simavr - -m - atmega2560 - -f - 16000000L - ${platformio.build_dir}/${this.__env__}/firmware.elf - [env:megaatmega2561] extends = env:megaatmega2560 board=ATmega2561