-
Notifications
You must be signed in to change notification settings - Fork 8
42 lines (35 loc) · 1.38 KB
/
coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Coverage on PR
on:
pull_request:
branches: [ "main", "release" ]
jobs:
cuequivariance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade uv
python -m uv pip install pytest pytest-cov
python -m uv pip install ./cuequivariance
- name: Run coverage
run: |
pytest --cov=cuequivariance cuequivariance > coverage.txt
coverage_pr=$(cat coverage.txt | grep TOTAL | awk '{print $4}' | sed 's/%//')
echo "Coverage on PR branch: $coverage_pr"
git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
git checkout ${{ github.event.pull_request.base.ref }}
pytest --cov=cuequivariance cuequivariance > coverage.txt
coverage_target=$(cat coverage.txt | grep TOTAL | awk '{print $4}' | sed 's/%//')
echo "Coverage on target branch: $coverage_target"
if [ $coverage_pr -lt $coverage_target ]; then
echo "Coverage on PR branch is lower than on target branch"
echo "Coverage on PR branch: $coverage_pr"
echo "Coverage on target branch: $coverage_target"
exit 1
fi