@@ -5,8 +5,10 @@ name: Tests
5
5
on :
6
6
push :
7
7
branches : [master]
8
+ paths-ignore : ["**/*.md", docs/**]
8
9
pull_request :
9
10
branches : [master]
11
+ paths-ignore : ["**/*.md", docs/**]
10
12
release :
11
13
types : [published]
12
14
workflow_dispatch :
@@ -21,14 +23,15 @@ permissions:
21
23
contents : read
22
24
23
25
jobs :
24
- pytest :
26
+ test :
25
27
# prevent this action from running on forks
26
28
if : github.repository == 'materialsproject/pymatgen'
27
29
strategy :
30
+ fail-fast : false
28
31
matrix :
29
32
# pytest-split automatically distributes work load so parallel jobs finish in similar time
30
33
os : [ubuntu-latest, windows-latest]
31
- python-version : [' 3.8', ' 3.11' ]
34
+ python-version : [" 3.8", " 3.11" ]
32
35
split : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
33
36
# include/exclude is meant to maximize CI coverage of different platforms and python
34
37
# versions while minimizing the total number of jobs. We run all pytest splits with the
@@ -37,30 +40,31 @@ jobs:
37
40
# coverage on unix). Also sample some splits on macos for all python versions
38
41
exclude :
39
42
- os : windows-latest
40
- python-version : ' 3.11'
43
+ python-version : " 3.11"
41
44
- os : ubuntu-latest
42
- python-version : ' 3.8'
45
+ python-version : " 3.8"
43
46
include :
44
47
- os : macos-latest
45
- python-version : ' 3.8'
48
+ python-version : " 3.8"
46
49
split : 1
47
50
- os : macos-latest
48
- python-version : ' 3.9'
51
+ python-version : " 3.9"
49
52
split : 2
50
53
- os : macos-latest
51
- python-version : ' 3.10'
54
+ python-version : " 3.10"
52
55
split : 3
53
56
- os : macos-latest
54
- python-version : ' 3.11'
57
+ python-version : " 3.11"
55
58
split : 4
56
59
57
60
runs-on : ${{ matrix.os }}
58
61
59
62
env :
60
63
PMG_MAPI_KEY : ${{ secrets.PMG_MAPI_KEY }}
61
64
MPLBACKEND : Agg # https://github.com/orgs/community/discussions/26434
62
- PMG_TEST_FILES_DIR : ${{ github.workspace }}/test_files
65
+ PMG_TEST_FILES_DIR : ${{ github.workspace }}/tests/files
63
66
GULP_LIB : ${{ github.workspace }}/cmd_line/gulp/Libraries
67
+ PMG_VASP_PSP_DIR : ${{ github.workspace }}/tests/files
64
68
65
69
steps :
66
70
- uses : actions/checkout@v3
@@ -70,90 +74,117 @@ jobs:
70
74
python-version : ${{ matrix.python-version }}
71
75
cache : pip
72
76
cache-dependency-path : setup.py
73
- - name : Add CLIs to GITHUB_PATH
74
- if : runner.os != 'Windows '
77
+ - name : Copy CLIs to bin
78
+ if : runner.os == 'Linux '
75
79
# This is the way to update env variables in a way that persist for the entire job.
76
80
run : |
77
- for pkg in cmd_line/*;
78
- do echo "$(pwd)/cmd_line/$pkg/Linux_64bit" >> "$GITHUB_PATH";
79
- done
80
- - name : Install m3gnet
81
- # conditional install necessary because TF lacks py3.11 support
82
- # https://github.com/tensorflow/tensorflow/issues/58032
83
- if : matrix.python-version != '3.11'
84
- run : python -m pip install m3gnet
81
+ sudo cp cmd_line/gulp/Linux_64bit/* /usr/local/bin/
82
+ - name : Install Bader
83
+ if : runner.os == 'Linux'
84
+ run : |
85
+ wget http://theory.cm.utexas.edu/henkelman/code/bader/download/bader_lnx_64.tar.gz
86
+ tar xvzf bader_lnx_64.tar.gz
87
+ sudo mv bader /usr/local/bin/
88
+ continue-on-error : true
89
+ - name : Install Enumlib
90
+ if : runner.os == 'Linux'
91
+ run : |
92
+ git clone --recursive https://github.com/msg-byu/enumlib.git
93
+ cd enumlib/symlib/src
94
+ export F90=gfortran
95
+ make
96
+ cd ../../src
97
+ make enum.x
98
+ sudo mv enum.x /usr/local/bin/
99
+ cd ..
100
+ sudo cp aux_src/makeStr.py /usr/local/bin/
101
+ continue-on-error : true
102
+ - name : Install Packmol
103
+ if : runner.os == 'Linux'
104
+ run : |
105
+ wget -O packmol.tar.gz https://github.com/m3g/packmol/archive/refs/tags/v20.14.2.tar.gz
106
+ tar xvzf packmol.tar.gz
107
+ export F90=gfortran
108
+ cd packmol-20.14.2
109
+ ./configure
110
+ make
111
+ sudo mv packmol /usr/local/bin/
112
+ cd ..
113
+ rm -rf .coverage*
114
+ continue-on-error : true
85
115
- name : Install dependencies
86
116
run : |
87
117
python -m pip install --upgrade pip wheel
88
118
python -m pip install numpy cython packaging
89
119
python -m pip install -e '.[dev,optional]'
90
120
- name : pytest split ${{ matrix.split }}
91
- # to update the test durations, run
92
- # pytest --store-durations --durations-path test_files /.pytest-split-durations
121
+ # to update the test durations, do pip install pytest-split and run
122
+ # pytest --store-durations --durations-path tests/files /.pytest-split-durations
93
123
# and commit the results (requires pip install pytest-split)
94
124
run : |
95
- pytest --cov=pymatgen --splits 10 --group ${{ matrix.split }} --durations-path test_files/ .pytest-split-durations
125
+ pytest --cov=pymatgen --splits 10 --group ${{ matrix.split }} --durations-path tests/files/ .pytest-split-durations tests
96
126
- name : Upload coverage
127
+ # Only upload coverage for ubuntu py3.11 runs.
128
+ if : matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
97
129
uses : actions/upload-artifact@v3
98
130
with :
99
131
name : coverage-${{ matrix.split }}
100
132
path : .coverage
101
133
102
134
coverage :
103
- needs : pytest
135
+ needs : test
104
136
runs-on : ubuntu-latest
105
137
steps :
106
138
- uses : actions/checkout@v3
107
- - name : Set up Python 3.10
108
- uses : actions/setup-python@v4
109
- with :
110
- python-version : ' 3.10'
111
- - name : Install Coverage
112
- run : python -m pip install coverage
113
139
- name : Download coverage artifacts
114
- continue-on-error : true
115
140
uses : actions/download-artifact@v3
116
- - name : Run coverage
117
- continue-on-error : true
141
+ - name : Combine coverage
118
142
run : |
119
- coverage combine coverage*/.coverage*
120
- coverage report
121
- coverage xml
122
- - name : Coveralls Python
123
- continue-on-error : true
124
- uses : AndreMiras/coveralls-python-action@v20201129
143
+ pip install coverage[toml]
144
+ find . -name "*.pyc" -delete
145
+ for i in {1..10}; do mv coverage-$i/.coverage .coverage.$i; rm -rf coverage-$i; done
146
+ coverage combine
147
+ - name : Upload coverage reports to Codecov
148
+ uses : codecov/codecov-action@v3
149
+ with :
150
+ token : ${{ secrets.CODECOV_TOKEN }}
151
+ verbose : true
125
152
126
153
build_sdist :
127
- needs : pytest
128
- name : Build source distribution
154
+ if : github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
155
+ needs : test
129
156
runs-on : ubuntu-latest
130
157
steps :
131
158
- uses : actions/checkout@v3
132
159
- uses : actions/setup-python@v4
133
160
name : Install Python
134
161
with :
135
- python-version : ' 3.10'
136
- - run : python -m pip install build
162
+ python-version : " 3.10"
163
+ - run : |
164
+ python -m pip install build
165
+ pip install -e .
137
166
- name : Build sdist
138
167
run : python -m build --sdist
139
168
- uses : actions/upload-artifact@v3
140
169
with :
141
170
path : dist/*.tar.gz
142
171
143
172
build_wheels :
144
- needs : pytest
173
+ if : github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.task == 'release')
174
+ needs : test
145
175
strategy :
146
176
matrix :
147
177
os : [ubuntu-latest, macos-latest, windows-latest]
148
- python-version : ['38', '39', ' 310', ' 311' ]
178
+ python-version : ["38", "39", " 310", " 311" ]
149
179
runs-on : ${{ matrix.os }}
150
180
steps :
151
181
- uses : actions/checkout@v3
152
182
- name : Build wheels
153
- uses : pypa/cibuildwheel@v2.12.3
183
+ uses : pypa/cibuildwheel@v2.14.1
154
184
env :
155
185
CIBW_BUILD : cp${{ matrix.python-version }}-*
156
- - uses : actions/upload-artifact@v3
186
+ - name : Save artifact
187
+ uses : actions/upload-artifact@v3
157
188
with :
158
189
path : ./wheelhouse/*.whl
159
190
@@ -169,7 +200,8 @@ jobs:
169
200
uses : actions/setup-python@v4
170
201
with :
171
202
python-version : 3.11
172
- - uses : actions/download-artifact@v3
203
+ - name : Get build artifacts
204
+ uses : actions/download-artifact@v3
173
205
with :
174
206
name : artifact
175
207
path : dist
0 commit comments