Add lint passes #153
Workflow file for this run
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: Continuous Integration | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
RUST_BACKTRACE: 1 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
rust: | |
name: Compile and Test (${{ matrix.os }}) | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
# This is a workaround for https://github.com/actions/checkout/issues/135 | |
- name: Set git to use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- uses: actions/checkout@v2 | |
- name: Setup Rust | |
uses: dsherret/rust-toolchain-file@v1 | |
- name: Install Nextest | |
uses: taiki-e/install-action@nextest | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Type Checking | |
run: cargo check --workspace --verbose --locked | |
- name: Build | |
run: cargo build --workspace --verbose --locked | |
- name: Test | |
run: cargo nextest run --workspace --verbose --locked | |
- name: Doc Tests | |
run: cargo test --doc --workspace --verbose --locked | |
lints: | |
name: Linting and Formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Setup Rust | |
uses: dsherret/rust-toolchain-file@v1 | |
- name: Check Formatting | |
run: cargo fmt --all --verbose --check | |
- name: Clippy | |
run: cargo clippy --workspace --verbose --locked | |
vscode: | |
name: VS Code Plugin | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: plugins/vscode | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Setup Rust | |
uses: dsherret/rust-toolchain-file@v1 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
cache: npm | |
cache-dependency-path: plugins/vscode/package-lock.json | |
- name: Install JavaScript Dependencies | |
run: npm ci | |
- name: Build | |
run: npm run compile | |
code-coverage: | |
name: Code Coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Rust Cache | |
uses: taiki-e/install-action@nextest | |
- name: Install llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Setup Rust | |
uses: dsherret/rust-toolchain-file@v1 | |
- name: Generate Code Coverage | |
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: lcov.info | |
fail_ci_if_error: true | |
api-docs: | |
name: Publish API Docs to GitHub Pages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Rust Cache | |
uses: taiki-e/install-action@nextest | |
- name: Install llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Setup Rust | |
uses: dsherret/rust-toolchain-file@v1 | |
- name: Generate Docs | |
run: cargo xtask doc | |
env: | |
RUST_LOG: debug | |
- name: Upload Docs | |
uses: JamesIves/github-pages-deploy-action@v4 | |
if: github.ref == 'refs/heads/main' | |
with: | |
branch: gh-pages | |
folder: public | |
single-commit: true | |
workflow-times: | |
name: Workflow Timings | |
runs-on: ubuntu-latest | |
needs: | |
- rust | |
- vscode | |
if: always() | |
steps: | |
- name: Time Reporter | |
uses: Michael-F-Bryan/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | | |
Compile and Test (ubuntu-latest) | |
Compile and Test (macos-latest) | |
Compile and Test (windows-latest) | |
VS Code Plugin | |
message: | | |
Make sure you keep an eye on build times! | |
The goal is to keep CI times under 5 minutes so developers can maintain a fast edit-compile-test cycle. | |