Feat: merge gamedig-cli partially & monorepo conversion #525
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
# yaml-language-server: $schema=https://raw.githubusercontent.com/softprops/github-actions-schemas/master/workflow.json | |
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- "**.rs" # Any rust file | |
- "Cargo.toml" | |
- ".rustfmt.toml" | |
- ".github/workflows/ci.yml" # This action | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- "**.rs" # Any rust file | |
- "Cargo.toml" | |
- ".rustfmt.toml" | |
- ".github/workflows/ci.yml" # This action | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_first: | |
name: "Build, check, and test with all features" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "cargo-deps" | |
cache-targets: false | |
- name: Run Build | |
run: cargo check --verbose --workspace --bins --lib --examples --all-features | |
- name: Run Tests | |
run: cargo test --verbose --workspace --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 check --workspace --verbose --bins --lib ${{ matrix.build_type }} | |
build_msrv: | |
name: "Build using MSRV (lib only)" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install MSRV | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.65.0 | |
override: true | |
- name: Run MSRV | |
run: cargo check -p gamedig | |
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: --workspace --bins --lib --examples --all-features | |
if: ${{ !env.ACT }} # skip during local actions testing | |
- name: Run clippy (local) | |
run: cargo clippy --workspace --verbose --bins --lib --examples --all-features | |
if: ${{ env.ACT }} # only run during local actions testing | |
doc: | |
name: "Check rustdoc" | |
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 cargo doc" | |
run: cargo doc --workspace | |
env: | |
RUSTDOCFLAGS: "-D warnings" |