| 1 |
name: build |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches-ignore: [main] |
| 6 |
pull_request: |
| 7 |
branches: [main] |
| 8 |
|
| 9 |
jobs: |
| 10 |
clippy: |
| 11 |
runs-on: ubuntu-latest |
| 12 |
steps: |
| 13 |
- uses: actions/checkout@v1 |
| 14 |
- uses: actions-rs/toolchain@v1 |
| 15 |
with: |
| 16 |
toolchain: nightly |
| 17 |
components: clippy |
| 18 |
override: true |
| 19 |
- uses: actions-rs/clippy-check@v1 |
| 20 |
with: |
| 21 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 22 |
args: --all-features |
| 23 |
|
| 24 |
test-doc: |
| 25 |
runs-on: ubuntu-latest |
| 26 |
steps: |
| 27 |
- uses: actions/checkout@v2 |
| 28 |
- name: Install toolchain |
| 29 |
uses: actions-rs/toolchain@v1 |
| 30 |
with: |
| 31 |
profile: minimal |
| 32 |
toolchain: nightly |
| 33 |
override: true |
| 34 |
- uses: Swatinem/rust-cache@v1 |
| 35 |
- run: cargo install cargo-deadlinks |
| 36 |
- name: doc |
| 37 |
env: |
| 38 |
RUSTDOCFLAGS: --cfg doc_cfg |
| 39 |
run: cargo deadlinks --ignore-fragments -- --all |
| 40 |
|
| 41 |
test: |
| 42 |
runs-on: ${{ matrix.os }} |
| 43 |
strategy: |
| 44 |
fail-fast: false |
| 45 |
matrix: |
| 46 |
include: |
| 47 |
- os: ubuntu-latest |
| 48 |
target: x86_64-unknown-linux-gnu |
| 49 |
toolchain: stable |
| 50 |
- os: macos-latest |
| 51 |
target: x86_64-apple-darwin |
| 52 |
toolchain: stable |
| 53 |
# TODO: also aarch64 / M1 |
| 54 |
- os: windows-latest |
| 55 |
target: x86_64-pc-windows-gnu |
| 56 |
toolchain: stable |
| 57 |
- os: windows-latest |
| 58 |
target: x86_64-pc-windows-msvc |
| 59 |
toolchain: beta |
| 60 |
# Test both windows-gnu and windows-msvc; use beta rust on one |
| 61 |
- os: ubuntu-latest |
| 62 |
deps: sudo apt-get update ; sudo apt install gcc-multilib |
| 63 |
target: i686-unknown-linux-gnu |
| 64 |
toolchain: nightly |
| 65 |
- os: ubuntu-latest |
| 66 |
target: x86_64-unknown-linux-gnu |
| 67 |
toolchain: nightly |
| 68 |
variant: minimal_versions |
| 69 |
|
| 70 |
steps: |
| 71 |
- uses: actions/checkout@v2 |
| 72 |
- name: Install toolchain |
| 73 |
uses: actions-rs/toolchain@v1 |
| 74 |
with: |
| 75 |
profile: minimal |
| 76 |
target: ${{ matrix.target }} |
| 77 |
toolchain: ${{ matrix.toolchain }} |
| 78 |
override: true |
| 79 |
- uses: Swatinem/rust-cache@v1 |
| 80 |
- run: ${{ matrix.deps }} |
| 81 |
- name: Maybe minimal versions |
| 82 |
if: ${{ matrix.variant == 'minimal_versions' }} |
| 83 |
run: cargo generate-lockfile -Z minimal-versions |
| 84 |
|
| 85 |
- name: Test |
| 86 |
run: | |
| 87 |
cargo test --lib --target ${{ matrix.target }} ${{ matrix.toolchain == 'nightly' && '--features=nightly' || '' }} |
| 88 |
|
| 89 |
env: |
| 90 |
# Enables address sanitization if supported target and nightly. |
| 91 |
RUSTFLAGS: | |
| 92 |
${{ |
| 93 |
( |
| 94 |
matrix.toolchain == 'nightly' && ( |
| 95 |
matrix.target == 'aarch64-apple-darwin' || |
| 96 |
matrix.target == 'aarch64-fuchsia' || |
| 97 |
matrix.target == 'aarch64-unknown-linux-gnu' || |
| 98 |
matrix.target == 'x86_64-apple-darwin' || |
| 99 |
matrix.target == 'x86_64-fuchsia' || |
| 100 |
matrix.target == 'x86_64-unknown-freebsd' || |
| 101 |
matrix.target == 'x86_64-unknown-linux-gnu' |
| 102 |
) |
| 103 |
) |
| 104 |
&& '-Z sanitizer=address' |
| 105 |
|| '' |
| 106 |
}} |
| 107 |
|
| 108 |
test-cross: |
| 109 |
runs-on: ${{ matrix.os }} |
| 110 |
strategy: |
| 111 |
fail-fast: false |
| 112 |
matrix: |
| 113 |
include: |
| 114 |
- os: ubuntu-latest |
| 115 |
target: mips-unknown-linux-gnu |
| 116 |
toolchain: stable |
| 117 |
- os: ubuntu-latest |
| 118 |
target: arm-unknown-linux-gnueabi |
| 119 |
toolchain: stable |
| 120 |
- os: ubuntu-latest |
| 121 |
target: aarch64-unknown-linux-gnu |
| 122 |
toolchain: stable |
| 123 |
- os: ubuntu-latest |
| 124 |
target: arm-unknown-linux-gnueabi |
| 125 |
toolchain: nightly |
| 126 |
- os: ubuntu-latest |
| 127 |
target: aarch64-unknown-linux-gnu |
| 128 |
toolchain: nightly |
| 129 |
|
| 130 |
steps: |
| 131 |
- uses: actions/checkout@v2 |
| 132 |
- name: Install toolchain |
| 133 |
uses: actions-rs/toolchain@v1 |
| 134 |
with: |
| 135 |
profile: minimal |
| 136 |
target: ${{ matrix.target }} |
| 137 |
toolchain: ${{ matrix.toolchain }} |
| 138 |
override: true |
| 139 |
|
| 140 |
- uses: Swatinem/rust-cache@v1 |
| 141 |
- name: Install cross |
| 142 |
run: cargo install cross || true |
| 143 |
- name: Test |
| 144 |
run: | |
| 145 |
cross test --no-fail-fast --target ${{ matrix.target }} ${{ matrix.toolchain == 'nightly' && '--features=nightly' || '' }} |
| 146 |
|
| 147 |
test-msrv: |
| 148 |
runs-on: ubuntu-latest |
| 149 |
steps: |
| 150 |
- uses: actions/checkout@v2 |
| 151 |
- name: Install toolchain |
| 152 |
uses: actions-rs/toolchain@v1 |
| 153 |
with: |
| 154 |
target: x86_64-unknown-linux-gnu |
| 155 |
toolchain: 1.36.0 # MSRV |
| 156 |
- uses: Swatinem/rust-cache@v1 |
| 157 |
- name: Test |
| 158 |
run: cargo test --target=x86_64-unknown-linux-gnu --no-default-features --features=std |
| 159 |
|
| 160 |
test-no-std: |
| 161 |
runs-on: ubuntu-latest |
| 162 |
steps: |
| 163 |
- uses: actions/checkout@v2 |
| 164 |
- name: Install toolchain |
| 165 |
uses: actions-rs/toolchain@v1 |
| 166 |
with: |
| 167 |
profile: minimal |
| 168 |
toolchain: nightly |
| 169 |
target: thumbv6m-none-eabi |
| 170 |
override: true |
| 171 |
- uses: Swatinem/rust-cache@v1 |
| 172 |
- name: Build top-level only |
| 173 |
run: cargo build --target=thumbv6m-none-eabi --no-default-features |