128 lines
5.0 KiB
YAML
128 lines
5.0 KiB
YAML
# Tests that need no game files, keys or GPU. GitHub's macOS runners are virtual Macs without Metal 4 (issue #112), so the tests that go through mtl_init
|
|
# (t_nvn, t_mip_extent, t_rt_range and the rest of dm/gfx/tests' run list) stay local: run `make -C dm/gfx/tests GAME=<id> run` on an Apple-silicon Mac.
|
|
# `profile_guess.py --check` stays local too: it compares the guesses with the extractions of the games (it needs their files).
|
|
name: tests
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: tests-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
GAME: 010015100B514000 # Super Mario Bros. Wonder: the profile the host and gfx tests are built for (any profile does; the tests are about code, not the game)
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
# Actions are pinned to commit SHAs (the tag in the comment): a tag can be moved, a SHA cannot. Dependabot (github-actions) can raise them.
|
|
jobs:
|
|
host-tests:
|
|
name: Host unit tests and CPU-only gfx tests
|
|
runs-on: macos-26
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Host unit tests (dm/host/tests)
|
|
run: |
|
|
mkdir -p logs
|
|
make -C dm/host/tests GAME="$GAME" -j3 run 2>&1 | tee logs/host-tests.log
|
|
- name: CPU-only gfx tests (dm/gfx/tests)
|
|
run: |
|
|
mkdir -p logs
|
|
cd dm/gfx/tests
|
|
tests="t_dirty_slots t_dirty_race t_pace t_fstep t_hmap t_cover t_pso_skey t_refl t_rt_range_ro"
|
|
make GAME="$GAME" -j3 $tests 2>&1 | tee ../../../logs/gfx-build.log
|
|
failed=0
|
|
for t in $tests; do
|
|
echo "::group::$t"
|
|
./$t 2>&1 | tee "../../../logs/$t.log" && rc=0 || rc=1 # pipefail: the test's status
|
|
echo "::endgroup::"
|
|
if [ "$rc" != 0 ]; then echo "::error::$t failed"; failed=1; fi
|
|
done
|
|
exit $failed
|
|
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
if: failure()
|
|
with:
|
|
name: logs-host-tests
|
|
path: logs
|
|
retention-days: 7
|
|
|
|
tool-tests:
|
|
name: Tool tests
|
|
runs-on: macos-26
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
with:
|
|
python-version: '3.14'
|
|
cache: pip
|
|
cache-dependency-path: .github/workflows/tests.yml # no requirements file: the packages are listed in the step below
|
|
- name: Install the Python packages the tools import
|
|
run: python -m pip install lz4 capstone fonttools # backports.zstd is for Python before 3.14 only
|
|
- name: Run the test files
|
|
env:
|
|
DM_GAME: ${{ env.GAME }} # test_tbdr_budget runs a tool that needs a profile
|
|
run: |
|
|
mkdir -p logs
|
|
failed=0
|
|
for f in dm/tools/tests/test_*.py dm/ios/tests/test_*.py dm/gfx/tests/test_*.py; do
|
|
echo "::group::$f"
|
|
python -m unittest -v "$f" 2>&1 | tee "logs/$(basename "$f").log" || { echo "::error::$f failed"; failed=1; }
|
|
echo "::endgroup::"
|
|
done
|
|
exit $failed
|
|
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
if: failure()
|
|
with:
|
|
name: logs-tool-tests
|
|
path: logs
|
|
retention-days: 7
|
|
|
|
build:
|
|
name: Build check (Mac host, gfx tests, iOS sources)
|
|
runs-on: macos-26
|
|
timeout-minutes: 40
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Mac host for three profiles (Vulkan, NVN, OpenGL)
|
|
run: |
|
|
mkdir -p logs
|
|
# Wonder: NVN; Hades: Vulkan; Digimon Story Cyber Sleuth: OpenGL. The second and third reuse the libvpx build in dm/host/gen/vpx.
|
|
for g in 010015100B514000 0100535012974000 010014E00DB56000; do
|
|
echo "::group::dmhost $g"
|
|
make -C dm/host GAME=$g -j3 dmhost 2>&1 | tee "logs/dmhost-$g.log"
|
|
test -x dm/host/dmhost
|
|
echo "::endgroup::"
|
|
done
|
|
- name: Every gfx test compiled, not run
|
|
run: |
|
|
mkdir -p logs
|
|
cd dm/gfx/tests
|
|
tests=$(sed -n 's/^\(t_[a-z0-9_]*\):.*/\1/p' Makefile | sort -u)
|
|
echo "$tests" | tr '\n' ' '; echo
|
|
make GAME="$GAME" -j3 $tests 2>&1 | tee ../../../logs/gfx-tests-build.log
|
|
- name: iOS host sources compiled for the iPhone SDK (no signing, no Xcode project)
|
|
run: python3 dm/ios/tools/compile_check.py 2>&1 | tee logs/ios-compile.log
|
|
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
if: failure()
|
|
with:
|
|
name: logs-build
|
|
path: logs
|
|
retention-days: 7
|