Skip to content

Commit

Permalink
ci: add tests for PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-kirby committed Feb 7, 2023
1 parent d2fdea5 commit c0e4d54
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-rustc-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/ci.yml') }}
key: ${{ runner.os }}-rustc-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/ci.yml', '.github/workflows/pr.yml') }}
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
pull_request:
branches: ["main"]

env:
CARGO_TERM_COLOR: always

jobs:
check:
name: Check
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Toolchain
id: toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: "clippy, rustfmt"
- name: Cache
uses: actions/cache@v3
with:
path: |
target/
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-rustc-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock', '.github/workflows/ci.yml', '.github/workflows/pr.yml') }}
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
if: success() || failure()
run: cargo clippy -- -D warnings
- name: Test
if: success() || failure()
run: cargo test

0 comments on commit c0e4d54

Please sign in to comment.