forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
254 lines (218 loc) · 8.08 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
246
247
248
249
250
251
252
253
254
name: Nightly Build
on:
schedule:
# Run job at 10.30pm PST or 11.30pm PDT
- cron: "30 6 * * *"
jobs:
create-nightly-tag:
runs-on: ubuntu-latest
if: github.repository == 'streamlit/streamlit'
defaults:
run:
shell: bash
permissions:
# Additional permission needed to generate tag
contents: write
outputs:
TAG: ${{ steps.create_tag.outputs.tag }}
steps:
- name: Checkout Streamlit code
uses: actions/checkout@v4
with:
submodules: "recursive"
# Save the access token to the local git config, so
# later git commands can work.
persist-credentials: true
fetch-depth: 2
- name: Set Python version vars
uses: ./.github/actions/build_info
- name: Set up Python ${{ env.PYTHON_MAX_VERSION }}
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_MAX_VERSION }}"
- name: Setup virtual env
uses: ./.github/actions/make_init
- name: Run make develop
run: make develop
- name: Create tag
id: create_tag
run: |
git config --global user.email "[email protected]"
git config --global user.name "Streamlit Bot"
TAG="$(./scripts/pypi_nightly_create_tag.py)"
echo "tag=$TAG" >> $GITHUB_OUTPUT
./scripts/update_version.py $TAG
./scripts/update_name.py streamlit-nightly
git add lib/setup.py frontend/package.json lib/streamlit/__init__.py lib/streamlit/version.py
git commit -m "Update version and project name in files"
git tag -a $TAG -m "Streamlit nightly $TAG"
git push origin $TAG
- if: ${{ failure() }}
name: Nightly Tag Failure Slack Message
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
RUN_ID: ${{ github.run_id }}
run: python scripts/slack_notifications.py nightly tag
run-python-tests:
needs: create-nightly-tag
permissions:
# Pass additional permission needed to upload constraints
contents: write
uses: ./.github/workflows/python-tests.yml
with:
ref: ${{needs.create-nightly-tag.outputs.tag}}
secrets:
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
run-javascript-tests:
needs: create-nightly-tag
uses: ./.github/workflows/js-tests.yml
with:
ref: ${{needs.create-nightly-tag.outputs.tag}}
run-playwright-tests:
uses: ./.github/workflows/playwright.yml
with:
ref: ${{needs.create-nightly-tag.outputs.tag}}
performance-lighthouse:
uses: ./.github/workflows/performance-lighthouse.yml
with:
ref: ${{needs.create-nightly-tag.outputs.tag}}
externalCall: true
test-status-notification:
runs-on: ubuntu-latest
if: ${{ always() }}
# By default, jobs listed in needs must all complete successfully for the dependent job to run. always() conditional
# added as we'd like this job to run whether or not tests pass & slack us regarding failing tests.
needs:
- create-nightly-tag
- run-python-tests
- run-javascript-tests
- run-playwright-tests
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
RUN_ID: ${{ github.run_id }}
steps:
- name: Checkout Streamlit code
uses: actions/checkout@v4
with:
ref: ${{ needs.create-nightly-tag.outputs.tag }}
persist-credentials: false
submodules: "recursive"
- if: ${{ needs.run-python-tests.result == 'failure' }}
run: python scripts/slack_notifications.py nightly python
- if: ${{ needs.run-javascript-tests.result == 'failure' }}
run: python scripts/slack_notifications.py nightly js
- if: ${{ needs.run-playwright-tests.result == 'failure' }}
run: python scripts/slack_notifications.py nightly playwright
create-nightly-build:
runs-on: ubuntu-latest
# Tag creation & tests must all complete successfully for nightly build job to run.
needs:
- create-nightly-tag
- run-python-tests
- run-javascript-tests
- run-playwright-tests
permissions:
id-token: write
defaults:
run:
shell: bash
outputs:
enable-setup: ${{ steps.exports.outputs.enable-setup }}
s3-url: ${{ steps.exports.outputs.s3-url }}
environment: nightly
steps:
- name: Checkout Streamlit code
uses: actions/checkout@v4
with:
ref: ${{ needs.create-nightly-tag.outputs.tag }}
# Save the access token to the local git config, so
# later git commands can work.
persist-credentials: true
submodules: "recursive"
- name: Set Python version vars
uses: ./.github/actions/build_info
- name: Set up Python ${{ env.PYTHON_MAX_VERSION }}
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_MAX_VERSION }}"
- name: Setup virtual env
uses: ./.github/actions/make_init
- name: Run make develop
run: make develop
- name: Verify git tag vs. version
env:
TAG: ${{ needs.create-nightly-tag.outputs.tag }}
run: |
cd lib
python setup.py verify
- name: Build Package
timeout-minutes: 120
run: |
sudo apt update
sudo apt install rsync
make package
- name: Store Whl File
uses: actions/upload-artifact@v4
with:
name: whl_file
path: lib/dist/*.whl
- name: Upload wheel to S3
id: exports
env:
AWS_DEFAULT_REGION: us-west-2
AWS_ACCESS_KEY_ID: ${{ secrets.CORE_PREVIEWS_S3_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CORE_PREVIEWS_S3_SECRET_KEY }}
run: |
sudo apt update
sudo apt install -y awscli
cd lib/dist
export WHEELFILE="$(ls -t *.whl | head -n 1)"
aws s3 cp "${WHEELFILE}" s3://core-previews/nightly-preview/ --acl public-read
S3_URL="https://core-previews.s3-us-west-2.amazonaws.com/nightly-preview/${WHEELFILE}"
echo -e "Wheel file download link: ${S3_URL}"
cd ../..
# env variables don't carry over between gh action jobs
echo "enable-setup=${{ env.AWS_ACCESS_KEY_ID != '' }}" >> $GITHUB_OUTPUT
echo "s3-url=${S3_URL}" >> $GITHUB_OUTPUT
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: lib/dist/
- if: ${{ failure() }}
name: Nightly Build Failure Slack Message
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
RUN_ID: ${{ github.run_id }}
run: python scripts/slack_notifications.py nightly build
setup-nightly-preview:
runs-on: ubuntu-latest
needs: [create-nightly-tag, create-nightly-build]
if: needs.create-nightly-build.outputs.enable-setup == 'true'
defaults:
run:
shell: bash
steps:
- name: Checkout Core Previews Repo
uses: actions/checkout@v4
with:
repository: streamlit/core-previews
# The default GITHUB_TOKEN is scoped only to the triggering streamlit/streamlit repo.
# Accessing streamlit/core-previews repo requires a separate auth token.
token: ${{ secrets.CORE_PREVIEWS_REPO_TOKEN }}
# Save the access token to the local git config, so
# later git commands can work.
persist-credentials: true
- name: Setup preview repo
env:
NIGHTLY_TAG: ${{ needs.create-nightly-tag.outputs.tag }}
S3_URL: ${{ needs.create-nightly-build.outputs.s3-url }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Streamlit Bot"
git branch -D nightly-preview &>/dev/null || true
git checkout -b nightly-preview
echo "$S3_URL" >> requirements.txt
git add .
git commit -m "Nightly Preview: ${NIGHTLY_TAG}"
git push -f origin nightly-preview