Skip to content

ci

ci #100

Workflow file for this run

name: ci
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '00 01 * * *'
jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
toolchain:
- stable
- beta
- nightly
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Run tests
run: cargo test --all-features
coverage:
name: Generate code coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust with LLVM tools
uses: dtolnay/rust-toolchain@stable
with:
components: "llvm-tools-preview"
- name: Install grcov
uses: taiki-e/install-action@main
with:
tool: grcov
- name: Run tests for coverage
run: |
cargo test --all-features
env:
RUSTFLAGS: -Cinstrument-coverage
RUSTDOCFLAGS: -Cinstrument-coverage
LLVM_PROFILE_FILE: target/coverage/climbing-grades-%p-%m.profraw
- name: Produce coverage info
run: |
grcov target/coverage \
--source-dir . \
--binary-path ./target/debug/ \
--branch \
--ignore-not-existing \
--keep-only 'src/*' \
--output-type html,lcov \
--output-path target/coverage
- name: Publish coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: target/coverage/html/
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/coverage/lcov
github-pages:
if: github.ref == 'refs/heads/main'
name: Deploy to Github Pages
needs: coverage
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report
path: _site/coverage
- name: Upload Github Pages artifact
uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4