From 187b7352e75cc733c383ae555ecc8c438b0306a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= <44257381+JSorngard@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:33:55 +0200 Subject: [PATCH 1/3] Attempt at version badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bbe2f12..e0cf617 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Latest Version](https://img.shields.io/crates/v/const-primes.svg)](https://crates.io/crates/const-primes) + # const-primes A crate for generating and working with prime numbers in const contexts. From 4b27cfa03b7e507933a58e96df68c6b443008231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= <44257381+JSorngard@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:38:38 +0200 Subject: [PATCH 2/3] Create rust.yml --- .github/workflows/rust.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..c4a5d42 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,25 @@ +name: Rust + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Format + run: cargo fmt --verbose + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Test + run: cargo test --verbose From eb735e0809768467e35ca5d4134a3a3ec8934afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= <44257381+JSorngard@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:49:59 +0200 Subject: [PATCH 3/3] Add fmt, check, clippy, test, coverage to actions --- .github/workflows/rust.yml | 40 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c4a5d42..7d6011b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,8 +14,23 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Format - run: cargo fmt --verbose + - uses: dtolnay/rust-toolchain@stable + - name: cargo fmt --check + run: cargo fmt --check + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + - name: cargo check --verbose + run: cargo check --verbose + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + - name: cargo clippy -- -D warning + run: cargo clippy -- -D warnings test: runs-on: ubuntu-latest @@ -23,3 +38,24 @@ jobs: - uses: actions/checkout@v3 - name: Test run: cargo test --verbose + + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + with: + components: llvm-tools-preview + - name: cargo install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + run: cargo generate-lockfile + - name: cargo llvm-cov + run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + fail_ci_if_error: true