| 1 |
name: Rust |
| 2 |
|
| 3 |
on: [push, pull_request] |
| 4 |
|
| 5 |
env: |
| 6 |
CARGO_TERM_COLOR: always |
| 7 |
|
| 8 |
jobs: |
| 9 |
check: |
| 10 |
runs-on: ubuntu-latest |
| 11 |
steps: |
| 12 |
- name: Checkout |
| 13 |
uses: actions/checkout@v3 |
| 14 |
|
| 15 |
- name: Install toolchain |
| 16 |
uses: dtolnay/rust-toolchain@stable |
| 17 |
with: |
| 18 |
targets: x86_64-pc-windows-gnu |
| 19 |
components: clippy, rustfmt |
| 20 |
|
| 21 |
- name: Run checks |
| 22 |
env: |
| 23 |
CLIPPY_OPTS: --all-targets |
| 24 |
run: | |
| 25 |
cargo fmt --check |
| 26 |
cargo clippy $CLIPPY_OPTS |
| 27 |
cargo clippy --target x86_64-pc-windows-gnu $CLIPPY_OPTS |
| 28 |
|
| 29 |
test-win: |
| 30 |
runs-on: windows-latest |
| 31 |
strategy: |
| 32 |
matrix: |
| 33 |
target: |
| 34 |
- i686-pc-windows-gnu |
| 35 |
- i686-pc-windows-msvc |
| 36 |
- x86_64-pc-windows-gnu |
| 37 |
- x86_64-pc-windows-msvc |
| 38 |
steps: |
| 39 |
- name: Checkout |
| 40 |
uses: actions/checkout@v3 |
| 41 |
|
| 42 |
- name: Install toolchain |
| 43 |
uses: dtolnay/rust-toolchain@master |
| 44 |
with: |
| 45 |
toolchain: stable-${{ matrix.target }} |
| 46 |
|
| 47 |
- name: Run tests |
| 48 |
run: cargo test --all-features |
| 49 |
|
| 50 |
test-macos: |
| 51 |
runs-on: macos-latest |
| 52 |
steps: |
| 53 |
- name: Checkout |
| 54 |
uses: actions/checkout@v3 |
| 55 |
|
| 56 |
- name: Install toolchain |
| 57 |
uses: dtolnay/rust-toolchain@stable |
| 58 |
|
| 59 |
- name: Run tests |
| 60 |
run: cargo test --all-features |
| 61 |
|
| 62 |
test-linux: |
| 63 |
runs-on: ubuntu-latest |
| 64 |
strategy: |
| 65 |
matrix: |
| 66 |
target: |
| 67 |
- i686-unknown-linux-gnu |
| 68 |
- i686-unknown-linux-musl |
| 69 |
- x86_64-unknown-linux-gnu |
| 70 |
- x86_64-unknown-linux-musl |
| 71 |
- x86_64-linux-android |
| 72 |
steps: |
| 73 |
- name: Checkout |
| 74 |
uses: actions/checkout@v3 |
| 75 |
|
| 76 |
# We need nightly for -Zminimal-versions |
| 77 |
- name: Install nightly toolchain |
| 78 |
uses: dtolnay/rust-toolchain@nightly |
| 79 |
|
| 80 |
- name: Install toolchain |
| 81 |
uses: dtolnay/rust-toolchain@stable |
| 82 |
with: |
| 83 |
target: ${{ matrix.target }} |
| 84 |
|
| 85 |
- name: Install multilib |
| 86 |
if: ${{ contains(matrix.target, 'i686-unknown-linux-') }} |
| 87 |
run: | |
| 88 |
sudo apt update -yqq |
| 89 |
sudo apt install gcc-multilib |
| 90 |
|
| 91 |
# Make sure we're testing against the minimal libc version. |
| 92 |
- name: Generate Cargo.lock |
| 93 |
run: cargo +nightly update -Zminimal-versions |
| 94 |
|
| 95 |
- name: Run tests |
| 96 |
if: ${{ !contains(matrix.target, 'android') }} |
| 97 |
run: cargo test --locked --all-features --target ${{ matrix.target }} |
| 98 |
|
| 99 |
# Just make sure it builds. Not tests running. |
| 100 |
- name: Run tests |
| 101 |
if: ${{ contains(matrix.target, 'android') }} |
| 102 |
run: cargo build --locked --all-features --target ${{ matrix.target }} |
| 103 |
|
| 104 |
check-stub: |
| 105 |
runs-on: ubuntu-latest |
| 106 |
steps: |
| 107 |
- name: Checkout |
| 108 |
uses: actions/checkout@v3 |
| 109 |
|
| 110 |
- name: Install toolchain |
| 111 |
uses: dtolnay/rust-toolchain@stable |
| 112 |
with: |
| 113 |
targets: wasm32-unknown-unknown |
| 114 |
|
| 115 |
- name: Run check |
| 116 |
run: cargo check --all-features --target wasm32-unknown-unknown |
| 117 |
|
| 118 |
check-visionos: |
| 119 |
runs-on: ubuntu-latest |
| 120 |
steps: |
| 121 |
- name: Checkout |
| 122 |
uses: actions/checkout@v3 |
| 123 |
|
| 124 |
- name: Install toolchain |
| 125 |
uses: dtolnay/rust-toolchain@nightly |
| 126 |
with: |
| 127 |
components: rust-src |
| 128 |
|
| 129 |
- name: Run check |
| 130 |
run: cargo check --all-features --target aarch64-apple-visionos -Zbuild-std |
| 131 |
|
| 132 |
test-msrv: |
| 133 |
runs-on: ubuntu-latest |
| 134 |
steps: |
| 135 |
- name: Checkout |
| 136 |
uses: actions/checkout@v3 |
| 137 |
|
| 138 |
- name: Install toolchain |
| 139 |
uses: dtolnay/[email protected] |
| 140 |
|
| 141 |
# do not test, because dev-dependencies do not follow MSRV |
| 142 |
- name: Build |
| 143 |
run: cargo build --all-features |