aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci.yaml
blob: 236d5d4a88e6bb33ee080d5042c774fc50b7ec2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
permissions:
  contents: read
on:
  push:
    branches: [master]
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

name: ci

jobs:
  clippy:
    runs-on: ubuntu-latest
    permissions:
      security-events: write # to upload sarif results
    name: beta / clippy
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: beta
          components: clippy,rustfmt
      - uses: Swatinem/rust-cache@v2
      - run: cargo install clippy-sarif sarif-fmt
      - name: Run rust-clippy
        run:
          cargo clippy
          --workspace
          --all-features
          --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
        continue-on-error: true
      - name: Upload analysis results to GitHub
        uses: github/codeql-action/upload-sarif@v4
        with:
          sarif_file: rust-clippy-results.sarif
          wait-for-processing: true
  fmt:
    runs-on: ubuntu-latest
    name: stable / fmt
    steps:
      - uses: actions/checkout@v6
      - name: Install stable
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - name: cargo fmt --check
        run: cargo fmt --check
  os-check:
    runs-on: ${{ matrix.os }}
    name: ${{ matrix.os }} / stable
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, windows-latest]
    steps:
      - uses: actions/checkout@v6
      - name: Install stable
        uses: dtolnay/rust-toolchain@stable
      - name: Install cargo-nextest
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-nextest
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --workspace
        run: cargo nextest run --no-run --workspace --locked --all-features --all-targets
      - name: cargo build
        run: cargo build --workspace --locked --all-features --all-targets
  msrv:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        msrv: ["1.94.1"]
    name: msrv / ${{ matrix.msrv }}
    steps:
      - uses: actions/checkout@v6
      - name: Install ${{ matrix.msrv }}
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.msrv }}
      - name: cargo install cargo-hack
        uses: taiki-e/install-action@cargo-hack
      - name: cargo hack +${{ matrix.msrv }} 
        run: cargo hack --clean-per-run --feature-powerset check
  test:
    runs-on: ubuntu-latest
    needs:
      - os-check
    name: test / workspace
    steps:
      - uses: actions/checkout@v6
      - name: Start stack
        run: docker compose up -d
      - name: Install stable
        uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools-preview
      - uses: taiki-e/install-action@cargo-llvm-cov
      - name: Install cargo-nextest
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-nextest
      - uses: Swatinem/rust-cache@v2
      - name: Stop stack
        if: always()
        run: |
          docker compose down -v
          docker stop $(docker ps -aq) || true
          docker rm $(docker ps -aq) || true