Skip to content

ci: Fix failing doctests and run them in CI #17716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 4, 2024
Merged
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
54 changes: 32 additions & 22 deletions .github/workflows/test_rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
FEATURES: lzma,jpegxr
TEST_OPTS: --workspace --locked --no-fail-fast -j 4

# 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: ''

jobs:
changes:
name: Paths filter
Expand Down Expand Up @@ -64,10 +83,14 @@ jobs:
# See also: https://github.com/dtolnay/linkme/issues/94
# Additionally: https://lld.llvm.org/ELF/start-stop-gc
- name: Disable linker start-stop-gc
# Note: We also use `rust-lld` on Windows, see `config.toml`.
if: runner.os != 'macOS'
if: runner.os == 'Linux'
run: echo RUSTFLAGS=${RUSTFLAGS}\ --cfg=web_sys_unstable_apis\ -Clink-args=-znostart-stop-gc >> $GITHUB_ENV

- 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:
Expand All @@ -79,26 +102,13 @@ jobs:
with:
tool: cargo-nextest

- name: Run tests with image tests
if: runner.os != 'macOS'
run: cargo nextest run --profile ci --cargo-profile ci --workspace --locked --no-fail-fast -j 4 --features imgtests,lzma,jpegxr
env:
# 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'
XDG_RUNTIME_DIR: '' # dummy value, just to silence warnings about it missing

- name: Run tests without image tests
if: runner.os == 'macOS'
run: cargo nextest run --profile ci --cargo-profile ci --workspace --locked --no-fail-fast -j 4 --features lzma,jpegxr
env:
XDG_RUNTIME_DIR: '' # dummy value, just to silence warnings about it missing
- 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()
Expand Down
2 changes: 1 addition & 1 deletion core/build_playerglobal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ fn strip_metadata(abc: &mut AbcFile) {
/// If we don't properly declare 'namespace AS3' in the input to asc.jar, then
/// a call like `self.AS3::toXMLString()` will end up getting compiled to weird bytecode like this:
///
/// ```
/// ```pcode
/// getlex Multiname("AS3",[PackageNamespace(""),PrivateNamespace(null,"35"),PackageInternalNs(""),PrivateNamespace(null,"33"),ProtectedNamespace("XML"),StaticProtectedNs("XML")])
/// coerce QName(PackageNamespace(""),"Namespace")
/// getproperty RTQName("toXMLString")
Expand Down
2 changes: 1 addition & 1 deletion core/src/avm2/optimize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl<'gc> Stack<'gc> {

/// Checks if the method fits the following pattern:
///
/// ```
/// ```text
/// [Debug/DebugFile/DebugLine] zero or more times
/// GetLocal { index: 0 }
/// [Debug/DebugFile/DebugLine] zero or more times
Expand Down
Loading