Skip to content

ci: add crates.io publish workflow, tidy existing ones #39

ci: add crates.io publish workflow, tidy existing ones

ci: add crates.io publish workflow, tidy existing ones #39

Workflow file for this run

name: "CI: tests, linter and build"
on:
workflow_dispatch:
push:
branches: [master]
pull_request:
jobs:
check-fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check Rust formatting
run: cargo fmt --all --check
check-clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Cargo target directory
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-target-debug-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-debug-clippy-
- name: Run clippy
run: cargo clippy --all-targets -- -D warnings
tests:
runs-on: ubuntu-latest
needs: [check-fmt, check-clippy]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Cargo target directory
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-target-tests-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-tests-
- name: tests
run: cargo test
build-debug:
runs-on: ubuntu-latest
needs: tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Cargo target directory
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-target-debug-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-debug-build-
- name: debug build
run: cargo build
build-release:
runs-on: ubuntu-latest
needs: build-debug
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Cargo target directory
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-target-release-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-release-build-
- name: build release
run: cargo build --release