-
-
Notifications
You must be signed in to change notification settings - Fork 234
164 lines (145 loc) · 5.67 KB
/
nightly_cron.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
name: Test against latest dependencies
# Run if we change any of these paths and every night at 1 (or 2) AM Central time
on:
push:
branches-ignore:
- 'master'
paths:
- 'requirements.txt'
- '.github/workflows/nightly_cron.yml'
schedule:
- cron: '0 7 * * *' # Every day at 07:00 UTC (1AM CST or 2AM CDT)
# Allows us to run manually
workflow_dispatch:
# Cancel older runs of the same workflow on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build against latest dependencies
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
python-version: ['3.12']
python-executable: ['cp312']
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
outputs:
dependency-table: ${{ steps.dependency-table.outputs.table }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setting up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set Run ID
id: definition # Needed to retrieve the output of this step later
run: echo "run_id=$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
- name: Collecting naked dependencies
id: dependencies # Needed to retrieve the output of this step later
run: |
dependencies=$(python build_tools/github/get_latest_dependencies.py)
echo "latest_dependencies=$dependencies" >> $GITHUB_OUTPUT
shell: bash
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Generating dependency table
id: dependency-table # Needed to set output of job
run: |
pip install requests tabulate
table=$(python .github/utils/get_dependency_releases.py $DEPENDENCIES)
# This is used in the next job (if necessary) rather than re-running the above
echo "table=$table" >> $GITHUB_OUTPUT
env:
DEPENDENCIES: ${{ steps.dependencies.outputs.latest_dependencies }}
- name: Building and testing wheel
run: python -m cibuildwheel --output-dir dist
env:
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: "x86_64"
CIBW_ARCHS_WINDOWS: "AMD64"
CIBW_BEFORE_ALL: make version
CIBW_BEFORE_BUILD: >
for dependency in ${{ steps.dependencies.outputs.latest_dependencies }}; do
pip install $dependency
done
# Windows runs a batch script that I couldn't get to work, so we just force it to run bash
CIBW_BEFORE_BUILD_WINDOWS: bash -c 'for dependency in ${{ steps.dependencies.outputs.latest_dependencies }}; do pip install $dependency; done'
# Tests are run in a separate virtual env, so we need to re-install deps
CIBW_BEFORE_TEST: >
for dependency in ${{ steps.dependencies.outputs.latest_dependencies }}; do
pip install $dependency
done
CIBW_BEFORE_TEST_WINDOWS: bash -c 'for dependency in ${{ steps.dependencies.outputs.latest_dependencies }}; do pip install $dependency; done'
CIBW_BUILD: "${{ matrix.python-executable }}-*"
CIBW_ENVIRONMENT_MACOS: PMD_MPL_BACKEND=TkAGG
# No support for pypy or musl
CIBW_SKIP: "pp* *-musllinux_*"
CIBW_TEST_COMMAND: pytest --showlocals --durations=20 --pyargs pmdarima
# https://github.com/marketplace/actions/action-slack#custom-notification
- name: Posting to Slack
uses: 8398a7/action-slack@v3
if: failure()
with:
status: custom
custom_payload: |
{
text: ":no_entry: Nightly Build Failed",
attachments: [{
"author_name": "Nightly Build", // This one needs to be in quotes for some reason
fallback: 'Nightly Build Failed!',
color: 'danger',
title: 'CI Result',
text: 'Failed',
fields: [
{
title: 'OS',
value: '${{ matrix.os }}',
short: false
},
{
title: 'Python Version',
value: '${{ matrix.python-version }}',
short: false
},
{
title: 'Link to Run',
value: '<https://github.com/alkaline-ml/pmdarima/actions/runs/${{ env.RUN_ID }}|HERE>',
short: false
}
],
actions: [{}] // Don't know if we actually need this, but it is shown in the docs as empty
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.NIGHTLY_SLACK_CHANNEL }}
RUN_ID: ${{ steps.definition.outputs.run_id }}
# We only run this job if the previous one fails (any of the 4 jobs that it spins up)
send_latest_releases:
needs: [build]
if: failure()
name: Send latest dependency releases to Slack
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setting up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Posting to Slack
uses: 8398a7/action-slack@v3
with:
status: custom
custom_payload: |
{
text: "Latest Dependency Releases (most recent first):\n${{ env.TABLE }}",
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.NIGHTLY_SLACK_CHANNEL }}
TABLE: ${{ needs.build.outputs.dependency-table }}