Files
2026-07-13 12:25:08 +08:00

175 lines
5.3 KiB
YAML

name: Test
on:
push:
branches:
- '*.x'
pull_request:
branches:
- '*.x'
workflow_call: {}
jobs:
test-js:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22, 24, 25]
# See supported Node.js release schedule at https://nodejs.org/en/about/previous-releases
steps:
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npx turbo run build --filter='!@dicebear/docs' --filter='!@dicebear/editor'
- run: npx turbo run test
test-php:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.2', '8.3', '8.4', '8.5']
steps:
- uses: actions/checkout@v6
- name: Use PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring
- name: Install dependencies
working-directory: src/php/core
run: composer install --no-interaction --prefer-dist
- name: Run PHPStan
working-directory: src/php/core
run: vendor/bin/phpstan analyse --no-progress
- name: Run tests
working-directory: src/php/core
run: vendor/bin/phpunit
test-python:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v6
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
working-directory: src/python/core
run: pip install -e ".[dev]"
- name: Run Ruff
working-directory: src/python/core
run: |
ruff check .
ruff format --check .
- name: Run mypy
working-directory: src/python/core
run: mypy src
- name: Run tests
working-directory: src/python/core
run: pytest
test-rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Check formatting
working-directory: src/rust/core
run: cargo fmt --check
- name: Run Clippy
working-directory: src/rust/core
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
working-directory: src/rust/core
run: cargo test
test-go:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.23', '1.24', '1.25']
steps:
- uses: actions/checkout@v6
- name: Use Go ${{ matrix.go-version }}
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: Check formatting
working-directory: src/go/core
run: test -z "$(gofmt -l .)" || (gofmt -l . && exit 1)
- name: Run go vet
working-directory: src/go/core
run: go vet ./...
- name: Run tests
working-directory: src/go/core
run: go test ./...
test-dart:
runs-on: ubuntu-latest
strategy:
matrix:
# Lower bound = the pubspec `environment.sdk` floor; keep in sync.
sdk: ['3.4', 'stable']
steps:
- uses: actions/checkout@v6
- name: Use Dart ${{ matrix.sdk }}
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}
- name: Install dependencies
working-directory: src/dart/core
run: dart pub get
- name: Check the embedded web fixtures are up to date
# The web parity suite embeds a copy of the fixtures (dart2js cannot
# read files); regenerate it and fail if it drifted from the canonical
# tests/fixtures/parity.
working-directory: src/dart/core
run: |
dart run tool/generate_web_fixtures.dart
dart format test/parity/embedded_fixtures.dart
git diff --exit-code test/parity/embedded_fixtures.dart
- name: Check formatting
working-directory: src/dart/core
run: dart format --output=none --set-exit-if-changed .
- name: Analyze
working-directory: src/dart/core
run: dart analyze --fatal-infos
- name: Run tests
working-directory: src/dart/core
run: dart test
- name: Run web-eligible tests on dart2js
# The fixture suites are VM-only (they read disk via dart:io), so the
# dart2js build's number formatting and 32-bit PRNG arithmetic is
# asserted by the embedded web_parity_test under Chrome.
# ubuntu-latest ships google-chrome-stable.
working-directory: src/dart/core
run: dart test -p chrome
- name: Copy the project changelog into the package
# CHANGELOG.md inside the package is a git-ignored build artifact:
# pub.dev expects it in the package directory, while the repository
# maintains a single changelog at the root.
run: cp CHANGELOG.md src/dart/core/CHANGELOG.md
- name: Validate the publishable archive
working-directory: src/dart/core
run: dart pub publish --dry-run