| 1 |
name: CI |
| 2 |
on: [push, pull_request] |
| 3 |
|
| 4 |
env: |
| 5 |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse |
| 6 |
|
| 7 |
jobs: |
| 8 |
test: |
| 9 |
name: Test |
| 10 |
runs-on: ${{ matrix.os }} |
| 11 |
strategy: |
| 12 |
matrix: |
| 13 |
rust: [stable, beta, nightly] |
| 14 |
# Pin ubuntu-26.04 because we need GNU Make >= 4.4 (24.04 ships 4.3). |
| 15 |
# 4.4 understands both `--jobserver-style=fifo` and `=pipe`, so the |
| 16 |
# tests exercise both jobserver wire formats against a single make. |
| 17 |
os: [ubuntu-26.04, macos-14, windows-latest] |
| 18 |
steps: |
| 19 |
- uses: actions/checkout@master |
| 20 |
- name: Install Rust (rustup) |
| 21 |
run: | |
| 22 |
rustup toolchain install ${{ matrix.rust }} --no-self-update --profile minimal |
| 23 |
rustup default ${{ matrix.rust }} |
| 24 |
shell: bash |
| 25 |
|
| 26 |
- uses: Swatinem/rust-cache@v2 |
| 27 |
|
| 28 |
# macOS ships BSD make as `make`; Homebrew installs GNU make as `gmake`. |
| 29 |
- name: Install GNU Make (macOS) |
| 30 |
if: startsWith(matrix.os, 'macos') |
| 31 |
run: brew install make |
| 32 |
shell: bash |
| 33 |
|
| 34 |
- name: Print GNU Make version |
| 35 |
if: ${{ !startsWith(matrix.os, 'windows') }} |
| 36 |
shell: bash |
| 37 |
run: "$MAKE --version" |
| 38 |
env: |
| 39 |
MAKE: ${{ startsWith(matrix.os, 'macos') && 'gmake' || 'make' }} |
| 40 |
|
| 41 |
- run: cargo test --locked |
| 42 |
shell: bash |
| 43 |
env: |
| 44 |
MAKE: ${{ startsWith(matrix.os, 'macos') && 'gmake' || 'make' }} |
| 45 |
|
| 46 |
- name: Ensure wasm32-unknown-unknown be buildable |
| 47 |
if: startsWith(matrix.os, 'ubuntu') |
| 48 |
shell: bash |
| 49 |
run: | |
| 50 |
rustup target add wasm32-unknown-unknown |
| 51 |
cargo build --locked --target wasm32-unknown-unknown |
| 52 |
|
| 53 |
test_musl: |
| 54 |
name: Test (stable, alpine-latest) |
| 55 |
container: rust:alpine |
| 56 |
runs-on: ubuntu-latest |
| 57 |
steps: |
| 58 |
- uses: actions/checkout@master |
| 59 |
|
| 60 |
- name: Install make dependencies |
| 61 |
run: apk add musl-dev bash make |
| 62 |
|
| 63 |
- uses: Swatinem/rust-cache@v2 |
| 64 |
|
| 65 |
- name: Print GNU Make version |
| 66 |
run: make --version |
| 67 |
shell: bash |
| 68 |
|
| 69 |
- run: cargo test --locked |
| 70 |
shell: bash |
| 71 |
|
| 72 |
rustfmt: |
| 73 |
name: Rustfmt |
| 74 |
runs-on: ubuntu-latest |
| 75 |
steps: |
| 76 |
- uses: actions/checkout@master |
| 77 |
- name: Install Rust |
| 78 |
run: rustup update stable && rustup default stable && rustup component add rustfmt |
| 79 |
- run: cargo fmt -- --check |
| 80 |
|
| 81 |
publish_docs: |
| 82 |
name: Publish Documentation |
| 83 |
runs-on: ubuntu-latest |
| 84 |
steps: |
| 85 |
- uses: actions/checkout@master |
| 86 |
- name: Install Rust |
| 87 |
run: rustup update stable && rustup default stable |
| 88 |
- name: Build documentation |
| 89 |
run: cargo doc --no-deps --all-features |
| 90 |
- name: Publish documentation |
| 91 |
run: | |
| 92 |
cd target/doc |
| 93 |
git init |
| 94 |
git add . |
| 95 |
git -c user.name='ci' -c user.email='ci' commit -m init |
| 96 |
git push -f -q https://git:${{ secrets.github_token }}@github.com/${{ github.repository }} HEAD:gh-pages |
| 97 |
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' |
| 98 |
|
| 99 |
msrv: |
| 100 |
runs-on: ${{ matrix.os }} |
| 101 |
strategy: |
| 102 |
matrix: |
| 103 |
os: [ubuntu-latest, macos-14, windows-latest] |
| 104 |
steps: |
| 105 |
- uses: actions/checkout@master |
| 106 |
- name: Install Rust (rustup) |
| 107 |
run: rustup toolchain install nightly --no-self-update --profile minimal |
| 108 |
shell: bash |
| 109 |
|
| 110 |
- uses: taiki-e/install-action@cargo-hack |
| 111 |
- uses: Swatinem/rust-cache@v2 |
| 112 |
|
| 113 |
- run: cargo hack check --lib --rust-version --ignore-private --locked |