ci: Attempt to fix lcov genhtml by creating directory before step #155
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: | |
push: | |
# branches: | |
# - main | |
# This is required to run checks on the translations PR. | |
# This is because actions are not triggered on PRs from an action. | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
permissions: | |
checks: write | |
env: | |
CARGO_TERM_COLOR: always | |
FROM_REF: ${{ github.event.pull_request.base.sha || (!github.event.forced && ( github.event.before != '0000000000000000000000000000000000000000' && github.event.before || github.sha )) || format('{0}~', github.sha) }} | |
TO_REF: ${{ github.sha }} | |
jobs: | |
test: | |
name: Test for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
components: llvm-tools-preview | |
- uses: Swatinem/rust-cache@v2 | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-deny,nextest,cargo-llvm-cov | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install pre-commit & gitlint | |
run: python -m pip install pre-commit gitlint | |
- run: python -m pip freeze --local | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: pre-commit validation | |
run: pre-commit run --show-diff-on-failure --color=always --from-ref ${{ env.FROM_REF }} --to-ref ${{ env.TO_REF }} --hook-stage manual | |
- name: gitlint validation | |
run: gitlint --commits ${{ env.FROM_REF }}..${{ env.TO_REF }} | |
if: always() | |
- name: Formatting | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: fmt | |
args: --check | |
continue-on-error: true | |
- name: Check | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: check | |
args: --all-targets --all-features | |
continue-on-error: true | |
- name: Linting | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: clippy | |
args: --all-targets --all-features | |
continue-on-error: true | |
- name: Tests | |
run: | | |
cargo llvm-cov --no-report nextest --profile ci | |
# cargo llvm-cov --no-report --doc | |
# cargo llvm-cov report --doctests --lcov --output-path lcov.info | |
cargo llvm-cov report --lcov --output-path lcov.info | |
- name: Install LCOV | |
if: success() || failure() | |
uses: hrishikesh-kadam/setup-lcov@v1 | |
- run: mkdir -p ${{ runner.temp }}/__zgosalvez_github-actions-report-lcov/html | |
- name: Report code coverage | |
uses: zgosalvez/github-actions-report-lcov@v4 | |
if: success() || failure() | |
with: | |
coverage-files: lcov.info | |
working-directory: ${{ github.workspace }} | |
artifact-name: code-coverage-report-${{ matrix.os }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
continue-on-error: true | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v4 | |
if: success() || failure() | |
with: | |
report_paths: 'target/nextest/ci/junit.xml' | |
check_name: JUnit Test Report for ${{ matrix.os }} | |
continue-on-error: true |