• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CI
2
3on:
4  push:
5    branches: ["main"]
6  pull_request:
7
8env:
9  RUSTFLAGS: -Dwarnings
10  RUST_BACKTRACE: 1
11  MSRV: 1.42.0
12
13jobs:
14  build:
15    name: Build (stable, ${{ matrix.target }})
16    runs-on: ubuntu-latest
17    strategy:
18      matrix:
19        target:
20          - x86_64-unknown-linux-gnu
21          - i686-unknown-linux-musl
22    steps:
23      - uses: actions/checkout@master
24      - name: Install toolchain
25        uses: actions-rs/toolchain@v1
26        with:
27          profile: minimal
28          toolchain: stable
29          target: ${{ matrix.target }}
30          override: true
31      - name: cargo build --target ${{ matrix.target }}
32        uses: actions-rs/cargo@v1
33        with:
34          command: build
35          args: --all-targets --target ${{ matrix.target }}
36
37  build-msrv:
38    name: Build (MSRV)
39    runs-on: ubuntu-latest
40    steps:
41      - uses: actions/checkout@master
42      - name: Install toolchain
43        uses: actions-rs/toolchain@v1
44        with:
45          profile: minimal
46          toolchain: ${{ env.MSRV }}
47          override: true
48      - name: cargo +${{ env.MSRV }} build
49        uses: actions-rs/cargo@v1
50        with:
51          command: build
52        env:
53          RUSTFLAGS: "" # remove -Dwarnings
54
55  build-nightly:
56    name: Build (nightly)
57    runs-on: ubuntu-latest
58    steps:
59      - uses: actions/checkout@master
60      - name: Install toolchain
61        uses: actions-rs/toolchain@v1
62        with:
63          profile: minimal
64          toolchain: nightly
65          override: true
66      - name: cargo +nightly build
67        uses: actions-rs/cargo@v1
68        with:
69          command: build
70        env:
71          RUSTFLAGS: "" # remove -Dwarnings
72
73  test:
74    name: Tests (stable)
75    needs: build
76    runs-on: ubuntu-latest
77    steps:
78      - uses: actions/checkout@master
79      - name: Install toolchain
80        uses: actions-rs/toolchain@v1
81        with:
82          profile: minimal
83          toolchain: stable
84          override: true
85      - name: Run tests
86        run: cargo test
87
88  test-loom:
89    name: Loom tests (stable)
90    needs: build
91    runs-on: ubuntu-latest
92    steps:
93      - uses: actions/checkout@master
94      - name: Install toolchain
95        uses: actions-rs/toolchain@v1
96        with:
97          profile: minimal
98          toolchain: stable
99          override: true
100      - name: Run Loom tests
101        run: ./bin/loom.sh
102
103  clippy:
104    name: Clippy (stable)
105    runs-on: ubuntu-latest
106    steps:
107      - uses: actions/checkout@v2
108      - name: Install toolchain
109        uses: actions-rs/toolchain@v1
110        with:
111          profile: minimal
112          toolchain: stable
113          components: clippy
114          override: true
115      - name: cargo clippy --all-targets --all-features
116        uses: actions-rs/clippy-check@v1
117        with:
118          token: ${{ secrets.GITHUB_TOKEN }}
119          args: --all-targets --all-features
120
121  rustfmt:
122    name: Rustfmt (stable)
123    runs-on: ubuntu-latest
124    steps:
125      - uses: actions/checkout@v2
126      - name: Install toolchain
127        uses: actions-rs/toolchain@v1
128        with:
129          profile: minimal
130          toolchain: stable
131          components: rustfmt
132          override: true
133      - name: Run rustfmt
134        uses: actions-rs/cargo@v1
135        with:
136          command: fmt
137          args: -- --check
138
139  all-systems-go:
140    name: "all systems go!"
141    needs:
142      - build
143      - build-msrv
144      # Note: we explicitly *don't* require the `build-nightly` job to pass,
145      # since the nightly Rust compiler is unstable. We don't want nightly
146      # regressions to break our build --- this CI job is intended for
147      # informational reasons rather than as a gatekeeper for merging PRs.
148      - test
149      - test-loom
150      - clippy
151      - rustfmt
152    runs-on: ubuntu-latest
153    steps:
154      - run: exit 0
155