-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: use
nix flake check
for check action (#7)
* ci: use `nix flake check` for check action * ci: multi check with nix * ci: multi check with nix * ci: typo --------- Co-authored-by: pk5ls20 <pk5ls20@outlook.com>
- Loading branch information
1 parent
2d7f71d
commit e54574e
Showing
1 changed file
with
108 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,119 @@ | ||
name: Check | ||
on: [push, pull_request] | ||
name: Run Checks | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
actions: write | ||
|
||
env: | ||
RUSTFLAGS: "-Dwarnings" | ||
|
||
jobs: | ||
clippy-check: | ||
build-nixpkg: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix | ||
uses: nixbuild/nix-quick-install-action@v27 | ||
|
||
- name: Restore and cache Nix store | ||
uses: nix-community/cache-nix-action@v5 | ||
with: | ||
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix') }} | ||
restore-prefixes-first-match: nix-${{ runner.os }}- | ||
gc-max-store-size-linux: 107374182 | ||
purge: true | ||
purge-prefixes: cache-${{ runner.os }}- | ||
purge-created: 0 | ||
purge-primary-key: never | ||
|
||
- name: Build package | ||
run: |- | ||
nix build .# | ||
- name: Save Nix Cache | ||
if: always() | ||
uses: nix-community/cache-nix-action/save@v5 | ||
with: | ||
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix') }} | ||
|
||
check-clippy: | ||
runs-on: ubuntu-latest | ||
needs: build-nixpkg | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix | ||
uses: nixbuild/nix-quick-install-action@v27 | ||
|
||
- name: Restore Nix Cache | ||
uses: nix-community/cache-nix-action@v5 | ||
with: | ||
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix') }} | ||
|
||
- name: Check clippy | ||
run: | | ||
nix build .#checks.x86_64-linux.clippy 2>&1 | ||
check-fmt: | ||
runs-on: ubuntu-latest | ||
needs: build-nixpkg | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run clippy | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix | ||
uses: nixbuild/nix-quick-install-action@v27 | ||
|
||
- name: Restore Nix Cache | ||
uses: nix-community/cache-nix-action@v5 | ||
with: | ||
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix') }} | ||
|
||
- name: Check fmt | ||
run: | | ||
sudo apt-get update && sudo apt-get install protobuf-compiler | ||
rustup toolchain install nightly | ||
rustup component add --toolchain nightly clippy | ||
cargo +nightly clippy --all-targets --all-features | ||
nix build .#checks.x86_64-linux.fmt 2>&1 | ||
fmt-check: | ||
check-doc: | ||
runs-on: ubuntu-latest | ||
needs: build-nixpkg | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run fmt | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix | ||
uses: nixbuild/nix-quick-install-action@v27 | ||
|
||
- name: Restore Nix Cache | ||
uses: nix-community/cache-nix-action@v5 | ||
with: | ||
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix') }} | ||
|
||
- name: Check doc | ||
run: | | ||
nix build .#checks.x86_64-linux.doc 2>&1 | ||
check-test: | ||
runs-on: ubuntu-latest | ||
needs: build-nixpkg | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Nix | ||
uses: nixbuild/nix-quick-install-action@v27 | ||
|
||
- name: Restore Nix Cache | ||
uses: nix-community/cache-nix-action@v5 | ||
with: | ||
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.nix') }} | ||
|
||
- name: Check test | ||
run: | | ||
sudo apt-get update && sudo apt-get install protobuf-compiler | ||
rustup toolchain install nightly | ||
rustup component add --toolchain nightly rustfmt | ||
cargo +nightly fmt --all -- --check | ||
nix build .#checks.x86_64-linux.test 2>&1 |