-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from kate-goldenring/code-quality-workflows
Add audit and build workflows
- Loading branch information
Showing
4 changed files
with
137 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Run Rust audits | ||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
workflow_dispatch: | ||
jobs: | ||
cargo-vet: | ||
name: Vet Dependencies | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository_owner == 'fermyon' }} | ||
env: | ||
CARGO_VET_VERSION: 0.5.0 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Rust | ||
run: rustup update stable && rustup default stable | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ runner.tool_cache }}/cargo-vet | ||
key: cargo-vet-bin-${{ env.CARGO_VET_VERSION }} | ||
- name: Add the tool cache directory to the search path | ||
run: echo "${{ runner.tool_cache }}/cargo-vet/bin" >> $GITHUB_PATH | ||
- name: Ensure that the tool cache is populated with the cargo-vet binary | ||
run: cargo install --root ${{ runner.tool_cache }}/cargo-vet --version ${{ env.CARGO_VET_VERSION }} cargo-vet | ||
- name: Invoke cargo-vet | ||
run: cargo vet --locked |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
|
||
name: Check Rust | ||
on: | ||
push: | ||
branches: ["main", "v*"] | ||
# Also run on tag pushes, as the release.yml doesn't currently run tests | ||
tags: ["v*"] | ||
pull_request: | ||
branches: ["main", "v*"] | ||
paths-ignore: | ||
- ".plugin-manifests/**" | ||
- "README.md" | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
jobs: | ||
lint-rust: | ||
name: Lint Rust | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
# install dependencies | ||
- name: Install latest Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: '1.68' | ||
default: true | ||
components: clippy, rustfmt | ||
- name: "Install Wasm Rust target" | ||
run: rustup target add wasm32-wasi && rustup target add wasm32-unknown-unknown | ||
shell: bash | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: "${{ runner.os }}-full-${{ hashFiles('./Cargo.lock') }}" | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Cargo Format | ||
run: | ||
cargo fmt --all -- --check | ||
|
||
- name: Cargo Clippy | ||
run: | ||
cargo clippy --workspace --all-targets --all-features -- -D warnings | ||
|
||
build-rust: | ||
name: Build Cloud Plugin | ||
runs-on: ${{ matrix.os }} | ||
needs: [lint-rust] | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
# install dependencies | ||
- name: Install latest Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: '1.68' | ||
default: true | ||
components: clippy, rustfmt | ||
- name: "Install Wasm Rust target" | ||
run: rustup target add wasm32-wasi && rustup target add wasm32-unknown-unknown | ||
shell: bash | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: "${{ runner.os }}-full-${{ hashFiles('./Cargo.lock') }}" | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Cargo Build | ||
run: cargo build --workspace --release --all-targets --all-features | ||
env: | ||
CARGO_INCREMENTAL: 0 | ||
|
||
test-rust: | ||
name: Plugin Unit Tests | ||
runs-on: ${{ matrix.os }} | ||
needs: [lint-rust] | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
|
||
# install dependencies | ||
- name: Install latest Rust stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: '1.68' | ||
default: true | ||
components: clippy, rustfmt | ||
- name: "Install Wasm Rust target" | ||
run: rustup target add wasm32-wasi && rustup target add wasm32-unknown-unknown | ||
shell: bash | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: "${{ runner.os }}-full-${{ hashFiles('./Cargo.lock') }}" | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Cargo Unit Tests | ||
run: | | ||
cargo test --all --no-fail-fast -- --nocapture | ||
env: | ||
CARGO_INCREMENTAL: 0 | ||
RUST_LOG: trace |
File renamed without changes.
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