|
1 | | -name: Build and Test |
| 1 | +# Copied originally from https://github.com/coreos/repo-templates |
| 2 | + |
| 3 | +name: Rust |
2 | 4 | on: |
3 | 5 | push: |
4 | | - branches: [master] |
| 6 | + branches: [main] |
5 | 7 | pull_request: |
6 | | - branches: [master] |
| 8 | + branches: [main] |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +# don't waste job slots on superseded code |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
7 | 16 |
|
8 | 17 | env: |
9 | 18 | CARGO_TERM_COLOR: always |
| 19 | + # Pinned toolchain for linting |
| 20 | + ACTIONS_LINTS_TOOLCHAIN: 1.76.0 |
10 | 21 |
|
11 | 22 | jobs: |
12 | | - build: |
| 23 | + tests-stable: |
| 24 | + name: Tests, stable toolchain |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - name: Check out repository |
| 28 | + uses: actions/checkout@v4 |
| 29 | + - name: Install toolchain |
| 30 | + uses: dtolnay/rust-toolchain@v1 |
| 31 | + with: |
| 32 | + toolchain: stable |
| 33 | + - name: Cache build artifacts |
| 34 | + uses: Swatinem/rust-cache@v2 |
| 35 | + - name: cargo build |
| 36 | + run: cargo build --all-targets --all-features |
| 37 | + - name: cargo test |
| 38 | + run: cargo test --all-targets --all-features |
| 39 | + # https://github.com/rust-lang/cargo/issues/6669 |
| 40 | + - name: cargo test --doc |
| 41 | + run: cargo test --doc --all-features |
| 42 | + linting: |
| 43 | + name: Lints, pinned toolchain |
13 | 44 | runs-on: ubuntu-latest |
14 | 45 | steps: |
15 | | - - uses: actions/checkout@v2 |
16 | | - - name: Build |
17 | | - run: rustup target add wasm32-unknown-unknown && rustup target add wasm32-wasi && cargo build && cargo build --target wasm32-unknown-unknown && cargo build --target wasm32-wasi |
18 | | - - name: Run tests |
19 | | - run: cargo test |
20 | | - - name: Set up Go |
21 | | - uses: actions/setup-go@v2 |
22 | | - - name: Run integration tests |
23 | | - run: | |
24 | | - export GOPATH=$HOME/go && export GOBIN=$(go env GOPATH)/bin && export PATH=$PATH:$GOPATH && export PATH=$PATH:$GOBIN && mkdir -p $GOBIN |
25 | | - go get github.com/technosophos/canonjson |
26 | | - ./scripts/integration.sh |
| 46 | + - name: Check out repository |
| 47 | + uses: actions/checkout@v4 |
| 48 | + - name: Install toolchain |
| 49 | + uses: dtolnay/rust-toolchain@v1 |
| 50 | + with: |
| 51 | + toolchain: ${{ env.ACTIONS_LINTS_TOOLCHAIN }} |
| 52 | + components: rustfmt, clippy |
| 53 | + - name: Cache build artifacts |
| 54 | + uses: Swatinem/rust-cache@v2 |
| 55 | + - name: cargo fmt (check) |
| 56 | + run: cargo fmt -- --check -l |
| 57 | + - name: cargo clippy (warnings) |
| 58 | + run: cargo clippy --all-targets --all-features -- -D warnings |
0 commit comments