-
Notifications
You must be signed in to change notification settings - Fork 20
91 lines (76 loc) · 2.73 KB
/
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Test
on:
push:
branches:
- master
pull_request:
# This will run the action for pull requests from any branch
branches:
- '*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12'] # Add more Python versions if needed, like '3.8', '3.9', '3.10', etc.
steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4
# Step 2: Set up Python environment
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Step 3: Install Poetry
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
poetry self add "poetry-dynamic-versioning[plugin]"
# Step 4: Install System Dependencies
- name: Install Graphviz
run: sudo apt-get install -y graphviz
# Step 5: Install Rust
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
# Step 6: Install Python Dependencies using Poetry
- name: Install dependencies
run: |
poetry install --with dev
# Step 7: Install the Rust package
- name: Build and Install the Package
run: poetry run maturin develop
# Step 8: Run Tests and Generate Coverage Report
- name: Run tests and coverage
run: |
poetry run pytest ./tests/ --cov=./pyhgf/ --cov-report=xml --cov-branch
# Step 9: Upload Coverage Report to Codecov
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
# # Step 10: Download baseline benchmark artifact
# - name: Download baseline benchmark
# uses: actions/download-artifact@v3
# with:
# name: baseline-benchmark
# path: .benchmarks/baseline_benchmark.json
# Step 11: Run pytest-benchmark
- name: Run pytest-benchmark
run: |
poetry run pytest --benchmark-only --benchmark-json=.benchmarks/new_benchmark.json
# # Step 12: Compare benchmarks with thresholds
# - name: Compare benchmarks
# run: |
# poetry run pytest-benchmark compare .benchmarks/baseline_benchmark.json .benchmarks/new_benchmark.json
# continue-on-error: true
# Step 13: Upload benchmark artifact
- name: Upload baseline benchmark
uses: actions/upload-artifact@v3
with:
name: baseline-benchmark
path: .benchmarks/new_benchmark.json