Skip to content

Commit

Permalink
Unit test Pull Requests (speeduino#1255)
Browse files Browse the repository at this point in the history
* Only need a single simulator test environment.
(now that PIO have fixed their SimAVR tooling).

* Run unit tests on PRs using SimAVR.
  • Loading branch information
adbancroft authored Oct 18, 2024
1 parent 406e880 commit bf8e651
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/sim-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 0 additions & 18 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bf8e651

Please sign in to comment.