refactor: Rename craft to rivets-rs (#7) #19
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 | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
push: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
fmt: | |
name: Check formatting | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Stable rust toolchain | |
run: rustup toolchain install stable --profile minimal | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: windows-latest | |
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} | |
permissions: | |
security-events: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Nightly rust toolchain | |
run: rustup toolchain install nightly --profile minimal | |
- name: Select nightly toolchain | |
run: rustup default nightly | |
- name: Add Clippy | |
run: rustup component add clippy | |
- name: Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "rust-nightly" | |
shared-key: "clippy" | |
- name: Install cargo-binstall | |
uses: cargo-bins/cargo-binstall@main | |
- name: Install sarif-fmt & clippy-sarif | |
run: cargo binstall --no-confirm --force sarif-fmt clippy-sarif | |
- name: Run Clippy | |
run: cargo clippy --message-format=json | clippy-sarif | tee results.sarif | sarif-fmt | |
- name: Upload SARIF file | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: results.sarif | |
build: | |
name: Build ${{ matrix.platform.os_name }} [rust ${{ matrix.toolchain }}] | |
runs-on: ${{ matrix.platform.os }} | |
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} | |
strategy: | |
matrix: | |
platform: | |
- os_name: Windows-x86_64 | |
os: windows-latest | |
target: x86_64-pc-windows-gnu | |
# - os_name: Linux-x86_64 | |
# os: ubuntu-latest | |
# target: x86_64-unknown-linux-gnu | |
toolchain: | |
- nightly | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup ${{ matrix.toolchain }} toolchain | |
run: rustup toolchain install ${{ matrix.toolchain }} --target ${{ matrix.platform.target }} --profile minimal | |
- name: Select ${{ matrix.toolchain }} toolchain | |
run: rustup default ${{ matrix.toolchain }} | |
- name: Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: "rust-${{ matrix.toolchain }}" | |
shared-key: "build-${{ matrix.platform.target }}" | |
- name: Build | |
run: cargo build --target ${{ matrix.platform.target }} |