-
Notifications
You must be signed in to change notification settings - Fork 31
191 lines (154 loc) · 5.5 KB
/
Copy pathpush-pr_workflow.yml
File metadata and controls
191 lines (154 loc) · 5.5 KB
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
name: Python CI
on: [push, pull_request]
permissions:
contents: read
jobs:
Changelog:
name: CHANGELOG.md updated
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
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@v4
- uses: ./.github/actions/setup-python
with:
python-version: '3.x'
- 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: |
isort --check --line-length $MAX_LINE_LENGTH merlin tests *.py
- name: Lint with Black
run: |
black --check --line-length $MAX_LINE_LENGTH --target-version py38 merlin tests *.py
- name: Lint with PyLint
run: |
pylint merlin 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.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
- uses: ./.github/actions/setup-singularity
with:
go-version: ${{ env.GO_VERSION }}
singularity-version: ${{ env.SINGULARITY_VERSION }}
os: ${{ env.OS }}
arch: ${{ env.ARCH }}
- name: Install merlin and setup
run: |
pip3 install -e .
merlin config create
- name: Install CLI task dependencies from 'feature_demo' workflow
run: |
merlin example feature_demo
pip3 install -r feature_demo/requirements.txt
- name: Run integration test suite for local tests
run: |
python3 tests/integration/run_tests.py --verbose --local
Unit-tests:
runs-on: ubuntu-latest
env:
GO_VERSION: 1.18.1
SINGULARITY_VERSION: 3.9.9
OS: linux
ARCH: amd64
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
- uses: ./.github/actions/setup-singularity
with:
go-version: ${{ env.GO_VERSION }}
singularity-version: ${{ env.SINGULARITY_VERSION }}
os: ${{ env.OS }}
arch: ${{ env.ARCH }}
- name: Install merlin and setup
run: |
pip3 install -e .
merlin config create
- name: Install CLI task dependencies from '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/
Integration-tests:
runs-on: ubuntu-latest
env:
GO_VERSION: 1.18.1
SINGULARITY_VERSION: 3.9.9
OS: linux
ARCH: amd64
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python
with:
python-version: ${{ matrix.python-version }}
- uses: ./.github/actions/setup-singularity
with:
go-version: ${{ env.GO_VERSION }}
singularity-version: ${{ env.SINGULARITY_VERSION }}
os: ${{ env.OS }}
arch: ${{ env.ARCH }}
- name: Install merlin
run: |
pip --version
pip3 --version
pip3 install -e .
merlin config create
- name: Install CLI task dependencies from 'feature_demo' workflow
run: |
merlin example feature_demo
pip3 install -r feature_demo/requirements.txt
# TODO remove the --ignore statement once those tests are fixed
- name: Run integration test suite for distributed tests
run: |
python3 -m pytest -v --ignore tests/integration/test_celeryadapter.py tests/integration/