-
Notifications
You must be signed in to change notification settings - Fork 50
226 lines (187 loc) · 8.65 KB
/
website-test.yml
File metadata and controls
226 lines (187 loc) · 8.65 KB
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
name: "Website Tests"
on:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled
push:
branches:
- '[0-9]+.[0-9]+'
# Only one instance of this workflow will run on the same ref (PR/Branch/Tag)
# Previous runs will be cancelled.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
define-versions:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
runs-on: ubuntu-latest
outputs:
fdiVersions: ${{ steps.versions.outputs.fdiVersions }}
cdiVersions: ${{ steps.versions.outputs.cdiVersions }}
pyVersions: '["3.8", "3.13"]'
nodeFdiVersionMap: ${{ steps.node-versions.outputs.fdiVersions }}
websiteFdiVersionMap: ${{ steps.website-versions.outputs.fdiVersions }}
coreCdiVersionMap: ${{ steps.core-versions.outputs.cdiVersions }}
steps:
- uses: actions/checkout@v4
- uses: supertokens/get-supported-versions-action@main
id: versions
with:
has-fdi: true
has-cdi: true
- uses: supertokens/actions/get-versions-from-repo@main
id: website-versions
with:
repo: supertokens-website
github-token: ${{ secrets.GITHUB_TOKEN }}
fdi-versions: ${{ steps.versions.outputs.fdiVersions }}
- uses: supertokens/actions/get-versions-from-repo@main
id: node-versions
with:
repo: supertokens-node
github-token: ${{ secrets.GITHUB_TOKEN }}
fdi-versions: ${{ steps.versions.outputs.fdiVersions }}
- uses: supertokens/actions/get-versions-from-repo@main
id: core-versions
with:
repo: supertokens-core
github-token: ${{ secrets.GITHUB_TOKEN }}
cdi-versions: ${{steps.versions.outputs.cdiVersions }}
test:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
runs-on: ubuntu-latest
needs: define-versions
strategy:
fail-fast: false
matrix:
py-version: ${{ fromJSON(needs.define-versions.outputs.pyVersions) }}
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
framework:
- django2x
- django3x
- drf_sync
- drf_async
- fastapi
- flask
- flask-nest-asyncio
steps:
- name: Setup ENVs
id: envs
run: |
APP_SERVER_LOG_DIR=${{ github.workspace }}/logs
echo "APP_SERVER_LOG_DIR=$APP_SERVER_LOG_DIR" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
mkdir -p $APP_SERVER_LOG_DIR
- uses: actions/checkout@v4
with:
# Checking out to a custom path since the test repo will also be cloned
path: supertokens-python
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py-version }}
- name: Get versions from current FDI/CDI version
id: versions
run: |
latestCdiVersion=$(echo '${{ needs.define-versions.outputs.cdiVersions }}' | jq -r '.[-1]' | sed -e 's/"/\\"/g')
coreVersion=$(echo '${{ needs.define-versions.outputs.coreCdiVersionMap }}' | jq -r ".[\"$latestCdiVersion\"]")
nodeVersion=$(echo '${{ needs.define-versions.outputs.nodeFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]')
websiteVersion=$(echo '${{ needs.define-versions.outputs.websiteFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]')
echo "coreVersion=${coreVersion}" >> $GITHUB_OUTPUT
echo "nodeVersion=${nodeVersion}" >> $GITHUB_OUTPUT
echo "websiteVersion=${websiteVersion}" >> $GITHUB_OUTPUT
- name: Start core
working-directory: supertokens-python
env:
SUPERTOKENS_CORE_VERSION: ${{ steps.versions.outputs.coreVersion }}
run: docker compose up --wait
- name: Setup venv
working-directory: supertokens-python
run: |
python3 -m venv venv
source venv/bin/activate
python3 -m pip install pip setuptools --upgrade
- name: Install dependencies and start servers (django2x)
if: matrix.framework == 'django2x'
working-directory: supertokens-python
run: |
source venv/bin/activate
make with-django2x
# Django2 uses `cgi`, deprecated in 3.13
if [ ${{ matrix.py-version == '3.13' }} ]; then
pip install legacy-cgi
fi
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
cd tests/frontendIntegration/django2x
gunicorn mysite.wsgi --bind 0.0.0.0:8080 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log &
gunicorn mysite.wsgi --bind 0.0.0.0:8082 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server-cross-domain.log &
- name: Install dependencies and start servers (django3x)
if: matrix.framework == 'django3x'
working-directory: supertokens-python
run: |
source venv/bin/activate
make with-django
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
cd tests/frontendIntegration/django3x
uvicorn mysite.asgi:application --port 8080 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log &
uvicorn mysite.asgi:application --port 8082 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server-cross-domain.log &
- name: Install dependencies and start servers (drf_sync)
if: matrix.framework == 'drf_sync'
working-directory: supertokens-python
run: |
source venv/bin/activate
make with-drf
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
cd tests/frontendIntegration/drf_sync
gunicorn mysite.wsgi --bind 0.0.0.0:8080 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log &
gunicorn mysite.wsgi --bind 0.0.0.0:8082 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server-cross-domain.log &
- name: Install dependencies and start servers (drf_async)
if: matrix.framework == 'drf_async'
working-directory: supertokens-python
run: |
source venv/bin/activate
make with-drf
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
cd tests/frontendIntegration/drf_async
uvicorn mysite.asgi:application --port 8080 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log &
uvicorn mysite.asgi:application --port 8082 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server-cross-domain.log &
- name: Install dependencies and start servers (fastapi)
if: matrix.framework == 'fastapi'
working-directory: supertokens-python
run: |
source venv/bin/activate
make with-fastapi
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
cd tests/frontendIntegration/fastapi-server
uvicorn app:app --host 0.0.0.0 --port 8080 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log &
uvicorn app:app --host 0.0.0.0 --port 8082 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server-cross-domain.log &
- name: Install dependencies and start servers (flask)
if: matrix.framework == 'flask'
working-directory: supertokens-python
run: |
source venv/bin/activate
make with-flask
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
cd tests/frontendIntegration/flask-server
python3 app.py --port 8080 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log &
python3 app.py --port 8082 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server-cross-domain.log &
- name: Install dependencies and start servers (flask-nest-asyncio)
if: matrix.framework == 'flask-nest-asyncio'
working-directory: supertokens-python
run: |
source venv/bin/activate
make with-flask
python -m pip install nest-asyncio
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
cd tests/frontendIntegration/flask-server
python3 app.py --port 8080 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log &
python3 app.py --port 8082 &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server-cross-domain.log &
- uses: supertokens/website-testing-action@main
with:
version: ${{ steps.versions.outputs.websiteVersion }}
node-sdk-version: ${{ steps.versions.outputs.nodeVersion }}
path: supertokens-website
check-name-suffix: '[Py=${{ matrix.py-version }}][FDI=${{ matrix.fdi-version }}][Framework=${{ matrix.framework }}]'
app-server-logs: ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}