-
Notifications
You must be signed in to change notification settings - Fork 27
238 lines (204 loc) · 7.3 KB
/
ci.yaml
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
# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
---
name: Run CI
on:
push:
branches:
- "**" # matches every branch
- "!gh-pages" # excludes gh-pages branch
pull_request:
branches:
- master
- 1.7
workflow_dispatch:
inputs:
ref:
description: "branch ref"
required: true
default: "master"
jobs:
pytest:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version:
- "3.9"
- "3.11"
name: Python ${{ matrix.python-version }} unit tests
steps:
- name: checkout code tree
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Note Python version/implementation/cache
run: |
which python3
python3 -c 'import sys; print(sys.version)'
python3 -c 'import platform; print(platform.python_implementation())'
python3 -m pip cache dir
- name: Ensure pip/setuptools is up to date
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade wheel setuptools
- name: Install dependencies (runtime)
run: |
python3 -m pip install -e . --user
python3 -m pip list --user
- name: Install dependencies (unit tests)
run: |
python3 -m pip install --upgrade pytest
python3 -m pip install -e .[develop] --user
python3 -m pip list --user
- name: Ensure version.py exists
run: python3 setup.py bdist_wheel
- name: Start Redis Server
uses: supercharge/[email protected]
- name: Run Unit Tests on Python ${{ matrix.python-version }}
timeout-minutes: 35
env:
PYTEST_TIMEOUT: 90
PYTHONPATH: ${{ github.workspace }}/src
COVERAGE_PROCESS_START: ${{ github.workspace }}/.coveragerc
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
run: |
pytest --cov-report term --cov-report xml --cov=decisionengine --no-cov-on-fail
- name: Archive unit test logs
if: failure() && !cancelled()
uses: actions/upload-artifact@v3
with:
name: log_unit_test_Python_${{ matrix.python-version }}
path: /tmp/*.log
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
flags: python-${{ matrix.python-version }}
build_doc:
name: Generate Documentation
runs-on: ubuntu-latest
needs: pytest
steps:
- name: checkout code tree
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.9"
architecture: "x64"
- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding file
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}-3.9
restore-keys: |
${{ runner.os }}-pip-${{ hashFiles('setup.py') }}-
${{ runner.os }}-pip-
- name: Note Python version/implementation/cache
run: |
which python3
python3 -c 'import sys; print(sys.version)'
python3 -c 'import platform; print(platform.python_implementation())'
python3 -m pip cache dir
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade wheel setuptools
python3 -m pip install --upgrade pytest
python3 -m pip install -e . --user
python3 -m pip install -e .[develop] --user
- name: Install sphinx expected fonts within the container
run: |
sudo apt-get update || true
sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
python3 -m pip install sphinx sphinx_rtd_theme --user
- name: Ensure version.py exists
run: python3 setup.py bdist_wheel
- name: Build documentation
env:
PYTHONPATH: ${{ github.workspace }}/src
run: |
cd doc
make rst html latexpdf
rpmbuild_el7:
if: ${{ github.ref == 'refs/heads/1.7' }}
name: Build an EL7 rpm
runs-on: ubuntu-latest
needs: pytest
steps:
- name: make date tag
id: mkdatetag
run: echo "::set-output name=dtag::$(date +%Y%m%d_%H%M%S)"
- name: make ref tag case 1
id: mkreftag1
if: ${{ github.event.inputs.ref != '' }}
run: echo "::set-output name=reftag::${{github.event.inputs.ref}}"
- name: make ref tag case 2
id: mkreftag2
if: ${{ github.event.inputs.ref == '' }}
run: echo "::set-output name=reftag::${GITHUB_BASE_REF:+PR}"$(awk -F"/" '{print $3}' <<< ${GITHUB_REF})
- name: checkout code tree
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{github.event.inputs.ref}}
- name: Run the build in a container (SL7/HEPCloud-CI)
uses: ./.github/actions/python-command-in-sl7-container
with:
python-command: "setup.py bdist_rpm"
logfile: "rpmbuild.log"
- name: Archive rpm
uses: actions/upload-artifact@v3
with:
name: rpms-DE-EL7-${{steps.mkreftag1.outputs.reftag}}${{steps.mkreftag2.outputs.reftag}}-${{steps.mkdatetag.outputs.dtag}}
path: dist/*.rpm
if-no-files-found: error
rpmbuild_el8:
if: ${{ false }} # temporary disable this job
name: Build an EL8 rpm
runs-on: ubuntu-latest
needs: pytest
steps:
- name: make date tag
id: mkdatetag
run: echo "::set-output name=dtag::$(date +%Y%m%d_%H%M%S)"
- name: make ref tag case 1
id: mkreftag1
if: ${{ github.event.inputs.ref != '' }}
run: echo "::set-output name=reftag::${{github.event.inputs.ref}}"
- name: make ref tag case 2
id: mkreftag2
if: ${{ github.event.inputs.ref == '' }}
run: echo "::set-output name=reftag::${GITHUB_BASE_REF:+PR}"$(awk -F"/" '{print $3}' <<< ${GITHUB_REF})
- name: checkout code tree
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{github.event.inputs.ref}}
- name: Run the build in a container (EL8/HEPCloud-CI)
uses: ./.github/actions/python-command-in-el8-container
with:
python-command: "setup.py bdist_rpm"
logfile: "rpmbuild.log"
- name: Archive rpm
uses: actions/upload-artifact@v3
with:
name: rpms-DE-EL8-${{steps.mkreftag1.outputs.reftag}}${{steps.mkreftag2.outputs.reftag}}-${{steps.mkdatetag.outputs.dtag}}
path: dist/*.rpm
if-no-files-found: error