-
Notifications
You must be signed in to change notification settings - Fork 184
287 lines (234 loc) · 8.58 KB
/
test-install.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name: test-install
on:
pull_request:
paths:
- 'setup.*'
- 'environment.yml'
- '**/requirements*.txt'
- 'pyproject.toml'
- 'util/dependency_management.py'
- '.github/workflows/test-install.yml'
branches-ignore: [gh-pages]
schedule:
- cron: '30 02 * * *' # nightly build
jobs:
validate-dependency-specification:
# Note: The specification is also validated by the pre-commit hook.
if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install utils/ dependencies
run: pip install -r utils/requirements.txt
- name: Validate
run: python ./utils/dependency_management.py validate-all
install-with-pip:
if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
extras: [ '', '[atomic_tools,docs,notebook,rest,tests]' ]
steps:
- uses: actions/checkout@v2
# Set to Python version 3.8, as the installation with 3.9 still takes
# significantly longer to install.
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Pip install
id: pip_install
run: |
python -m pip --version
python -m pip install -e .${{ matrix.extras }}
python -m pip freeze
- name: Test importing aiida
if: steps.pip_install.outcome == 'success'
run:
python -c "import aiida"
install-with-conda:
if: github.repository == 'aiidateam/aiida-core'
runs-on: ubuntu-latest
name: install-with-conda
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- name: Setup Conda
uses: s-weigand/setup-conda@v1
with:
python-version: 3.9
update-conda: false
conda-channels: conda-forge
- run: conda --version
- run: python --version
- run: which python
- name: Test direct installation
run: |
conda create -n test-install aiida-core
source activate test-install
python -c "import aiida"
- name: Test conda environment
run: |
conda env create -f environment.yml -n test-environment
source activate test-environment
python -m pip install --no-deps -e .
python -c "import aiida"
tests:
needs: [install-with-pip, install-with-conda]
runs-on: ubuntu-latest
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
backend: ['django', 'sqlalchemy']
services:
postgres:
image: postgres:10
env:
POSTGRES_DB: test_${{ matrix.backend }}
POSTGRES_PASSWORD: ''
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672
slurm:
image: xenonmiddleware/slurm:17
ports:
- 5001:22
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt update
sudo apt install postgresql graphviz
- name: Upgrade pip and setuptools
# It is crucial to update `setuptools` or the installation of `pymatgen` can break
run: |
pip install --upgrade pip setuptools
pip --version
- name: Install aiida-core
run: |
pip install -e .[atomic_tools,docs,notebook,rest,tests]
- run: pip freeze
- name: Setup AiiDA environment
env:
AIIDA_TEST_BACKEND: ${{ matrix.backend }}
run:
.github/workflows/setup.sh
- name: Run test suite
env:
AIIDA_TEST_BACKEND: ${{ matrix.backend }}
run:
.github/workflows/tests.sh
- name: Freeze test environment
run: pip freeze | sed '1d' | tee requirements-py-${{ matrix.python-version }}.txt
# Add python-version specific requirements/ file to the requirements.txt artifact.
# This artifact can be used in the next step to automatically create a pull request
# updating the requirements (in case they are inconsistent with the setup.json file).
- uses: actions/upload-artifact@v1
if: matrix.backend == 'django' # The requirements are identical between backends.
with:
name: requirements.txt
path: requirements-py-${{ matrix.python-version }}.txt
# Check whether the requirements/ files are consistent with the dependency specification in the setup.json file.
# If the check fails, warn the user via a comment and try to automatically create a pull request to update the files
# (does not work on pull requests from forks).
check-requirements:
needs: tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install utils/ dependencies
run: pip install -r utils/requirements.txt
- name: Check consistency of requirements/ files
id: check_reqs
continue-on-error: true
run: python ./utils/dependency_management.py check-requirements DEFAULT --no-github-annotate
#
# The following steps are only executed if the consistency check failed.
#
- name: Create commit comment
if: steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
uses: peter-evans/commit-comment@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: setup.json
body: |
The requirements/ files are inconsistent!
# Check out the base branch so that we can prepare the pull request.
- name: Checkout base branch
if: steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
clean: true
- name: Download requirements.txt files
if: steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
uses: actions/download-artifact@v1
with:
name: requirements.txt
path: requirements
- name: Commit requirements files
if: steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
run: |
git add requirements/*
- name: Create pull request for updated requirements files
if: steps.check_reqs.outcome == 'Failure' # only run if requirements/ are inconsistent
id: create_update_requirements_pr
continue-on-error: true
uses: peter-evans/create-pull-request@v2
with:
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: update-requirements
commit-message: "Automated update of requirements/ files."
title: "Update requirements/ files."
body: |
Update requirements files to ensure that they are consistent
with the dependencies specified in the 'setup.json' file.
Please note, that this pull request was likely created to
resolve the inconsistency for a specific dependency, however
other versions that have changed since the last update will
be included as part of this commit as well.
Click [here](https://github.com/aiidateam/aiida-core/wiki/AiiDA-Dependency-Management) for more information.
- name: Create PR comment on success
if: steps.create_update_requirements_pr.outcome == 'Success'
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.number }}
body: |
I automatically created a pull request (#${{ steps.create_update_requirements_pr.outputs.pr_number }}) that adapts the
requirements/ files according to the dependencies specified in the 'setup.json' file.
- name: Create PR comment on failure
if: steps.create_update_requirements_pr.outcome == 'Failure'
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.number }}
body: |
Please update the requirements/ files to ensure that they
are consistent with the dependencies specified in the 'setup.json' file.