-
Notifications
You must be signed in to change notification settings - Fork 26
229 lines (196 loc) · 7.52 KB
/
push-pr_workflow.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
name: Python CI
on: [push, pull_request]
jobs:
Changelog:
name: CHANGELOG.md updated
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Checkout the whole history, in case the target is way far behind
- name: Check if target branch has been merged
run: |
if git merge-base --is-ancestor ${{ github.event.pull_request.base.sha }} ${{ github.sha }}; then
echo "Target branch has been merged into the source branch."
else
echo "Target branch has not been merged into the source branch. Please merge in target first."
exit 1
fi
- name: Check that CHANGELOG has been updated
run: |
# If this step fails, this means you haven't updated the CHANGELOG.md file with notes on your contribution.
if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q '^CHANGELOG.md$'; then
echo "Thanks for helping keep our CHANGELOG up-to-date!"
else
echo "Please update the CHANGELOG.md file with notes on your contribution."
exit 1
fi
Lint:
runs-on: ubuntu-latest
env:
MAX_LINE_LENGTH: 127
MAX_COMPLEXITY: 15
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Check cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ hashFiles('requirements/release.txt') }}-${{ hashFiles('requirements/dev.txt') }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install --upgrade -r requirements.txt; fi
pip3 install --upgrade -r requirements/dev.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --max-complexity=$MAX_COMPLEXITY --statistics --max-line-length=$MAX_LINE_LENGTH
- name: Lint with isort
run: |
python3 -m isort --check --line-length $MAX_LINE_LENGTH merlin
python3 -m isort --check --line-length $MAX_LINE_LENGTH tests
python3 -m isort --check --line-length $MAX_LINE_LENGTH *.py
- name: Lint with Black
run: |
python3 -m black --check --line-length $MAX_LINE_LENGTH --target-version py38 merlin
python3 -m black --check --line-length $MAX_LINE_LENGTH --target-version py38 tests
python3 -m black --check --line-length $MAX_LINE_LENGTH --target-version py38 *.py
- name: Lint with PyLint
run: |
python3 -m pylint merlin --rcfile=setup.cfg --exit-zero
python3 -m pylint tests --rcfile=setup.cfg --exit-zero
Local-test-suite:
runs-on: ubuntu-latest
env:
GO_VERSION: 1.18.1
SINGULARITY_VERSION: 3.9.9
OS: linux
ARCH: amd64
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Check cache
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/release.txt') }}-${{ hashFiles('requirements/dev.txt') }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip3 install -r requirements/dev.txt
pip freeze
- name: Install singularity
run: |
sudo apt-get update && sudo apt-get install -y \
build-essential \
libssl-dev \
uuid-dev \
libgpgme11-dev \
squashfs-tools \
libseccomp-dev \
pkg-config
wget https://go.dev/dl/go$GO_VERSION.$OS-$ARCH.tar.gz
sudo tar -C /usr/local -xzf go$GO_VERSION.$OS-$ARCH.tar.gz
rm go$GO_VERSION.$OS-$ARCH.tar.gz
export PATH=$PATH:/usr/local/go/bin
wget https://github.com/sylabs/singularity/releases/download/v$SINGULARITY_VERSION/singularity-ce-$SINGULARITY_VERSION.tar.gz
tar -xzf singularity-ce-$SINGULARITY_VERSION.tar.gz
cd singularity-ce-$SINGULARITY_VERSION
./mconfig && \
make -C ./builddir && \
sudo make -C ./builddir install
- name: Install merlin to run unit tests
run: |
pip3 install -e .
merlin config
- name: Install CLI task dependencies generated from the 'feature demo' workflow
run: |
merlin example feature_demo
pip3 install -r feature_demo/requirements.txt
- name: Run pytest over unit test suite
run: |
python3 -m pytest -v --order-scope=module tests/unit/
- name: Run integration test suite for local tests
run: |
python3 tests/integration/run_tests.py --verbose --local
Distributed-test-suite:
runs-on: ubuntu-latest
services:
# rabbitmq:
# image: rabbitmq:latest
# ports:
# - 5672:5672
# options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Check cache
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements/release.txt') }}-${{ hashFiles('requirements/dev.txt') }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip3 install -r requirements/dev.txt
- name: Install merlin and setup redis as the broker
run: |
pip3 install -e .
merlin config --broker redis
- name: Install CLI task dependencies generated from the 'feature demo' workflow
run: |
merlin example feature_demo
pip3 install -r feature_demo/requirements.txt
- name: Run integration test suite for distributed tests
env:
REDIS_HOST: redis
REDIS_PORT: 6379
run: |
python3 tests/integration/run_tests.py --verbose --distributed
# - name: Setup rabbitmq config
# run: |
# merlin config --test rabbitmq
# - name: Run integration test suite for rabbitmq
# env:
# AMQP_URL: amqp://localhost:${{ job.services.rabbitmq.ports[5672] }}
# RABBITMQ_USER: Jimmy_Space
# RABBITMQ_PASS: Alexander_Rules
# ports:
# - ${{ job.services.rabbitmq.ports['5672'] }}
# run: |
# python3 tests/integration/run_tests.py --verbose --ids 31 32