.github/workflows/ci.yml

56 lines · 1508 bytes

 1on:
 2  push:
 3    branches:
 4      - main
 5  pull_request:
 6    branches:
 7      - main
 8
 9name: CI
10
11jobs:
12  test:
13    strategy:
14      matrix:
15        platform: [ubuntu-latest, windows-latest, macos-latest]
16    runs-on: ${{ matrix.platform }}
17    env:
18      SCCACHE_GHA_ENABLED: "true"
19      RUSTC_WRAPPER: "sccache"
20    steps:
21    - name: Checkout code
22      uses: actions/checkout@v3
23      with:
24        submodules: true
25    - name: Install Rust (1.70 w/ clippy)
26      uses: dtolnay/rust-toolchain@1.70
27      with:
28          components: clippy
29    - name: Install Rust (nightly w/ rustfmt)
30      run: rustup toolchain install nightly --component rustfmt
31    - name: Cache cargo registry
32      uses: actions/cache@v3
33      with:
34        path: ~/.cargo/registry
35        key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
36    - name: Run sccache-cache
37      uses: mozilla-actions/sccache-action@v0.0.3
38    - name: Check formatting
39      run: cargo +nightly fmt --all -- --check
40    - name: Check Clippy
41      if: matrix.platform == 'ubuntu-latest'
42      uses: giraffate/clippy-action@v1
43      with:
44        github_token: ${{ secrets.GITHUB_TOKEN }}
45        reporter: 'github-check'
46    - name: Run tests
47      run: cargo test
48    - name: Build artifacts
49      run: cargo build --release
50    - name: Upload artifacts
51      uses: actions/upload-artifact@master
52      with:
53        name: iamb-${{ matrix.platform }}
54        path: |
55          ./target/release/iamb
56          ./target/release/iamb.exe