-
Notifications
You must be signed in to change notification settings - Fork 14
124 lines (114 loc) · 4 KB
/
nightly.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Weekly testing and recalibration of test timings
on:
schedule:
- cron: "5 3 * * 2"
jobs:
calibrate-timings:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- name: install
uses: khanlab/actions/.github/actions/[email protected]
id: setup
with:
python-version: "3.8"
install-library: true
- name: build docker test container
uses: ./.github/actions/build-test-container
with:
python-version: ${{ steps.setup.outputs.python-version }}
load: true
- name: Count current number of tests
id: count
run: |
echo "NUM=$(
poetry run poe -q test --co -q --disable-warnings | head -n -2 | wc -l
)" >> "$GITHUB_OUTPUT"
- name: Count number of timed tests
id: timed-count
run: |
echo "NUM=$(jq 'keys | length' .test_durations)" >> "$GITHUB_OUTPUT"
- name: Test with pytest
if: ${{ steps.count.outputs.NUM != steps.timed-count.outputs.NUM }}
env:
HYPOTHESIS_PROFILE: pr
run: >-
poetry run pytest -n auto --store-durations --clean-durations
--doctest-modules --ignore=docs
--ignore=snakebids/project_template --benchmark-disable
- name: remove spuriously include "Dancefile.inject"
run: git clean -df
- name: Check if there are changes
id: changes
run: |
echo "changed=$(git diff-files --quiet && echo 0 || echo 1)" >> "$GITHUB_OUTPUT"
- name: debug outputs
run: |
echo "Current # tests: ${{ steps.count.outputs.NUM }}"
echo "Current # timed tests: ${{ steps.timed-count.outputs.NUM }}"
echo "Changes?: ${{ steps.changes.outputs.changed }}"
- name: Create PR
if: steps.changes.outputs.changed == 1
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update test timings file
branch: maint/update-test-timings
title: Merge updated test timings
labels: |
maintenance
skip_changelog
body: >
The number of tests has changed since the last generated test-timings
file. This PR contains an automatically regenerated file.
build-cache-env:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: khanlab/actions/.github/actions/[email protected]
id: setup
with:
python-version: ${{ matrix.python-version }}
cache-key: pypi
install-deps-only: dev
install-library: false
- name: build docker test container
uses: ./.github/actions/build-test-container
with:
python-version: ${{ steps.setup.outputs.python-version }}
load: true
- name: install lib
run: poetry run pip install .
test:
runs-on: ubuntu-latest
needs: [ 'build-cache-env' ]
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
split: ['1', '2', '3', '4', '5']
fail-fast: false
steps:
- uses: khanlab/actions/.github/actions/[email protected]
id: setup
with:
python-version: ${{ matrix.python-version }}
cache-key: nightly
install-deps-only: dev
install-library: false
- name: install lib
run: poetry run pip install .
- name: build docker test container
uses: ./.github/actions/build-test-container
with:
python-version: ${{ steps.setup.outputs.python-version }}
load: true
- name: Test with pytest
env:
HYPOTHESIS_PROFILE: pr
run: >-
poetry run pytest -n auto --splits 5 --group ${{ matrix.split }}
--doctest-modules --ignore=docs
--ignore=snakebids/project_template --benchmark-disable