diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml new file mode 100644 index 0000000..2f69821 --- /dev/null +++ b/.github/workflows/basic.yml @@ -0,0 +1,38 @@ +name: Basic Validation + +on: + push: + pull_request: + workflow_dispatch: + schedule: + - cron: '26 3 20 * *' + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: "-Dwarnings" + +jobs: + build-and-test: + + name: Build and Test + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Prepare environment + run: | + rustup update stable + cargo clean + - name: Build with cargo + run: | + cargo build --features "double_precision" + cargo build --features "debug" + cargo build --release + cargo clean + - name: Test with cargo + run: | + cargo test + cargo test --features "double_precision" + cargo test --features "debug" + cargo clean diff --git a/.github/workflows/clippy-check.yml b/.github/workflows/clippy-check.yml new file mode 100644 index 0000000..78dddbf --- /dev/null +++ b/.github/workflows/clippy-check.yml @@ -0,0 +1,19 @@ +on: pull_request + +name: Cargo Clippy + +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: "-Dwarnings" + +jobs: + clippy_check: + name: Check + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Clippy + run: | + rustup component add clippy + cargo clippy -- -D warnings diff --git a/.github/workflows/doc-coverage.yml b/.github/workflows/doc-coverage.yml new file mode 100644 index 0000000..6ed7ab3 --- /dev/null +++ b/.github/workflows/doc-coverage.yml @@ -0,0 +1,45 @@ +name: Cargo Doc + +on: + pull_request + +jobs: + pr-comment: + name: Check Coverage + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + - name: Fetch base + run: git fetch origin ${{ github.event.pull_request.base.sha }} + - name: Checkout base + run: git checkout ${{ github.event.pull_request.base.sha }} + - name: Calculate base doc coverage + uses: bewee/rustdoc-coverage-action@v1 + - name: Fetch head + run: git fetch origin ${{ github.event.pull_request.head.sha }} + - name: Checkout head + run: git checkout ${{ github.event.pull_request.head.sha }} + - name: Calculate doc coverage + id: coverage + uses: bewee/rustdoc-coverage-action@v1 + - name: Find Comment + uses: peter-evans/find-comment@v1 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: "github-actions[bot]" + body-includes: "## Documentation Coverage:" + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + ## Documentation Coverage: + ${{ steps.coverage.outputs.table }} + edit-mode: replace \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 989d3fc..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: cargo - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - workflow_dispatch: - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Prepare environment - run: | - sudo apt-get update - sudo apt-get install clang - sudo apt-get install libclang1 - sudo apt-get install gnuplot - rustup update stable - cargo install cargo-criterion - cargo clean - - name: Build with cargo - run: | - cargo build --release - cargo build --release --features "double_precision" - cargo clean - - name: Check with clippy - run: | - cargo clippy -- -W clippy::pedantic - cargo clean - - name: Test with cargo - run: | - cargo test - cargo test --features "double_precision" - cargo clean - - name: Benchmark with criterion - run: | - cargo criterion - cargo criterion --features "double_precision" diff --git a/README.md b/README.md index 7282a4e..e0267cd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![License](https://img.shields.io/github/license/ScaleWeather/floccus)](https://choosealicense.com/licenses/apache-2.0/) [![Crates.io](https://img.shields.io/crates/v/floccus)](https://crates.io/crates/floccus) [![dependency status](https://deps.rs/repo/github/ScaleWeather/floccus/status.svg)](https://deps.rs/repo/github/ScaleWeather/floccus) -[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ScaleWeather/floccus/rust.yml?branch=main&label=cargo%20build)](https://github.com/ScaleWeather/floccus/actions) +[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ScaleWeather/floccus/basic.yml?branch=main&label=cargo%20build)](https://github.com/ScaleWeather/floccus/actions) Rust crate providing formulae for air thermodynamic calculations.