tests: Fix from_avmplus/as3/Types/Number/visibility/v16
#30783
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Rust | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
FEATURES: lzma,jpegxr | |
TEST_OPTS: --workspace --locked --no-fail-fast -j 4 | |
LLVM_COV_OPTS: --branch --profile ci | |
LLVM_COV_TEST_OPTS: ${LLVM_COV_OPTS} ${TEST_OPTS} --features ${FEATURES},imgtests | |
LINUX_DEPENDENCIES: libasound2-dev mesa-vulkan-drivers libudev-dev | |
# This is to counteract the disabling by rust-cache. | |
# See: https://github.com/Swatinem/rust-cache/issues/43 | |
CARGO_INCREMENTAL: '1' | |
# Supposedly makes "Updating crates.io index" faster on Windows. | |
# See: https://github.com/rust-lang/cargo/issues/9167 | |
CARGO_NET_GIT_FETCH_WITH_CLI: 'true' | |
# Workaround for: https://github.com/nextest-rs/nextest/issues/1493 | |
# See also: https://github.com/rust-lang/rustup/issues/3825 | |
RUSTUP_WINDOWS_PATH_ADD_BIN: '1' | |
# (Linux) Just to silence warnings about it missing | |
XDG_RUNTIME_DIR: '' | |
COVERAGE_SCRIPT: ./.github/scripts/coverage.py | |
jobs: | |
changes: | |
name: Paths filter | |
runs-on: ubuntu-24.04 | |
outputs: | |
should_run: ${{ steps.filter.outputs.src }} | |
steps: | |
- uses: actions/checkout@v5 | |
- uses: AurorNZ/paths-filter@v4 | |
id: filter | |
with: | |
filters: | | |
src: | |
- '!web/package.json' | |
- '!web/package-lock.json' | |
- '!web/packages/**' | |
- '!**/*.md' | |
build: | |
needs: changes | |
if: needs.changes.outputs.should_run == 'true' | |
name: Test Rust ${{ matrix.rust_version }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.rust_version == 'nightly' || matrix.rust_version == 'beta' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
rust_version: [stable] | |
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025, macos-15] | |
include: | |
- rust_version: nightly | |
os: ubuntu-24.04 | |
- rust_version: beta | |
os: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust_version }} | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt install -y ${{ env.LINUX_DEPENDENCIES }} | |
- name: Enable image tests | |
if: runner.os != 'macOS' | |
shell: bash | |
run: echo FEATURES=${FEATURES},imgtests | tee -a $GITHUB_ENV | |
- name: Cache Cargo output | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "desktop" | |
save-if: ${{ github.ref == 'refs/heads/master' }} | |
- name: Install cargo nextest | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-nextest | |
- name: Run tests | |
shell: bash | |
run: cargo nextest run --profile ci --cargo-profile ci ${TEST_OPTS} --features ${FEATURES} | |
- name: Run doctests | |
shell: bash | |
run: cargo test --doc --profile ci ${TEST_OPTS} --features ${FEATURES} | |
- name: Upload images | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swf_images_${{ matrix.rust_version }}_${{ matrix.os }} | |
path: | | |
tests*/**/*.actual*.png | |
tests*/**/*.difference*.png | |
lints: | |
needs: changes | |
if: needs.changes.outputs.should_run == 'true' | |
name: Lints with Rust ${{ matrix.rust_version }} | |
runs-on: ubuntu-24.04 | |
continue-on-error: ${{ matrix.rust_version == 'nightly' || matrix.rust_version == 'beta' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
rust_version: [stable, beta, nightly] | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust_version }} | |
components: rustfmt, clippy | |
- name: Install Linux dependencies | |
run: | | |
sudo apt-get update | |
sudo apt install -y ${{ env.LINUX_DEPENDENCIES }} | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
- name: Check clippy (with tests) | |
# Don't fail the build for clippy on nightly, since we get a lot of false-positives | |
run: cargo clippy --all --all-features --tests ${{ (matrix.rust_version != 'nightly' && '-- -D warnings') || '' }} | |
- name: Check clippy (without tests) | |
# Don't fail the build for clippy on nightly, since we get a lot of false-positives | |
run: cargo clippy --all --all-features ${{ (matrix.rust_version != 'nightly' && '-- -D warnings') || '' }} | |
- name: Check documentation | |
run: cargo doc --no-deps --all-features | |
env: | |
RUSTDOCFLAGS: -D warnings | |
coverage: | |
needs: changes | |
if: needs.changes.outputs.should_run == 'true' | |
name: Coverage Report | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v5 | |
with: | |
# We need history for delta coverage, but we also don't want to fetch | |
# the whole repo. 42 commits seem reasonable | |
fetch-depth: 42 | |
- name: Set up Python | |
uses: actions/setup-python@v6 | |
with: | |
python-version: "3.13" | |
- name: Install diff-cover | |
run: pip install diff-cover==9.6.0 | |
- name: Calculate base ref | |
id: base_ref | |
run: | | |
if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "pull_request_target" ]; then | |
# For PRs always compute delta with base ref | |
git fetch origin ${{ github.base_ref }} | |
echo "::notice::Using the PR base as base ref for delta coverage." | |
echo "value=origin/${{ github.base_ref }}" | tee -a $GITHUB_OUTPUT | |
elif git merge-base --is-ancestor ${{ github.event.before }} HEAD; then | |
# Use the before SHA if it's an ancestor of HEAD | |
echo "::notice::Using the last pushed commit as base ref for delta coverage." | |
echo "value=${{ github.event.before }}" | tee -a $GITHUB_OUTPUT | |
else | |
# If not, someone force pushed and just use the parent | |
echo "::warning::Failed to compute the base ref for delta coverage. Using parent commit." | |
parent=$(git rev-parse HEAD~1) | |
echo "value=${parent}" | tee -a $GITHUB_OUTPUT | |
fi | |
- name: Install Rust toolchain | |
# We need nightly for coverage due to: | |
# 1. wayland-backend requiring that, | |
# 2. branch coverage being unstable. | |
# | |
# Ad 1. | |
# See <https://github.com/Smithay/wayland-rs/commit/05d8307ea647053b949357eb8588dfdab394f4fe> | |
# Ad 2. | |
# See <https://github.com/taiki-e/cargo-llvm-cov/issues/8> | |
# See <https://github.com/rust-lang/rust/issues/79649> | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: llvm-tools | |
- name: Install llvm-cov | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-llvm-cov | |
- name: Install Linux dependencies | |
run: | | |
sudo apt-get update | |
sudo apt install -y ${{ env.LINUX_DEPENDENCIES }} | |
- name: Run llvm-cov for SWF tests | |
working-directory: tests | |
env: | |
RUFFLE_TEST_OPTS: --ignore-known-failures | |
LLVM_COV_EXCLUDE: > | |
--exclude ruffle_desktop | |
--exclude exporter | |
--exclude ruffle_scanner | |
--exclude ruffle_frontend_utils | |
--exclude ruffle_render_canvas | |
--exclude ruffle_render_webgl | |
--exclude ruffle_web | |
--exclude ruffle_web_common | |
--exclude ruffle_web_safari | |
--exclude build_playerglobal | |
run: cargo llvm-cov --no-report ${{ env.LLVM_COV_TEST_OPTS }} ${LLVM_COV_EXCLUDE} | |
- name: Generate llvm-cov reports | |
run: | | |
mkdir -p target/llvm-cov | |
cargo llvm-cov report --html --output-dir target/llvm-cov/ ${{ env.LLVM_COV_OPTS }} | |
cargo llvm-cov report --lcov --output-path target/llvm-cov/coverage.lcov ${{ env.LLVM_COV_OPTS }} | |
- name: Upload llvm-cov reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: llvm-cov | |
path: target/llvm-cov | |
- name: Run diff-cover | |
run: | | |
mkdir -p target/diff-cover | |
diff-cover target/llvm-cov/coverage.lcov \ | |
--html-report target/diff-cover/report.html \ | |
--json-report target/diff-cover/report.json \ | |
--markdown-report target/diff-cover/report.md \ | |
--compare-branch ${{ steps.base_ref.outputs.value }} | |
- name: Upload diff-cover reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: diff-cover | |
path: target/diff-cover | |
- name: Upload diff-cover summary | |
if: always() | |
run: cat target/diff-cover/report.md >> $GITHUB_STEP_SUMMARY | |
- name: Warnings | |
if: always() | |
run: $COVERAGE_SCRIPT raise_warnings "target/diff-cover/report.json" | |
dependencies: | |
needs: changes | |
if: needs.changes.outputs.should_run == 'true' | |
name: Check dependencies | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Check licenses, duplicates, and advisories | |
uses: EmbarkStudios/cargo-deny-action@v2 | |
- name: Check unused dependencies | |
uses: bnjbvr/cargo-machete@main | |
# So the previous step failing doesn't prevent this one from running. | |
if: always() | |
# The rest is needed only because otherwise the real jobs couldn't be made required for merging PRs, | |
# as they would fail the entire workflow run if skipped - this makes GitHub happy instead. | |
# See: | |
# - https://github.com/orgs/community/discussions/13690 | |
# - https://github.com/orgs/community/discussions/44490 | |
build-dummy: | |
needs: changes | |
if: needs.changes.outputs.should_run == 'false' | |
name: Test Rust ${{ matrix.rust_version }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
rust_version: [stable] | |
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025, macos-15] | |
include: | |
- rust_version: nightly | |
os: ubuntu-24.04 | |
- rust_version: beta | |
os: ubuntu-24.04 | |
steps: | |
- name: No-op | |
run: echo noop | |
lints-dummy: | |
needs: changes | |
if: needs.changes.outputs.should_run == 'false' | |
name: Lints with Rust ${{ matrix.rust_version }} | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
rust_version: [stable, beta, nightly] | |
steps: | |
- name: No-op | |
run: echo noop |