Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Times conversions through the page (tests/bench/bench.js) in each browser engine, Chromium, Firefox and
# WebKit (Safari's), on Ubuntu, against native chdman on the same machine (whose outputs each conversion must
# equal). The results are the run's summary and an artifact. When the page changes, weekly, and on demand.
name: Benchmarks

on:
push:
branches: [main]
paths: ['dist/**', 'tests/bench/**', '.github/workflows/bench.yml']
pull_request:
paths: ['dist/**', 'tests/bench/**', '.github/workflows/bench.yml']
schedule:
- cron: '11 7 * * 4'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: bench-${{ github.ref }}
cancel-in-progress: true

jobs:
bench:
strategy:
fail-fast: false
matrix:
include:
- browser: chromium
os: ubuntu-24.04
native: true
- browser: firefox
os: ubuntu-24.04
native: true
# (WebKit on Ubuntu too: the macOS runner this asked for was cancelled before any runner took it)
- browser: webkit
os: ubuntu-24.04
native: true
runs-on: ${{ matrix.os }}
timeout-minutes: 90
name: bench (${{ matrix.browser }})
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: npm
cache-dependency-path: tests/package-lock.json
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: numpy, for the synthetic test discs
run: pip install numpy==2.4.6
- name: Cache MAME 0.289 and its chdman
if: matrix.native
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
third_party/mame
build/chdman-0.289
key: mame-0.289-${{ runner.os }}-${{ hashFiles('scripts/fetch-mame.sh', 'scripts/build-upstream.sh', 'wasm/**') }}
- name: Native chdman (0.289 and the engine)
if: matrix.native
run: |
[ -x build/chdman-0.289 ] || ./scripts/build-upstream.sh
./scripts/build-native.sh
- name: Playwright and ${{ matrix.browser }}
working-directory: tests
run: |
npm ci --no-audit --no-fund
npx playwright install --with-deps ${{ matrix.browser }}
# (bench.js makes the synthetic discs, the benchmark images among them)
- name: Benchmark
working-directory: tests
run: >
node bench/bench.js --browser ${{ matrix.browser }} --label ci-${{ matrix.browser }}
--threads 1,4 --presets default,fast --cd-mb 150 --dvd-mb 512
- name: Summary
if: always()
run: cat tests/.cache/bench/*.md >> "$GITHUB_STEP_SUMMARY" 2>/dev/null || true
- name: Results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: bench-${{ matrix.browser }}
path: tests/.cache/bench
if-no-files-found: ignore
retention-days: 90
89 changes: 89 additions & 0 deletions .github/workflows/browsers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# The UI suite (tests/README.md) on dist/discpress.html in Firefox and in WebKit, Safari's engine (Playwright's
# projects behind EXTRA_BROWSERS: webkit, iphone-webkit and firefox), against unmodified chdman 0.289 and the
# engine built natively, as ci.yml runs it in Chromium. A test that fails in one of them for a reason the page
# can't fix is pinned there with test.fail() or skipped with its reason. When the page, the tests or this
# workflow change, weekly, and on demand.
name: Browsers

on:
push:
branches: [main]
paths: ['app/**', 'dist/**', 'tests/**', 'web/**', '.github/workflows/browsers.yml']
pull_request:
paths: ['app/**', 'dist/**', 'tests/**', 'web/**', '.github/workflows/browsers.yml']
schedule:
- cron: '37 6 * * 2'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: browsers-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
runs-on: ubuntu-24.04
timeout-minutes: 75
strategy:
fail-fast: false
matrix:
include:
- browser: firefox
projects: --project=firefox
- browser: webkit
projects: --project=webkit --project=iphone-webkit
name: tests (${{ matrix.browser }})
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: npm
cache-dependency-path: tests/package-lock.json
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: numpy, for the synthetic test discs
run: pip install numpy==2.4.6
# the references the tests compare with, as in ci.yml (the same cache)
- name: Cache MAME 0.289 and its chdman
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
third_party/mame
build/chdman-0.289
key: mame-0.289-${{ runner.os }}-${{ hashFiles('scripts/fetch-mame.sh', 'scripts/build-upstream.sh', 'wasm/**') }}
- name: Unmodified chdman 0.289
run: '[ -x build/chdman-0.289 ] || ./scripts/build-upstream.sh'
- name: The engine built natively
run: ./scripts/build-native.sh
- name: Cache Playwright's ${{ matrix.browser }}
id: pwcache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.cache/ms-playwright
key: playwright-${{ matrix.browser }}-${{ runner.os }}-${{ hashFiles('tests/package-lock.json') }}
- name: Playwright and ${{ matrix.browser }}
working-directory: tests
run: |
npm ci --no-audit --no-fund
if [ '${{ steps.pwcache.outputs.cache-hit }}' = 'true' ]; then npx playwright install-deps ${{ matrix.browser }}; else npx playwright install --with-deps ${{ matrix.browser }}; fi
- name: Synthetic test discs
run: python3 tests/fixtures/make_fixtures.py
- name: UI tests in ${{ matrix.browser }}
working-directory: tests
env:
EXTRA_BROWSERS: '1'
REQUIRE_NATIVE: '1'
run: npx playwright test ${{ matrix.projects }}
- name: Report of a failed run
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: playwright-report-${{ matrix.browser }}
path: |
tests/.cache/report
tests/.cache/test-results
retention-days: 14
69 changes: 69 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Fuzzes the engine (scripts/fuzz.sh, tests/fuzz/README.md): every seed, past finding and saved corpus
# input once, then each fuzzer for a while: 30 minutes weekly, as long as asked on demand, 5 minutes when
# engine/, wasm/ or the fuzzers change. The corpus grows from run to run in the Actions cache (pruned to
# the inputs that add coverage); a finding fails the run and is uploaded with it.
name: Fuzz

on:
push:
branches: [main]
paths: ['engine/**', 'wasm/**', 'tests/fuzz/**', 'tests/support/lsan.supp', 'scripts/fuzz.sh', '.github/workflows/fuzz.yml']
pull_request:
paths: ['engine/**', 'wasm/**', 'tests/fuzz/**', 'tests/support/lsan.supp', 'scripts/fuzz.sh', '.github/workflows/fuzz.yml']
schedule:
- cron: '23 4 * * 3'
workflow_dispatch:
inputs:
seconds:
description: Seconds each fuzzer runs (the four run at once)
default: '1800'

permissions:
contents: read

concurrency:
group: fuzz-${{ github.ref }}
cancel-in-progress: true

jobs:
fuzz:
runs-on: ubuntu-24.04
timeout-minutes: 120
env:
CC: clang-18
CXX: clang++-18
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: clang and its libFuzzer runtime
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang-18 libclang-rt-18-dev
- name: The fuzzers and their seeds
run: ./scripts/fuzz.sh build
- name: Restore the corpus
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: build/fuzz/corpus
key: fuzz-corpus-${{ github.run_id }}
restore-keys: fuzz-corpus-
- name: Every seed, regression and corpus input once
run: ./scripts/fuzz.sh check all
- name: Fuzz
run: ./scripts/fuzz.sh run all ${{ github.event_name == 'schedule' && '1800' || (github.event_name == 'workflow_dispatch' && inputs.seconds) || '300' }}
- name: Prune the corpus
if: success()
run: ./scripts/fuzz.sh prune all
# (a pull request's cache is its own: only main's runs keep the corpus)
- name: Save the corpus
if: always() && github.event_name != 'pull_request'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: build/fuzz/corpus
key: fuzz-corpus-${{ github.run_id }}
- name: Findings
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: fuzz-findings
path: |
build/fuzz/findings
build/fuzz/*.log
if-no-files-found: ignore
Loading
Loading