-
Notifications
You must be signed in to change notification settings - Fork 7
55 lines (51 loc) · 2.15 KB
/
python-test.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
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Python test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up MPI
uses: mpi4py/setup-mpi@v1
with:
mpi: 'openmpi'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ."[test]"
- name: Lint with ruff
run: |
# Stop the build if there are Python syntax errors or undefined names.
ruff check --output-format=github --select=E9,F63,F7,F82 --target-version=py39 .
# Default set of ruff rules with GitHub Annotations
ruff check --output-format=github --target-version=py39 .
- name: Test with pytest and measure coverage
run: |
coverage run --rcfile=./pyproject.toml -m pytest
mpirun -n 8 coverage run --rcfile=./pyproject.toml -m mpi4py -m pytest --with-mpi
coverage combine
coverage report -m
coverage xml
genbadge coverage -i coverage.xml -o coverage.svg
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v19
id: verify-changed-files
with:
files: coverage.svg
- name: Commit files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add coverage.svg
git commit -m "update coverage badge"
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.github_token }}
branch: ${{ github.ref }}