Add GitHub workflow to automatically tag each commit on main
#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: CI | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: [ release, dev ] | |
schedule: [ cron: "0 6 * * 4" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Tests pass | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install stable Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
- name: Get Cargo version | |
id: cargo_version | |
run: echo "::set-output name=version::$(cargo -V | tr -d ' ')" | |
shell: bash | |
- name: Download cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-${{ steps.cargo_version.outputs.version }}-${{ hashFiles('Cargo.toml') }} | |
restore-keys: ${{ runner.os }}-${{ steps.cargo_version.outputs.version }} | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --features=serde --verbose | |
clippy: | |
name: No warnings from Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install stable Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
components: clippy | |
- name: Check Clippy lints | |
env: | |
RUSTFLAGS: -D warnings | |
run: cargo clippy | |
check_formatting: | |
name: Source code is formatted | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install stable Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
components: rustfmt | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
check_documentation: | |
name: Documentation builds successfully | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install nightly Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
profile: minimal | |
- name: Download cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: documentation | |
- name: Check documentation | |
env: | |
RUSTDOCFLAGS: -D warnings | |
run: cargo +nightly doc --no-deps --document-private-items | |
check_commit_conventions: | |
name: Commit messages follow project guidelines | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' || github.event.action == 'enqueued' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Check commit conventions | |
uses: wagoid/commitlint-github-action@v2 | |
with: | |
configFile: .commitlintrc.yml |