.github/workflows/ci.yml

56 lines · 1522 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    steps:
18    - name: Checkout code
19      uses: actions/checkout@v3
20      with:
21        submodules: true
22    - name: Install Rust (1.67 w/ clippy)
23      uses: dtolnay/rust-toolchain@1.67
24      with:
25          components: clippy
26    - name: Install Rust (nightly w/ rustfmt)
27      run: rustup toolchain install nightly --component rustfmt
28    - name: Cache cargo registry
29      uses: actions/cache@v3
30      with:
31        path: ~/.cargo/registry
32        key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
33    - name: Cache cargo build
34      uses: actions/cache@v3
35      with:
36        path: target
37        key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
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