mirror of
https://github.com/dikeckaan/mu300-linux.git
synced 2026-12-06 16:02:55 +00:00
72 lines
2.8 KiB
YAML
72 lines
2.8 KiB
YAML
name: Tests
|
|
|
|
# tests/: the device scripts under every shell they run with (dash and bash on Ubuntu, busybox ash on OpenWrt), the
|
|
# boot image builder, the installers' translations and rules, and install.ps1's functions under Windows PowerShell
|
|
# 5.1 and PowerShell 7. Run them locally with: python3 -m unittest discover -s tests
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
ubuntu:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [0, 1, 2, 3] # tests/shard.py: the modules of each quarter, ~7 min instead of ~30
|
|
runs-on: ubuntu-latest
|
|
name: ubuntu shard ${{ matrix.shard }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4 # the control panel's JavaScript tests
|
|
with:
|
|
node-version: 22
|
|
- name: shells and lz4
|
|
run: |
|
|
sudo apt-get install -y -qq dash busybox lz4 zip unzip cpio jq >/dev/null
|
|
python3 -m pip install -q lz4 || python3 -m pip install -q --break-system-packages lz4
|
|
- name: SAE parser and SDK regressions with UBSan (Linux)
|
|
if: runner.os == 'Linux'
|
|
env:
|
|
MU300_TEST_UBSAN: '1'
|
|
run: python3 -m unittest discover -s tests -p test_u30_sae.py -v
|
|
- name: tests
|
|
# quick mode on pull requests: the device scripts under busybox sh only (what OpenWrt runs; dash and bash
|
|
# are Ubuntu's) - a third of the time. A push to main runs every shell.
|
|
env:
|
|
MU300_TEST_SHELLS: ${{ github.event_name == 'pull_request' && 'busybox sh' || 'dash,bash,busybox sh,sh' }}
|
|
run: |
|
|
cd tests
|
|
python3 -c 'import helpers; print("shells:", helpers.shells())'
|
|
mods=$(python3 shard.py 4 ${{ matrix.shard }}); echo "shard ${{ matrix.shard }}: $mods"
|
|
python3 -m unittest $mods
|
|
|
|
# the name the branch ruleset requires: green only when every shard is. (macOS: dropped 2026-10-12, GitHub's
|
|
# macOS runners queued for hours; the suite is POSIX-shell work that Ubuntu covers.)
|
|
unix-ubuntu:
|
|
name: unix (ubuntu-latest)
|
|
needs: ubuntu
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: test "${{ needs.ubuntu.result }}" = success
|
|
windows:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: install.ps1 functions (Windows PowerShell 5.1)
|
|
shell: powershell
|
|
run: powershell -NoProfile -ExecutionPolicy Bypass -File tests\installer.Tests.ps1
|
|
- name: install.ps1 functions (PowerShell 7)
|
|
shell: pwsh
|
|
run: pwsh -NoProfile -File tests\installer.Tests.ps1
|
|
- name: boot image builder (the Windows install runs it too)
|
|
shell: pwsh
|
|
run: |
|
|
python -m pip install -q lz4
|
|
cd tests
|
|
python -m unittest test_boot_image -v
|