Skip to content

Commit

Permalink
Run unit tests on PRs using SimAVR.
Browse files Browse the repository at this point in the history
  • Loading branch information
adbancroft committed Oct 11, 2024
1 parent e7b34d6 commit 80d8ffc
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,19 @@ on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]

pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
# Only try to run hardware unit tests on the upstream repository
if: github.repository_owner == 'speeduino'

Hardware-Unit-Test:
runs-on: ubuntu-latest
# Only run hardware unit tests on the upstream repository
if: github.repository_owner == 'speeduino'

steps:
- uses: actions/checkout@v4

- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: latest
platform: x32

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -38,13 +31,13 @@ jobs:
platformio upgrade
platformio pkg update
- name: Run Unit Tests
- name: Run Hardware Unit Tests
env:
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}
run: |
platformio run -e megaatmega2560
platformio remote test --force-remote --environment megaatmega2560
- name: Discord Notification (Unit Tests Failed)
uses: rjstone/discord-webhook-notify@v1
if: failure()
Expand All @@ -56,4 +49,29 @@ jobs:
details: "**Author:** ${{ github.event.pusher.name }} \n
**Commit URL:** ${{ github.event.head_commit.url }} \n
**Commit Message:** ${{ github.event.head_commit.message }}"
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}

Simulator-Unit-Test:
runs-on: ubuntu-latest
# Only run simulator unit tests on PRs
if: github.repository_owner != 'speeduino'

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

0 comments on commit 80d8ffc

Please sign in to comment.