Skip to content

Commit

Permalink
Merge pull request #12 from kate-goldenring/code-quality-workflows
Browse files Browse the repository at this point in the history
Add audit and build workflows
  • Loading branch information
kate-goldenring committed Jun 5, 2023
2 parents 25282e2 + 7c70262 commit 515d7ff
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/audits.yml
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
105 changes: 105 additions & 0 deletions .github/workflows/build.yml
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.
8 changes: 6 additions & 2 deletions src/commands/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ use std::{
use url::Url;
use uuid::Uuid;

use crate::{commands::variables::set_variables, opts::*, parse_buildinfo};
use crate::commands::variables::set_variables;

use super::login::{LoginCommand, LoginConnection};
use crate::{
commands::login::{LoginCommand, LoginConnection},
opts::*,
parse_buildinfo,
};

const SPIN_DEPLOY_CHANNEL_NAME: &str = "spin-deploy";
const SPIN_DEFAULT_KV_STORE: &str = "default";
Expand Down

0 comments on commit 515d7ff

Please sign in to comment.