@@ -19,26 +19,20 @@ jobs:
1919 uses : actions/checkout@v3
2020 - name : Get git tags
2121 run : git fetch --prune --unshallow --tags
22- - uses : actions/setup-python@v4
22+
23+ # Use pip to install dependencies
24+ - name : Setup PDM
25+ uses : pdm-project/setup-pdm@v4
2326 with :
2427 python-version : ${{ matrix.python-version }}
25- cache : " pip "
26- # Use pip to install dependencies
28+ cache : true
29+ cache-dependency-path : ./pyproject.toml
2730 - name : Install dependencies
2831 run : |
29- python -m pip install --upgrade pip
30- pip install ".[dev]"
31- # Run linter
32+ pdm install -G test
3233 - name : Run linter
3334 run : |
3435 pdm run check
35- # Get JPL ephemeris files
36- - name : Get JPL ephemeris files
37- run : |
38- python scripts/set_up_assist.py
39- - name : Set JPL ephemeris environment variable
40- run : |
41- export ASSIST_DATA_DIR=~/.adam_assist_data
4236 # Run tests
4337 - name : Run tests
4438 run : |
4741 uses :
coverallsapp/[email protected] 4842 with :
4943 path-to-lcov : coverage.xml
44+
45+ # Run benchmarks
46+ - name : Run benchmarks
47+ run : |
48+ pdm run benchmark --benchmark-json bench.json
49+
50+ # If on main branch, upload benchmark results
51+ - name : Store main benchmark result
52+ if : github.ref == 'refs/heads/main'
53+ uses : actions/upload-artifact@v3
54+ with :
55+ name : main-benchmark
56+ path : bench.json
57+ retention-days : 30
58+
59+ # If PR, download main benchmark data
60+ - name : Download main benchmark data
61+ if : github.event_name == 'pull_request'
62+ id : download-main-benchmark
63+ uses : actions/download-artifact@v3
64+ with :
65+ name : main-benchmark
66+ path : main-bench
67+ continue-on-error : true
68+
69+ - name : Compare benchmarks
70+ if : github.event_name == 'pull_request' && steps.download-main-benchmark.outcome == 'success'
71+ uses : benchmark-action/github-action-benchmark@v1
72+ with :
73+ name : Python Benchmark
74+ tool : ' pytest'
75+ output-file-path : bench.json
76+ external-data-json-path : main-bench/bench.json
77+ github-token : ${{ secrets.GITHUB_TOKEN }}
78+ comment-always : true
79+ fail-threshold : ' 150%'
80+ auto-push : false
0 commit comments