Skip to content

fix: keep fork quality workflows running #316

fix: keep fork quality workflows running

fix: keep fork quality workflows running #316

Workflow file for this run

name: Coverage
on:
pull_request:
branches:
- main
- release*
- release/*
- release-*
permissions:
actions: read
contents: read
pull-requests: write
jobs:
coverage:
name: Coverage
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
platform: Linux
comment_header: coverage-linux
- os: windows-latest
target: x86_64-pc-windows-msvc
platform: Windows
comment_header: coverage-windows
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Post Coverage Started Comment
if: github.event.pull_request.head.repo.full_name == github.repository
continue-on-error: true
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
with:
header: ${{ matrix.comment_header }}
message: |
## Test Coverage Report (${{ matrix.platform }})
:hourglass_flowing_sand: **Coverage analysis in progress...**
Comparing against exact base `${{ github.event.pull_request.base.sha }}`.
- name: Set Python to PATH
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
- name: Validate Snapshot Comparator
run: python -m unittest discover -s scripts/tests -p 'test_*.py' -v
shell: bash
- name: Add Conda to PATH (Windows)
if: startsWith(matrix.os, 'windows')
run: |
$path = $env:PATH + ";" + $env:CONDA + "\condabin"
echo "PATH=$path" >> $env:GITHUB_ENV
- name: Add Conda to PATH (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: echo "PATH=$PATH:$CONDA/condabin" >> $GITHUB_ENV
shell: bash
- name: Check Conda version
run: conda info --all
- name: Create Conda Environments
run: |
conda create -n test-env1 python=3.12 -y
conda create -n test-env-no-python -y
conda create -p ./prefix-envs/.conda1 python=3.12 -y
conda create -p ./prefix-envs/.conda-nopy -y
- name: Install pipenv
run: pip install pipenv
- name: Check pipenv version
run: pipenv --version
- name: Create a Pipenv Environment
run: pipenv install
- name: Install virtualenvwrapper (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
pip install virtualenvwrapper
echo "WORKON_HOME=$HOME/.virtualenvs" >> $GITHUB_ENV
mkdir -p $HOME/.virtualenvs
source virtualenvwrapper.sh
mkvirtualenv venv_wrapper_env1
shell: bash
- name: Install virtualenvwrapper-win (Windows)
if: startsWith(matrix.os, 'windows')
run: |
pip install virtualenvwrapper-win
echo "WORKON_HOME=$HOME/.virtualenvs" >> $GITHUB_ENV
shell: bash
- name: Install pyenv (Windows)
if: startsWith(matrix.os, 'windows')
run: |
Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"
$pyenvBin = "$env:USERPROFILE\.pyenv\pyenv-win\bin"
echo "$pyenvBin" >> $env:GITHUB_PATH
echo "PYENV_ROOT=$env:USERPROFILE\.pyenv" >> $env:GITHUB_ENV
shell: pwsh
- name: Install pyenv and pyenv-virtualenv (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
curl https://pyenv.run | bash
echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV
echo "PATH=$HOME/.pyenv/bin:$PATH" >> $GITHUB_ENV
shell: bash
- name: Check Pyenv version
run: pyenv --version
shell: bash
- name: Install Pyenv Python(s) (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
pyenv install --list
pyenv install 3.13:latest 3.12:latest 3.9:latest
shell: bash
- name: Install Pyenv Python(s) (Windows)
if: startsWith(matrix.os, 'windows')
run: |
pyenv install --list
pyenv install 3.10.5 3.8.10
shell: bash
- name: Create pyenv-virtualenv envs (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
eval "$(pyenv virtualenv-init -)"
pyenv virtualenv 3.12 pyenv-virtualenv-env1
shell: bash
- name: Create .venv
run: python -m venv .venv
shell: bash
- name: Create .venv2
run: python -m venv .venv2
shell: bash
- name: Install Pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1
with:
run-install: false
- name: Create Pixi environments
run: |
pixi init
pixi add python
pixi add --feature dev python
pixi project environment add --feature dev dev
pixi install --environment dev
shell: bash
- name: Rust Tool Chain setup
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Ensure Git bash is on PATH (Windows)
if: startsWith(matrix.os, 'windows')
run: |
# Git for Windows is always installed on GitHub-hosted runners.
# Add its bin dir so taiki-e/install-action can find bash.exe.
# See https://github.com/actions/partner-runner-images/issues/169
$gitBin = 'C:\Program Files\Git\bin'
if (Test-Path (Join-Path $gitBin 'bash.exe')) {
echo $gitBin >> $env:GITHUB_PATH
Write-Output "Added $gitBin to PATH"
} else {
Write-Warning "bash.exe not found at $gitBin"
}
shell: pwsh
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Cargo Fetch
run: cargo fetch
shell: bash
- name: Run Tests with Coverage
id: coverage
run: cargo llvm-cov --features ci --lcov --output-path lcov.info -- --nocapture --test-threads=1
env:
RUST_BACKTRACE: 1
RUST_LOG: trace
shell: bash
- name: Wait for Exact PR Base Coverage
id: wait_for_base_coverage
if: always()
run: >-
python scripts/wait_for_baseline.py
--repository "${{ github.repository }}"
--workflow coverage-baseline.yml
--commit "${{ github.event.pull_request.base.sha }}"
--artifact "coverage-baseline-${{ matrix.os }}"
--timeout-seconds 1200
--poll-seconds 20
env:
GITHUB_TOKEN: ${{ github.token }}
shell: bash
- name: Download Exact PR Base Coverage
if: always() && steps.wait_for_base_coverage.outcome == 'success'
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6
with:
workflow: coverage-baseline.yml
commit: ${{ github.event.pull_request.base.sha }}
workflow_conclusion: success
name: coverage-baseline-${{ matrix.os }}
path: baseline-coverage
check_artifacts: true
search_artifacts: true
- name: Compare Coverage Snapshot
if: always()
run: >-
python scripts/quality_snapshot.py coverage
--current lcov.info
--baseline baseline-coverage/lcov.info
--platform "${{ matrix.platform }}"
--report coverage-report.md
--summary "$GITHUB_STEP_SUMMARY"
shell: bash
- name: Upload PR Coverage Artifact
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-pr-${{ matrix.os }}
path: |
lcov.info
coverage-report.md
if-no-files-found: ignore
- name: Post Coverage Comment
if: >-
always() &&
github.event.pull_request.head.repo.full_name == github.repository
continue-on-error: true
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
with:
header: ${{ matrix.comment_header }}
path: coverage-report.md