2023-09-23 14:22:00 +03:00
|
|
|
name: CI tests
|
2021-02-14 22:48:52 +03:00
|
|
|
on: [push, pull_request]
|
2020-11-28 15:14:50 +03:00
|
|
|
|
2023-09-23 14:22:00 +03:00
|
|
|
env:
|
|
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
|
|
RUSTC_WRAPPER: "sccache"
|
2020-11-28 15:14:50 +03:00
|
|
|
|
|
|
|
jobs:
|
2023-09-23 14:22:00 +03:00
|
|
|
build:
|
|
|
|
name: Build project
|
2020-11-28 15:14:50 +03:00
|
|
|
runs-on: ubuntu-latest
|
2023-09-23 14:22:00 +03:00
|
|
|
outputs:
|
|
|
|
rustc_cache_key: ${{ steps.setup_rust.outputs.cachekey }}
|
2020-11-28 15:14:50 +03:00
|
|
|
steps:
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
2023-09-23 14:22:00 +03:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
id: setup_rust
|
2020-11-28 15:14:50 +03:00
|
|
|
with:
|
2023-09-23 14:22:00 +03:00
|
|
|
components: "rustfmt, clippy"
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
|
2020-11-28 15:14:50 +03:00
|
|
|
with:
|
2023-09-23 14:22:00 +03:00
|
|
|
path: |
|
|
|
|
~/.cargo/bin/
|
|
|
|
~/.cargo/registry/index/
|
|
|
|
~/.cargo/registry/cache/
|
|
|
|
~/.cargo/git/db/
|
|
|
|
target/
|
|
|
|
key: "cargo-base-${{ steps.setup_rust.outputs.cachekey }}-${{ hashFiles('**/Cargo.lock') }}"
|
|
|
|
restore-keys: |
|
|
|
|
cargo-base-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
- name: Run sccache-cache
|
2024-06-23 15:59:44 +03:00
|
|
|
uses: mozilla-actions/sccache-action@8417cffc2ec64127ad83077aceaa8631f7cdc83e # v0.0.3
|
2023-09-23 14:22:00 +03:00
|
|
|
- run: cargo build --locked --all-targets
|
2020-11-28 15:14:50 +03:00
|
|
|
|
2023-09-23 14:22:00 +03:00
|
|
|
lint:
|
|
|
|
name: Run lints
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
steps:
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
|
|
|
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
|
2020-11-28 15:14:50 +03:00
|
|
|
with:
|
2023-09-23 14:22:00 +03:00
|
|
|
path: |
|
|
|
|
~/.cargo/bin/
|
|
|
|
~/.cargo/registry/index/
|
|
|
|
~/.cargo/registry/cache/
|
|
|
|
~/.cargo/git/db/
|
|
|
|
target/
|
|
|
|
key: "cargo-lint-${{ needs.build.outputs.rustc_cache_key }}-${{ hashFiles('**/Cargo.lock') }}"
|
|
|
|
restore-keys: |
|
|
|
|
cargo-lint-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
cargo-base-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Run sccache-cache
|
2024-06-23 15:59:44 +03:00
|
|
|
uses: mozilla-actions/sccache-action@8417cffc2ec64127ad83077aceaa8631f7cdc83e # v0.0.3
|
2020-11-28 15:14:50 +03:00
|
|
|
|
2023-09-23 14:22:00 +03:00
|
|
|
- run: cargo fmt --all -- --check
|
|
|
|
- run: cargo check
|
|
|
|
- run: cargo clippy -- -D warnings
|
2020-11-28 15:14:50 +03:00
|
|
|
|
2023-09-26 10:06:19 +03:00
|
|
|
|
|
|
|
pre-commit:
|
|
|
|
name: Run pre-commit
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
env:
|
|
|
|
# These hooks are expensive and already run as dedicated jobs above
|
|
|
|
SKIP: "tests,clippy"
|
|
|
|
steps:
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
|
|
|
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
|
2023-09-26 10:06:19 +03:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/bin/
|
|
|
|
~/.cargo/registry/index/
|
|
|
|
~/.cargo/registry/cache/
|
|
|
|
~/.cargo/git/db/
|
|
|
|
target/
|
|
|
|
key: "cargo-lint-${{ needs.build.outputs.rustc_cache_key }}-${{ hashFiles('**/Cargo.lock') }}"
|
|
|
|
restore-keys: |
|
|
|
|
cargo-lint-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
cargo-base-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Run sccache-cache
|
2024-06-23 15:59:44 +03:00
|
|
|
uses: mozilla-actions/sccache-action@8417cffc2ec64127ad83077aceaa8631f7cdc83e # v0.0.3
|
2023-09-26 10:06:19 +03:00
|
|
|
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
|
2023-09-26 10:06:19 +03:00
|
|
|
- name: set PYVERSION
|
|
|
|
run: echo "PYVERSION=$(python --version | tr ' ' '-')" >> $GITHUB_ENV
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
|
2023-09-26 10:06:19 +03:00
|
|
|
with:
|
|
|
|
path: ~/.cache/pre-commit
|
|
|
|
# Changes to pre-commit-config.yaml may require the installation of
|
|
|
|
# new binaries/scripts. When a cache hit occurs, changes to the cache
|
|
|
|
# aren't persisted at the end of the run, so making the key dependent
|
|
|
|
# on the configuration file ensures we always persist a complete cache.
|
|
|
|
key: pre-commit-${{ env.PYVERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
|
|
|
|
|
|
- run: pip install pre-commit
|
|
|
|
- run: pre-commit run --all --color=always --show-diff-on-failure
|
|
|
|
|
2020-11-28 15:14:50 +03:00
|
|
|
test-linux:
|
|
|
|
name: Test on Linux
|
|
|
|
runs-on: ubuntu-latest
|
2023-09-23 14:22:00 +03:00
|
|
|
needs: build
|
2020-11-28 15:14:50 +03:00
|
|
|
steps:
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
|
|
|
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
|
2020-11-28 15:14:50 +03:00
|
|
|
with:
|
2023-09-23 14:22:00 +03:00
|
|
|
path: |
|
|
|
|
~/.cargo/bin/
|
|
|
|
~/.cargo/registry/index/
|
|
|
|
~/.cargo/registry/cache/
|
|
|
|
~/.cargo/git/db/
|
|
|
|
target/
|
|
|
|
key: "cargo-test-${{ needs.build.outputs.rustc_cache_key }}-${{ hashFiles('**/Cargo.lock') }}"
|
|
|
|
restore-keys: |
|
|
|
|
cargo-test-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
cargo-base-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Run sccache-cache
|
2024-06-23 15:59:44 +03:00
|
|
|
uses: mozilla-actions/sccache-action@8417cffc2ec64127ad83077aceaa8631f7cdc83e # v0.0.3
|
2023-09-23 14:22:00 +03:00
|
|
|
|
|
|
|
- run: cargo test
|
2020-11-28 15:14:50 +03:00
|
|
|
|
|
|
|
test-windows:
|
|
|
|
name: Test on Windows
|
|
|
|
runs-on: windows-latest
|
2023-09-23 14:22:00 +03:00
|
|
|
needs: build
|
2020-11-28 15:14:50 +03:00
|
|
|
steps:
|
|
|
|
- run: git config --system core.autocrlf false && git config --system core.eol lf
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
2023-09-23 14:22:00 +03:00
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
id: setup_rust
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
|
2020-11-28 15:14:50 +03:00
|
|
|
with:
|
2023-09-23 14:22:00 +03:00
|
|
|
path: |
|
|
|
|
~/.cargo/bin/
|
|
|
|
~/.cargo/registry/index/
|
|
|
|
~/.cargo/registry/cache/
|
|
|
|
~/.cargo/git/db/
|
|
|
|
target/
|
|
|
|
key: "cargo-windows-${{ needs.build.outputs.rustc_cache_key }}-${{ hashFiles('**/Cargo.lock') }}"
|
|
|
|
restore-keys: |
|
|
|
|
cargo-windows-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
cargo-base-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Run sccache-cache
|
2024-06-23 15:59:44 +03:00
|
|
|
uses: mozilla-actions/sccache-action@8417cffc2ec64127ad83077aceaa8631f7cdc83e # v0.0.3
|
2023-09-23 14:22:00 +03:00
|
|
|
|
|
|
|
- run: cargo test
|
2020-11-28 15:14:50 +03:00
|
|
|
|
|
|
|
coverage:
|
|
|
|
name: Code coverage
|
|
|
|
runs-on: ubuntu-latest
|
2023-09-23 14:22:00 +03:00
|
|
|
needs: build
|
2020-11-28 15:14:50 +03:00
|
|
|
steps:
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
|
|
|
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
|
2020-11-28 15:14:50 +03:00
|
|
|
with:
|
2023-09-23 14:22:00 +03:00
|
|
|
path: |
|
|
|
|
~/.cargo/bin/
|
|
|
|
~/.cargo/registry/index/
|
|
|
|
~/.cargo/registry/cache/
|
|
|
|
~/.cargo/git/db/
|
|
|
|
target/
|
|
|
|
key: "cargo-coverage-${{ needs.build.outputs.rustc_cache_key }}-${{ hashFiles('**/Cargo.lock') }}"
|
|
|
|
restore-keys: |
|
|
|
|
cargo-coverage-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
cargo-base-${{ env.RUSTC_CACHEKEY }}
|
|
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Run sccache-cache
|
2024-06-23 15:59:44 +03:00
|
|
|
uses: mozilla-actions/sccache-action@8417cffc2ec64127ad83077aceaa8631f7cdc83e # v0.0.3
|
2023-09-23 14:22:00 +03:00
|
|
|
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions-rs/tarpaulin@044a1e5bdace8dd2f727b1af63c1d9a1d3572068 # v0.1
|
2020-11-28 15:14:50 +03:00
|
|
|
with:
|
2023-09-22 12:20:32 +03:00
|
|
|
# Constrained by https://github.com/actions-rs/tarpaulin/pull/23
|
|
|
|
version: "0.22.0"
|
2020-11-28 15:14:50 +03:00
|
|
|
args: "--ignore-tests"
|
|
|
|
out-type: "Html"
|
2024-06-23 15:59:44 +03:00
|
|
|
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
|
2020-11-28 15:14:50 +03:00
|
|
|
with:
|
|
|
|
name: tarpaulin-report
|
|
|
|
path: tarpaulin-report.html
|