-
Notifications
You must be signed in to change notification settings - Fork 269
179 lines (174 loc) · 7.42 KB
/
ci.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
name: CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Initialize environment
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@af6d1c371f387efd5703a24739412ea862c3218e
with:
cache-node-modules: true
- name: Setup Bazel
uses: angular/dev-infra/github-actions/bazel/setup@af6d1c371f387efd5703a24739412ea862c3218e
- name: Install node modules
run: yarn install --frozen-lockfile
- name: Pre-commit hook (requires yarn install)
uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0
- name: Install Chromium browser for Playwright
run: yarn playwright install chromium --with-deps
- name: Pre-build
run: bazel build //mesop/...
- name: Python type-checking
run: ./scripts/run_py_typecheck.sh
- name: Bazel tests
# NOTE: bazel test //... doesn't work (due to node_modules)
run: bazel test //mesop/...
- name: Run playwright test (prod mode)
run: PLAYWRIGHT_HTML_OUTPUT_DIR=playwright-report-prod-mode yarn playwright test
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: always()
with:
name: playwright-report-prod-mode
path: playwright-report-prod-mode/
retention-days: 30
- name: Run playwright test (debug/editor mode)
run: MESOP_DEBUG_MODE=true PLAYWRIGHT_HTML_OUTPUT_DIR=playwright-report-debug-mode yarn playwright test
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: always()
with:
name: playwright-report-debug-mode
path: playwright-report-debug-mode/
retention-days: 30
- name: Run playwright test (concurrency)
run: PLAYWRIGHT_HTML_OUTPUT_DIR=playwright-report-concurrency yarn playwright test mesop/tests/e2e/concurrency/state_test.ts --repeat-each=48 --workers=16
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: always()
with:
name: playwright-report-concurrency
path: playwright-report-concurrency/
retention-days: 30
- name: Run playwright test with concurrent updates enabled
run: MESOP_CONCURRENT_UPDATES_ENABLED=true PLAYWRIGHT_HTML_OUTPUT_DIR=playwright-report-with-concurrent-updates-enabled yarn playwright test
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: always()
with:
name: playwright-report-with-concurrent-updates-enabled
path: playwright-report-with-concurrent-updates-enabled/
retention-days: 30
- name: Run playwright test with websockets enabled
run: MESOP_WEBSOCKETS_ENABLED=true PLAYWRIGHT_HTML_OUTPUT_DIR=playwright-report-with-websockets-enabled yarn playwright test
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: always()
with:
name: playwright-report-with-websockets-enabled
path: playwright-report-with-websockets-enabled/
retention-days: 30
- name: Run playwright test with memory state session
run: MESOP_STATE_SESSION_BACKEND=memory PLAYWRIGHT_HTML_OUTPUT_DIR=playwright-report-with-memory-state-session yarn playwright test
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: always()
with:
name: playwright-report-with-memory-state-session
path: playwright-report-with-memory-state-session/
retention-days: 30
- name: Run playwright test with static folder
run: MESOP_STATIC_FOLDER=mesop/static PLAYWRIGHT_HTML_OUTPUT_DIR=playwright-report-with-static-folder yarn playwright test mesop/tests/e2e/static_folder_test.ts
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: always()
with:
name: playwright-report-with-static-folder
path: playwright-report-with-static-folder/
retention-days: 30
# Deploy docs
deploy-docs:
# Only deploy docs if we're pushing to main (see on.push.branches)
if: github.event_name == 'push'
# Need write permission to push to gh-pages branch
permissions:
contents: write
# Only deploy docs if test passes
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 3.10.13
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r build_defs/requirements_lock.txt
- run: mkdocs gh-deploy --force
# Deploy docs bot
deploy-docs-bot:
# Only deploy docs bot if we're pushing to main (see on.push.branches)
if: github.event_name == 'push'
# Only deploy docs bot if deploy docs passes
needs: [deploy-docs]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 3.10.13
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
key: docs-bot-${{ env.cache_id }}
path: .cache
restore-keys: |
docs-bot-
- run: pip install -r ai/docbot/requirements.txt
- run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- name: Deploy to HuggingFace
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
# Huggingface token
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: ./ai/docbot/deploy_to_hf.sh ../mesop_docbot
# Deploy showcase
deploy-showcase:
# Only deploy showcase if we're pushing to main (see on.push.branches)
if: github.event_name == 'push'
# Only deploy showcase if test passes
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 3.10.13
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
key: showcase-${{ env.cache_id }}
path: .cache
restore-keys: |
showcase-
- run: pip install -r ai/docbot/requirements.txt
- run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- name: Deploy to HuggingFace
env:
# Huggingface token
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: ./showcase/deploy_to_hf.sh ../mesop_showcase