| 1 |
name: Rust |
| 2 |
|
| 3 |
on: |
| 4 |
push: {} |
| 5 |
pull_request: {} |
| 6 |
|
| 7 |
env: |
| 8 |
RUST_BACKTRACE: 1 |
| 9 |
|
| 10 |
jobs: |
| 11 |
test: |
| 12 |
name: Test Rust ${{ matrix.rust }} on ${{ matrix.os }} |
| 13 |
runs-on: ${{ matrix.os }} |
| 14 |
strategy: |
| 15 |
matrix: |
| 16 |
# it's a little tempting to use `matrix` to do a cartesian product with |
| 17 |
# our `--feature` config here, but doing so will be very slow, as the |
| 18 |
# free tier only supports up to 20 job runners at a time. |
| 19 |
include: |
| 20 |
# versions (all on linux-x86_64) |
| 21 |
- { rust: 1.34.0, os: ubuntu-latest } |
| 22 |
- { rust: stable, os: ubuntu-latest } |
| 23 |
- { rust: beta, os: ubuntu-latest } |
| 24 |
- { rust: nightly, os: ubuntu-latest } |
| 25 |
# non-linux platforms (ones which don't require `cross`) |
| 26 |
- { rust: stable, os: macos-latest } |
| 27 |
- { rust: stable, os: windows-latest } |
| 28 |
- { rust: stable-x86_64-gnu, os: windows-latest } |
| 29 |
- { rust: stable-i686-msvc, os: windows-latest } |
| 30 |
- { rust: stable-i686-gnu, os: windows-latest } |
| 31 |
steps: |
| 32 |
- uses: hecrj/setup-rust-action@v1 |
| 33 |
with: |
| 34 |
rust-version: ${{ matrix.rust }} |
| 35 |
- uses: actions/checkout@v3 |
| 36 |
- run: cargo test --verbose |
| 37 |
- run: cargo test --verbose --no-default-features |
| 38 |
- run: cargo test --verbose |
| 39 |
- run: cargo test --verbose --all-features |
| 40 |
if: matrix.rust == 'nightly' |
| 41 |
- run: cargo test --verbose --manifest-path=derive/Cargo.toml --all-features |
| 42 |
if: matrix.rust == 'nightly' |
| 43 |
|
| 44 |
cross-test: |
| 45 |
name: Test on ${{ matrix.target }} with cross |
| 46 |
runs-on: ubuntu-latest |
| 47 |
strategy: |
| 48 |
matrix: |
| 49 |
# we once had mips runners for Big-endian coverage but those got demoted to tier 3. |
| 50 |
target: [i686-unknown-linux-gnu] |
| 51 |
steps: |
| 52 |
- uses: hecrj/setup-rust-action@v1 |
| 53 |
with: |
| 54 |
rust-version: nightly |
| 55 |
- uses: actions/checkout@v3 |
| 56 |
- run: cargo install cross |
| 57 |
- run: cross test --verbose --target=${{ matrix.target }} --no-default-features |
| 58 |
- run: cross test --verbose --target=${{ matrix.target }} |
| 59 |
- run: cross test --verbose --target=${{ matrix.target }} --all-features |
| 60 |
if: matrix.rust == 'nightly' |
| 61 |
- run: cross test --verbose --target=${{ matrix.target }} --manifest-path=derive/Cargo.toml --all-features |
| 62 |
if: matrix.rust == 'nightly' |
| 63 |
|
| 64 |
miri-test: |
| 65 |
name: Test with miri |
| 66 |
runs-on: ubuntu-latest |
| 67 |
steps: |
| 68 |
- uses: hecrj/setup-rust-action@v1 |
| 69 |
with: |
| 70 |
rust-version: nightly |
| 71 |
components: miri |
| 72 |
- uses: actions/checkout@v3 |
| 73 |
# Note(Lokathor): We got some cached json errors, and so we cargo clean for this run. |
| 74 |
- run: rm -fr target |
| 75 |
- run: cargo miri test --verbose --no-default-features |
| 76 |
- run: cargo miri test --verbose --all-features |
| 77 |
- run: cd derive && rm -fr target && cargo miri test --verbose --all-features |
| 78 |
|
| 79 |
sanitizer-test: |
| 80 |
name: Test with -Zsanitizer=${{ matrix.sanitizer }} |
| 81 |
runs-on: ubuntu-latest |
| 82 |
strategy: |
| 83 |
fail-fast: false |
| 84 |
matrix: |
| 85 |
sanitizer: [address, memory, leak] |
| 86 |
steps: |
| 87 |
- uses: actions/checkout@v3 |
| 88 |
- uses: hecrj/setup-rust-action@v1 |
| 89 |
with: |
| 90 |
rust-version: nightly |
| 91 |
components: rust-src |
| 92 |
- name: Test with sanitizer |
| 93 |
env: |
| 94 |
RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }} |
| 95 |
RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }} |
| 96 |
ASAN_OPTIONS: detect_stack_use_after_return=1 |
| 97 |
# Asan's leak detection occasionally complains about some small leaks if |
| 98 |
# backtraces are captured. |
| 99 |
RUST_BACKTRACE: 0 |
| 100 |
# We don't run `derive`'s unit tests here the way we do elsewhere (for |
| 101 |
# example, in `miri-test` above), as at the moment we can't easily build |
| 102 |
# the `proc_macro` runtime with sanitizers on. IIUC doing this would |
| 103 |
# require a custom rustc build, and... lol nope. |
| 104 |
# |
| 105 |
# This would mean only part of the code running under the sanitizer would |
| 106 |
# actually include the sanitizer's checks, which is a recipe for false |
| 107 |
# positives, so we just skip it, the generated code is what we care |
| 108 |
# about anyway. |
| 109 |
run: | |
| 110 |
cargo test -Zbuild-std --verbose --target=x86_64-unknown-linux-gnu --no-default-features |
| 111 |
cargo test -Zbuild-std --verbose --target=x86_64-unknown-linux-gnu --all-features |