@@ -19,16 +19,20 @@ concurrency:
19
19
permissions :
20
20
contents : read
21
21
22
+ env :
23
+ FORCE_COLOR : 1
24
+ PIP_DISABLE_PIP_VERSION_CHECK : 1
25
+
22
26
jobs :
23
27
build :
24
28
name : Build dist
25
29
runs-on : ubuntu-latest
26
30
steps :
27
31
- uses : actions/checkout@v4
28
- - name : Set up Python 3.10
32
+ - name : Set up Python 3.12
29
33
uses : actions/setup-python@v5
30
34
with :
31
- python-version : " 3.10 "
35
+ python-version : " 3.12 "
32
36
- name : Install Poetry
33
37
run : pipx install poetry
34
38
- name : Build release
@@ -39,81 +43,73 @@ jobs:
39
43
name : dist
40
44
path : dist/
41
45
42
- test-wheel :
43
- name : Test wheel
46
+ test-dists :
47
+ name : Test Built ${{ matrix.dist.name }} (${{ matrix.python-version }})
44
48
runs-on : ubuntu-latest
45
- needs : [build]
49
+ needs : build
50
+ strategy :
51
+ fail-fast : false
52
+ matrix :
53
+ python-version :
54
+ - " 3.10"
55
+ - " 3.12"
56
+ dist :
57
+ - name : " wheel"
58
+ extension : whl
59
+ - name : " sdist"
60
+ extension : tar.gz
46
61
steps :
47
62
- uses : actions/checkout@v4
48
- - name : Set up Python 3.10
63
+ - name : Set up Python ${{ matrix.python-version }}
49
64
uses : actions/setup-python@v5
50
65
with :
51
- python-version : " 3.10 "
66
+ python-version : " ${{ matrix.python-version }} "
52
67
cache : pip
53
68
- name : Download release dists
54
69
uses : actions/download-artifact@v4
55
70
with :
56
71
name : dist
57
72
path : dist/
58
- - name : Install wheel
73
+ - name : Install ${{ matrix.dist.name }}
59
74
run : |
60
- export path_to_file=$(find dist -type f -name "problem_bank_helpers-*.whl ")
61
- echo "::notice::Installing wheel : $path_to_file"
75
+ export path_to_file=$(find dist -type f -name "problem_bank_helpers-*.${{ matrix.dist.extension }} ")
76
+ echo "::notice::Installing ${{ matrix.dist.name }} : $path_to_file"
62
77
python -m pip install --user $path_to_file
63
78
python -m pip list
64
79
- name : Install test dependencies
65
80
run : python -m pip install --user pytest
66
81
- name : Run tests against installed wheel
67
82
run : rm -rf src/ && pytest tests/
68
83
69
- test-sdist :
70
- name : Test sdist
71
- runs-on : ubuntu-latest
72
- needs : [build]
73
- steps :
74
- - uses : actions/checkout@v4
75
- - name : Set up Python 3.10
76
- uses : actions/setup-python@v5
77
- with :
78
- python-version : " 3.10"
79
- cache : pip
80
- - name : Download release dists
81
- uses : actions/download-artifact@v4
82
- with :
83
- name : dist
84
- path : dist/
85
- - name : Install sdist
86
- run : |
87
- export path_to_file=$(find dist -type f -name "problem_bank_helpers-*.tar.gz")
88
- echo "::notice::Installing sdist: $path_to_file"
89
- python -m pip install --user $path_to_file
90
- python -m pip list
91
- - name : Install test dependencies
92
- run : python -m pip install --user pytest
93
- - name : Run tests against installed sdist
94
- run : rm -rf src/ && pytest tests/
95
-
96
84
test-banks :
97
- name : Test Problem Banks Build
98
- needs : [build]
85
+ name : Test ${{ matrix.bank.name }} Problem Bank Builds (${{ matrix.python-version }})
86
+ continue-on-error : ${{ matrix.python-version == '3.12'}}
87
+ needs : build
99
88
runs-on : ubuntu-latest
100
89
strategy :
101
90
fail-fast : false # We want to know all issues, even if one fails
102
91
matrix :
103
- repo : # If more problem banks are ever created, add them here
104
- - instructor_physics_bank
105
- - instructor_datascience_bank
106
- - instructor_stats_bank
92
+ python-version :
93
+ - " 3.10"
94
+ - " 3.12"
95
+ bank :
96
+ - name : Physics
97
+ repo : open-resources/instructor_physics_bank
98
+ - name : Data Science
99
+ repo : open-resources/instructor_datascience_bank
100
+ - name : Statistics
101
+ repo : open-resources/instructor_stats_bank
107
102
steps :
108
- - name : Checkout ${{ matrix.repo }}
103
+ - name : Checkout ${{ matrix.bank.name }} Problem Bank
109
104
uses : actions/checkout@v4
110
105
with :
111
- repository : open-resources/ ${{ matrix.repo }}
106
+ repository : ${{ matrix.bank .repo }}
112
107
token : ${{ secrets.API_TOKEN_GITHUB }}
113
- - name : Set up Python 3.10
108
+ ref : main
109
+ - name : Set up Python ${{ matrix.python-version }}
114
110
uses : actions/setup-python@v5
115
111
with :
116
- python-version : " 3.10 "
112
+ python-version : " ${{ matrix.python-version }} "
117
113
cache : pip
118
114
- name : Download release dists
119
115
uses : actions/download-artifact@v4
@@ -126,21 +122,16 @@ jobs:
126
122
python -m pip install --upgrade problem_bank_scripts
127
123
- name : Install built wheel
128
124
run : |
129
- python -m pip uninstall -y problem_bank_helpers
130
- export path_to_file=$(find dist -type f -name "problem_bank_helpers-*.whl")
131
- echo "::notice::Installing wheel: $path_to_file"
132
- python -m pip install --user $path_to_file
133
- python -m pip list
125
+ python -m pip install --user $(find dist -type f -name "problem_bank_helpers-*.whl")
134
126
- name : Test problem bank generates properly
135
- run : python scripts/ process.py 'source' --instructor=True --public=True --prairielearn=True
127
+ run : process 'source' --instructor=True --public=True --prairielearn=True
136
128
137
129
publish :
138
130
name : Publish new release to PyPI
139
131
if : github.event_name == 'release' # only publish to PyPI on releases
140
- needs : # Ensure build and tests have passed before publishing
141
- - build
142
- - test-wheel
143
- - test-sdist
132
+ # Ensure tests have passed and problem banks can be built
133
+ needs :
134
+ - test-dists
144
135
- test-banks
145
136
runs-on : ubuntu-latest
146
137
# Specifying a GitHub environment so manual approval by an approved user to create a release is required
@@ -165,12 +156,13 @@ jobs:
165
156
166
157
github-release :
167
158
name : upload dists to GitHub release
168
- needs : [publish]
159
+ needs : publish
160
+ runs-on : ubuntu-latest
161
+
169
162
permissions :
170
163
id-token : write
171
164
attestations : write
172
165
contents : write
173
- runs-on : ubuntu-latest
174
166
175
167
steps :
176
168
- name : Download release dists
@@ -185,10 +177,7 @@ jobs:
185
177
- name : Upload Dists to GitHub Release
186
178
env :
187
179
GITHUB_TOKEN : ${{ github.token }}
188
- run : |
189
- gh release upload
190
- '${{ github.ref_name }}' dist/**
191
- --repo '${{ github.repository }}'
180
+ run : gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'
192
181
193
182
push-to-question-banks :
194
183
uses : ./.github/workflows/update-dependents.yml
0 commit comments