mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 15:27:28 +00:00
[CI] Improve checks (#71)
* [CI] Improve checks - Adds .actrc so CI actions can be tested locally - Adds testing for variants of features so changes that break feature sets like disabling games can be caught - Adds more of the CI tests to pre-commit * [CI] Add more feature sets to test * [CI] Check github actions before comitting Requires act: https://github.com/nektos/act * [CI] Add caching between builds * [CI] Add caching everywhere * [CI] Add more feature tests * [CI] Add YAML schemas * [CI] Disable audit when running locally This is needed because the audit action requires a GITHUB_TOKEN which we don't have when running locally. * [CI] Move clippy to own job and use action that annotates PRs Using actions-rs/clippy-check means that PRs will problems will automatically have the relevant lines annotated * [CI] Don't unnecessarily cache targets for fmt
This commit is contained in:
parent
fb9d15f0cc
commit
a8342296d6
4 changed files with 110 additions and 14 deletions
2
.github/workflows/audit.yml
vendored
2
.github/workflows/audit.yml
vendored
|
|
@ -1,3 +1,4 @@
|
|||
# yaml-language-server: $schema=https://raw.githubusercontent.com/softprops/github-actions-schemas/master/workflow.json
|
||||
name: Security audit
|
||||
on:
|
||||
push:
|
||||
|
|
@ -12,3 +13,4 @@ jobs:
|
|||
- uses: rustsec/audit-check@v1.4.1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: ${{ !env.ACT }} # skip during local actions testing
|
||||
|
|
|
|||
93
.github/workflows/ci.yml
vendored
93
.github/workflows/ci.yml
vendored
|
|
@ -1,3 +1,4 @@
|
|||
# yaml-language-server: $schema=https://raw.githubusercontent.com/softprops/github-actions-schemas/master/workflow.json
|
||||
name: CI
|
||||
|
||||
on:
|
||||
|
|
@ -10,24 +11,53 @@ env:
|
|||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build_first:
|
||||
name: "Build, check, and test with all features"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Run Build
|
||||
run: cargo build --verbose
|
||||
- name: Run Clippy
|
||||
run: cargo clippy --verbose
|
||||
- name: Run Tests
|
||||
run: cargo test --verbose
|
||||
- name: Install Formatting nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
toolchain: nightly-2023-07-09
|
||||
components: rustfmt
|
||||
- name: Run Formatting check
|
||||
run: cargo +nightly-2023-07-09 fmt --check --verbose
|
||||
shared-key: "cargo-deps"
|
||||
cache-targets: false
|
||||
- name: Run Build
|
||||
run: cargo build --verbose --bins --lib --examples --all-features
|
||||
- name: Run Tests
|
||||
run: cargo test --verbose --bins --lib --examples --all-features
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ "build_first" ]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- build_type: ""
|
||||
build_name: "Default"
|
||||
- build_type: "--no-default-features"
|
||||
build_name: "No features"
|
||||
- build_type: "--no-default-features --features games"
|
||||
build_name: "Just games"
|
||||
- build_type: "--no-default-features --features services"
|
||||
build_name: "Just Services"
|
||||
- build_type: "--no-default-features --features game_defs"
|
||||
build_name: "Just Game definitions"
|
||||
- build_type: "--no-default-features --features serde"
|
||||
build_name: "Just serde"
|
||||
name: "Build ${{ matrix.build_name }}"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: "cargo-deps"
|
||||
cache-targets: false
|
||||
- name: Run Build
|
||||
run: cargo build --verbose --bins --lib ${{ matrix.build_type }}
|
||||
build_msrv:
|
||||
name: "Build using MSRV"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Install MSRV
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
|
|
@ -35,3 +65,38 @@ jobs:
|
|||
override: true
|
||||
- name: Run MSRV
|
||||
run: cargo build
|
||||
formatting:
|
||||
name: "Check code formatting"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
cache-targets: false
|
||||
- name: Install Formatting nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly-2023-07-09
|
||||
components: rustfmt
|
||||
override: true
|
||||
- name: Run Formatting check
|
||||
run: cargo fmt --check --verbose
|
||||
clippy:
|
||||
name: "Run clippy tests"
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ "build_first" ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
shared-key: "cargo-deps"
|
||||
cache-targets: false
|
||||
- name: Run Clippy
|
||||
uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --bins --lib --examples --all-features
|
||||
if: ${{ !env.ACT }} # skip during local actions testing
|
||||
- name: Run clippy (local)
|
||||
run: cargo clippy --verbose --bins --lib --examples --all-features
|
||||
if: ${{ env.ACT }} # only run during local actions testing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue