Skip to content

Commit e9a1149

Browse files
committed
Add coverage workflows for baseline and pull request coverage comparison
1 parent 525aa9f commit e9a1149

File tree

2 files changed

+428
-0
lines changed

2 files changed

+428
-0
lines changed
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: Coverage Baseline
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
coverage:
10+
name: Coverage Baseline
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- os: ubuntu-latest
17+
target: x86_64-unknown-linux-musl
18+
- os: windows-latest
19+
target: x86_64-pc-windows-msvc
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Set Python to PATH
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.12"
28+
29+
- name: Add Conda to PATH (Windows)
30+
if: startsWith(matrix.os, 'windows')
31+
run: |
32+
$path = $env:PATH + ";" + $env:CONDA + "\condabin"
33+
echo "PATH=$path" >> $env:GITHUB_ENV
34+
35+
- name: Add Conda to PATH (Linux)
36+
if: startsWith(matrix.os, 'ubuntu')
37+
run: echo "PATH=$PATH:$CONDA/condabin" >> $GITHUB_ENV
38+
shell: bash
39+
40+
- name: Check Conda version
41+
run: conda info --all
42+
43+
- name: Create Conda Environments
44+
run: |
45+
conda create -n test-env1 python=3.12 -y
46+
conda create -n test-env-no-python -y
47+
conda create -p ./prefix-envs/.conda1 python=3.12 -y
48+
conda create -p ./prefix-envs/.conda-nopy -y
49+
50+
- name: Install pipenv
51+
run: pip install pipenv
52+
53+
- name: Check pipenv version
54+
run: pipenv --version
55+
56+
- name: Create a Pipenv Environment
57+
run: pipenv install
58+
59+
- name: Install virtualenvwrapper (Linux)
60+
if: startsWith(matrix.os, 'ubuntu')
61+
run: |
62+
pip install virtualenvwrapper
63+
echo "WORKON_HOME=$HOME/.virtualenvs" >> $GITHUB_ENV
64+
mkdir -p $HOME/.virtualenvs
65+
source virtualenvwrapper.sh
66+
mkvirtualenv venv_wrapper_env1
67+
shell: bash
68+
69+
- name: Install virtualenvwrapper-win (Windows)
70+
if: startsWith(matrix.os, 'windows')
71+
run: |
72+
pip install virtualenvwrapper-win
73+
echo "WORKON_HOME=$HOME/.virtualenvs" >> $GITHUB_ENV
74+
shell: bash
75+
76+
- name: Install pyenv (Windows)
77+
if: startsWith(matrix.os, 'windows')
78+
run: |
79+
choco install pyenv-win -y
80+
echo "PATH=$PATH;$HOME/.pyenv/pyenv-win/bin;$HOME/.pyenv/pyenv-win/shims" >> $GITHUB_ENV
81+
echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV
82+
shell: bash
83+
84+
- name: Install pyenv and pyenv-virtualenv (Linux)
85+
if: startsWith(matrix.os, 'ubuntu')
86+
run: |
87+
curl https://pyenv.run | bash
88+
echo "PYENV_ROOT=$HOME/.pyenv" >> $GITHUB_ENV
89+
echo "PATH=$HOME/.pyenv/bin:$PATH" >> $GITHUB_ENV
90+
shell: bash
91+
92+
- name: Check Pyenv version
93+
run: pyenv --version
94+
shell: bash
95+
96+
- name: Install Pyenv Python(s) (Linux)
97+
if: startsWith(matrix.os, 'ubuntu')
98+
run: |
99+
pyenv install --list
100+
pyenv install 3.13:latest 3.12:latest 3.9:latest
101+
shell: bash
102+
103+
- name: Install Pyenv Python(s) (Windows)
104+
if: startsWith(matrix.os, 'windows')
105+
run: |
106+
pyenv install --list
107+
pyenv install 3.10.5 3.8.10
108+
shell: bash
109+
110+
- name: Create pyenv-virtualenv envs (Linux)
111+
if: startsWith(matrix.os, 'ubuntu')
112+
run: |
113+
eval "$(pyenv virtualenv-init -)"
114+
pyenv virtualenv 3.12 pyenv-virtualenv-env1
115+
shell: bash
116+
117+
- name: Create .venv
118+
run: python -m venv .venv
119+
shell: bash
120+
121+
- name: Create .venv2
122+
run: python -m venv .venv2
123+
shell: bash
124+
125+
- name: Install Pixi
126+
uses: prefix-dev/[email protected]
127+
with:
128+
run-install: false
129+
130+
- name: Create Pixi environments
131+
run: |
132+
pixi init
133+
pixi add python
134+
pixi add --feature dev python
135+
pixi project environment add --feature dev dev
136+
pixi install --environment dev
137+
shell: bash
138+
139+
- name: Rust Tool Chain setup
140+
uses: dtolnay/rust-toolchain@stable
141+
with:
142+
toolchain: stable
143+
targets: ${{ matrix.target }}
144+
145+
- name: Install cargo-llvm-cov
146+
uses: taiki-e/install-action@cargo-llvm-cov
147+
148+
- name: Cargo Fetch
149+
run: cargo fetch
150+
shell: bash
151+
152+
- name: Run Tests with Coverage
153+
run: cargo llvm-cov --features ci --lcov --output-path lcov.info -- --nocapture --test-threads=1
154+
env:
155+
RUST_BACKTRACE: 1
156+
RUST_LOG: trace
157+
shell: bash
158+
159+
- name: Upload Coverage Artifact
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: coverage-baseline-${{ matrix.os }}
163+
path: lcov.info
164+
retention-days: 90

0 commit comments

Comments
 (0)