.github/workflows/ci.yml

60 lines · 1373 bytes

 1on:
 2  push:
 3    branches:
 4      - main
 5  pull_request:
 6    branches:
 7      - main
 8
 9name: CI
10
11jobs:
12  clippy_check:
13    runs-on: ubuntu-latest
14    steps:
15    - name: Checkout code
16      uses: actions/checkout@v3
17      with:
18        submodules: true
19    - name: Install Rust
20      uses: actions-rs/toolchain@v1
21      with:
22          toolchain: stable
23          components: clippy
24          override: true
25    - name: Check Clippy
26      uses: actions-rs/clippy-check@v1
27      with:
28        token: ${{ secrets.GITHUB_TOKEN }}
29        toolchain: stable
30        args:
31  test:
32    strategy:
33      matrix:
34        platform: [ubuntu-latest, windows-latest, macos-latest]
35    runs-on: ${{ matrix.platform }}
36    steps:
37    - name: Checkout code
38      uses: actions/checkout@v3
39      with:
40        submodules: true
41    - name: Install Rust
42      uses: actions-rs/toolchain@v1
43      with:
44          toolchain: nightly
45          override: true
46          components: rustfmt, clippy
47    - name: Cache cargo registry
48      uses: actions/cache@v3
49      with:
50        path: ~/.cargo/registry
51        key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
52    - name: Check formatting
53      uses: actions-rs/cargo@v1
54      with:
55          command: fmt
56          args: --all -- --check
57    - name: Run tests
58      uses: actions-rs/cargo@v1
59      with:
60          command: test