refactor: CI/CD #34
Workflow file for this run
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
name: ci | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- closed | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}/${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
rust-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Check | |
run: cargo check --no-default-features | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Check formatting | |
run: cargo fmt -- --check | |
- name: code-coverage | |
env: | |
TOKEN: ${{secrets.CODECOV_TOKEN}} | |
run: | | |
cargo install cargo-tarpaulin --force --git https://github.com/xd009642/tarpaulin --branch develop | |
cargo tarpaulin --out xml | |
bash <(curl -s https://codecov.io/bash) | |
benchmarks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: pip install -r tests/requirements.txt | |
- name: Setup rust toolchain, cache and cargo-codspeed binary | |
uses: moonrepo/setup-rust@v0 | |
with: | |
channel: stable | |
cache-target: release | |
bins: cargo-codspeed | |
- name: Install project | |
run: pip install . | |
- name: Build the benchmark target(s) | |
run: cargo codspeed build | |
- name: Run benchmarks | |
uses: CodSpeedHQ/action@v1 | |
with: | |
token: ${{ secrets.CODSPEED_TOKEN }} | |
run: pytest tests/ --codspeed && cargo codspeed run |