Skip to content

Commit

Permalink
chore: add custom cfg for expand test (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrobbel authored Feb 3, 2025
1 parent 0bc98cc commit 34cb794
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 69 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,6 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-bench-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-bench-
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-
${{ runner.os }}-cargo-
- run: cargo bench --bench narrow --all-features -- --output-format=bencher | tee output.txt
- uses: actions/upload-artifact@v4
with:
Expand Down
56 changes: 0 additions & 56 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,8 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install --locked cargo-expand
- uses: dtolnay/[email protected]
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-
${{ runner.os }}-cargo-
- run: cargo check --workspace --all-targets --no-default-features
- run: cargo check --workspace --all-targets --all-features
- run: cargo test --workspace --all-features --lib --bins --examples --tests -- --skip expand
Expand All @@ -39,24 +25,10 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install --locked cargo-expand
- uses: dtolnay/rust-toolchain@stable
id: rust-toolchain
with:
components: clippy, rustfmt
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-
${{ runner.os }}-cargo-
- name: Check
run: cargo check --workspace --all-targets --all-features
- name: Test
Expand All @@ -75,19 +47,6 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@miri
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-miri-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-miri-
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-
${{ runner.os }}-cargo-
- run: cargo miri setup
- run: cargo miri test --no-default-features
- run: cargo miri test --all-features
Expand All @@ -100,25 +59,10 @@ jobs:
RUSTDOCFLAGS: "-C instrument-coverage"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install --locked cargo-expand
- uses: dtolnay/rust-toolchain@stable
id: rust-toolchain
with:
components: llvm-tools-preview
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-coverage-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-coverage-
${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.cachekey }}-
${{ runner.os }}-cargo-
- run: cargo build --workspace --all-targets --all-features
- run: cargo test --workspace --all-targets --all-features
env:
Expand Down
3 changes: 3 additions & 0 deletions narrow-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ syn = { version = "2.0.96", features = ["visit-mut", "full"] }

[dev-dependencies]
macrotest = "1.0.13"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(narrow_macrotest)'] }
6 changes: 6 additions & 0 deletions narrow-derive/tests/expand.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#[test]
#[cfg(narrow_macrotest)]
/// To run these tests:
/// `RUSTFLAGS='--cfg narrow_macrotest' cargo test -p narrow-derive expand`
///
/// To update the generated output:
/// `MACROTEST=overwrite RUSTFLAGS='--cfg narrow_macrotest' cargo test -p narrow-derive expand`
fn expand() {
macrotest::expand("tests/expand/**/*.rs");
}

0 comments on commit 34cb794

Please sign in to comment.