Skip to content

Commit

Permalink
Add Rust CI and lints.
Browse files Browse the repository at this point in the history
  • Loading branch information
therealyingtong committed Jul 15, 2021
1 parent 5191a54 commit aadaca6
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: CI checks

on: [push, pull_request]

jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# We don't need to test across multiple platforms yet
# os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.53.0
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --all --all-features

build:
name: Build target ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
target:
- wasm32-unknown-unknown
- wasm32-wasi

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.53.0
override: true
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features

bitrot:
name: Bitrot check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.53.0
override: true
# Build benchmarks to prevent bitrot
- name: Build benchmarks
uses: actions-rs/cargo@v1
with:
command: build
args: --benches --examples --all-features

doc-links:
name: Intra-doc links
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.53.0
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch

# Ensure intra-documentation links all resolve correctly
# Requires #![deny(intra_doc_link_resolution_failure)] in crates.
- name: Check intra-doc links
uses: actions-rs/cargo@v1
with:
command: doc
args: --all --document-private-items

fmt:
name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.53.0
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
27 changes: 27 additions & 0 deletions .github/workflows/lints-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Beta lints

# These lints are only informative, so we only run them directly on branches
# and not trial-merges of PRs, to reduce noise.
on: push

jobs:
clippy-beta:
name: Clippy (beta)
timeout-minutes: 30
runs-on: ubuntu-latest
continue-on-error: true

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: beta
components: clippy
override: true
- name: Run Clippy (beta)
uses: actions-rs/clippy-check@v1
continue-on-error: true
with:
name: Clippy (beta)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -W clippy::all
25 changes: 25 additions & 0 deletions .github/workflows/lints-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

name: Stable lints

# We only run these lints on trial-merges of PRs to reduce noise.
on: pull_request

jobs:
clippy:
name: Clippy (1.53.0)
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.53.0
components: clippy
override: true
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
name: Clippy (1.53.0)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings

0 comments on commit aadaca6

Please sign in to comment.