Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/v0.3.0 #62

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open
44 changes: 27 additions & 17 deletions .github/workflows/benches.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
name: Benches
name: Rust benches

on:
push:
branches: [ main, develop ]

workflow_call:
inputs:
toolchain:
description: 'rust toolchain'
required: false
default: 'stable'
type: string
# options:
# - stable
# - nightly
# - beta

env:
CARGO_TERM_COLOR: always

jobs:
bench:
name: Run checks for Lattice QCD rs
name: Run criterion benches
runs-on: ubuntu-latest
env:
CRITERION_TOKEN: ${{ secrets.CRITERION_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust stable toolchain
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: ${{ inputs.toolchain }}
default: true

- name: Run benchmarks
run: |
# run benchmarks and save baseline in a directory called "new"
cargo bench
- name: Upload benchmarks
run: |
# upload the files
bash <(curl -s https://criterion.dev/bash)
run: cargo bench --verbose

# - name: Upload benchmarks
# env:
# CRITERION_TOKEN: ${{ secrets.CRITERION_TOKEN }}
# run: |
# # upload the files
# bash <(curl -s https://criterion.dev/bash)
39 changes: 39 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: clippy check

on:
workflow_call:
inputs:
features_flag:
description: 'feature flag used on the cargo command'
required: false
default: '--all-features'
type: string
toolchain:
description: 'rust toolchain'
required: false
type: string

env:
CARGO_TERM_COLOR: always

jobs:
linter:
name: lint code with clippy on nightly
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ inputs.toolchain }}
components: cargo, clippy
default: true

- name: Linter
run: cargo clippy --all --verbose --all-targets ${{ inputs.features_flag }} -- --no-deps --deny warnings

- name: Linter release
run: cargo clippy --all --verbose --all-targets --release ${{ inputs.features_flag }} -- --no-deps --deny warnings
34 changes: 23 additions & 11 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,46 @@ name: coverage
env:
CARGO_TERM_COLOR: always

on: [push]
on:
workflow_call:
inputs:
profile_file_name_prefix:
description: 'prefix of the LLVM profile file'
required: true
default: 'profile'
type: string
features_flag:
description: 'feature flag used on the cargo command'
required: true
default: '--all-features'
type: string

jobs:
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly

- name: Install llvm-tools-preview
run: |
rustup default nightly
rustup component add llvm-tools-preview
components: llvm-tools-preview
default: true

- name: Install grcov
run: curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -

- name: Generate code coverage
env:
RUSTFLAGS: -Cinstrument-coverage
RUSTDOCFLAGS: -Cinstrument-coverage -Zunstable-options --persist-doctests target/debug/doctestbins
LLVM_PROFILE_FILE: ${{ inputs.profile_file_name_prefix }}-%p-%m.profraw
run: |
export RUSTFLAGS="-Zinstrument-coverage"
export RUSTDOCFLAGS="-Zinstrument-coverage -Zunstable-options --persist-doctests target/debug/doctestbins"
cargo +nightly build --verbose --all --features="no-overflow-test","serde-serialize"
LLVM_PROFILE_FILE="lattice_qcd_rs-%p-%m.profraw" cargo +nightly test --verbose --features="no-overflow-test","serde-serialize" --workspace --exclude lattice_qcd_rs-procedural_macro
cargo +nightly test --verbose --all --all-targets ${{ inputs.features_flag }}
cargo +nightly test --verbose --all --doc ${{ inputs.features_flag }}

- name: parse code coverage
run: ./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
name: fmt
name: fmt check

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_call:

env:
CARGO_TERM_COLOR: always

jobs:
fmt:

name: check the format of the code
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt,
components: rustfmt, cargo
default: true

- name: fmt
run: cargo +nightly fmt --all -- --check
- name: rustfmt check
run: cargo +nightly fmt --all --check
103 changes: 79 additions & 24 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,93 @@
name: Rust
name: Rust checks

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
# pull_request:
# branches: [ main, develop ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ${{ matrix.os }}
format:
name: check the format of the code
uses: ./.github/workflows/fmt.yml

rustdoc-check:
name: rustdoc check
uses: ./.github/workflows/rust_doc_check.yml
with:
toolchain: stable

rust_test:
name: rust test
needs: [format]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v2
profile: [test, release]
exclude:
- os: windows-latest
profile: release

uses: ./.github/workflows/rust_test.yml
with:
features_flag_1: --features="serde-serialize"
features_flag_2: --no-default-features --features="overflow-test"
toolchain: stable
os: ${{ matrix.os }}
profile: ${{ matrix.profile }}
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4

# - name: Install Rust stable toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# default: true

- name: Install Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
# - name: Run tests with serd
# run: cargo +stable test --profile ${{ matrix.profile }} --all --verbose --no-fail-fast --features="serde-serialize"

- name: Build with serd
run: cargo build --all --verbose --features serde-serialize

- name: Run tests with serd
run: cargo test --all --verbose --features serde-serialize
# - name: Run examples tests with serd
# run: cargo +stable test --profile ${{ matrix.profile }} --all --verbose --no-fail-fast --features="serde-serialize" --examples

- name: Build no features
run: cargo build --all --verbose --no-default-features

- name: Run tests no features
run: cargo test --all --verbose --no-default-features
# it is faster to keep the going and reuse previous compilation artefact than using
# a matrix strategy and starting all over again
# - name: Run tests no features
# run: cargo +stable test --profile ${{ matrix.profile }} --all --verbose --no-fail-fast --no-default-features --features="overflow-test"

# - name: Run examples tests no features
# run: cargo +stable test --profile ${{ matrix.profile }} --all --verbose --no-fail-fast --no-default-features --features="overflow-test" --examples

linter:
name: lint code on nightly release
needs: [format, rustdoc-check]
uses: ./.github/workflows/clippy.yml
with:
features_flag: --all-features
toolchain: nightly

coverage:
name: coverage
uses: ./.github/workflows/coverage.yml
with:
profile_file_name_prefix: lattice-qcd-rs
features_flag: --no-default-features --features="serde-serialize"

benches:
name: benches
needs: [format, coverage, rust_test]
if: ${{ github.ref_name == 'main' || github.ref_name == 'develop' }}
uses: ./.github/workflows/benches.yml
with:
toolchain: stable

doc_publish:
name: publish rust doc
needs: [format, coverage, rust_test, rustdoc-check, linter]
if: ${{ github.ref_name == 'main' }}
uses: ./.github/workflows/rust_doc_publish.yml
with:
toolchain: stable
34 changes: 0 additions & 34 deletions .github/workflows/rust_beta.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/rust_doc.yml

This file was deleted.

Loading
Loading