Skip to content

Commit

Permalink
Merge pull request #2 from uzimaru0000/install-ci
Browse files Browse the repository at this point in the history
Add caching for .cargo directory and create CI workflow
  • Loading branch information
uzimaru0000 authored Dec 29, 2023
2 parents b0b0a87 + 8b36fcd commit d8aa897
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/actions/cache_cargo/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: cache_cargo
description: caching .cargo directory
runs:
using: composite

steps:
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
server/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on: push

jobs:
build_cache:
runs-on: ubuntu-latest
env:
RUSTC_FORCE_INCREMENTAL: 1
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/cache_cargo
- name: build
run: cargo build

fmt:
runs-on: ubuntu-latest
needs: build_cache
steps:
- uses: actions/checkout@v2
- run: rustup component add rustfmt
- uses: ./.github/actions/cache_cargo
- name: fmt
run: cargo fmt --all -- --check

clippy:
runs-on: ubuntu-latest
env:
RUSTC_FORCE_INCREMENTAL: 1
needs: build_cache
steps:
- uses: actions/checkout@v2
- run: rustup component add clippy
- uses: ./.github/actions/cache_cargo
- name: clippy
run: cargo clippy --all-targets --all-features -- -D warnings

test:
runs-on: ubuntu-latest
env:
RUSTC_FORCE_INCREMENTAL: 1
needs: build_cache
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/cache_cargo
- name: test
run: cargo test --all -- --nocapture

0 comments on commit d8aa897

Please sign in to comment.