-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b42b9e
commit dbbc021
Showing
12 changed files
with
147 additions
and
105 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,73 +1,73 @@ | ||
on: push | ||
name: CI | ||
name: Check and build the library using Nix | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
check: | ||
name: Check/Lint | ||
runs-on: ubuntu-latest | ||
env: | ||
RUSTFLAGS: -D warnings | ||
CARGO_TERM_COLOR: always | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
# We need nightly for fmt | ||
toolchain: nightly | ||
override: true | ||
components: rustfmt, clippy | ||
- uses: Swatinem/rust-cache@v1 | ||
- name: Lint (clippy) | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: --all-targets | ||
- name: Lint (rustfmt) | ||
uses: actions-rs/cargo@v1 | ||
- name: git checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
- name: Check Nixpkgs inputs | ||
uses: DeterminateSystems/flake-checker-action@main | ||
with: | ||
command: fmt | ||
args: --all --check | ||
fail-mode: true | ||
|
||
build: | ||
name: Build and test | ||
# Nix-specific logic begins here | ||
- name: Check Rust formatting | ||
run: | | ||
nix develop --command cargo fmt --all --check | ||
- name: Check Clippy lints | ||
run: | | ||
nix develop --command cargo clippy --all-targets | ||
- name: Check spelling | ||
run: | | ||
nix develop --command \ | ||
codespell \ | ||
--skip target,.git \ | ||
--ignore-words-list crate | ||
test_and_build: | ||
name: Test and build library | ||
needs: check | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust-version: [stable, 1.60, nightly] | ||
fail-fast: false | ||
env: | ||
RUSTFLAGS: -D warnings | ||
CARGO_TERM_COLOR: always | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust-version }} | ||
override: true | ||
components: llvm-tools-preview | ||
- uses: Swatinem/rust-cache@v1 | ||
- name: Build all targets with | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --all-targets | ||
- name: Tests | ||
uses: actions-rs/cargo@v1 | ||
- name: git checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
- name: Set up Rust cache | ||
uses: actions/cache@v3 | ||
with: | ||
command: test | ||
- name: Install cargo-llvm-cov | ||
uses: taiki-e/install-action@cargo-llvm-cov | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: psrdada-rs-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Test library | ||
run: | | ||
nix develop --command cargo test | ||
- name: Build library | ||
run: | | ||
nix develop --command cargo build | ||
- name: Generate code coverage | ||
if: startsWith(matrix.rust-version, 'stable') | ||
run: cargo llvm-cov --workspace --lcov --output-path lcov.info | ||
run: nix develop --command cargo llvm-cov --workspace --lcov --output-path lcov.info | ||
- name: Upload coverage to Codecov | ||
if: startsWith(matrix.rust-version, 'stable') | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: lcov.info | ||
fail_ci_if_error: true | ||
fail_ci_if_error: true |
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ psrdada-sys/vendor/.ccls-cache | |
.vscode/ | ||
.direnv | ||
result | ||
lcov.info |
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
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
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
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
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
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
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
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
Oops, something went wrong.