separate jobs in ci #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust Project CI | |
on: | |
pull_request: | |
branches: '**' | |
push: | |
branches: main | |
env: | |
CARGO_TERM_COLOR: always | |
TOOLCHAIN: stable | |
jobs: | |
init-env: | |
name: Initialize Environment | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Update Toolchain | |
run: | | |
rustup update ${{ env.TOOLCHAIN }} | |
rustup default ${{ env.TOOLCHAIN }} | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
format: | |
name: Format | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{matrix.os}} | |
needs: init-env | |
steps: | |
- name: Run Format | |
run: cargo fmt --all | |
lint: | |
name: Lint | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{matrix.os}} | |
needs: init-env | |
steps: | |
- name: Run Lint | |
run: cargo clippy --all-targets --all-features | |
test: | |
name: Test | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{matrix.os}} | |
needs: init-env | |
steps: | |
- name: Run Tests | |
run: cargo test --verbose | |
build: | |
name: Build | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{matrix.os}} | |
needs: init-env | |
steps: | |
- name: Run Build | |
run: cargo build --release --verbose |