Skip to content

Commit f6eb753

Browse files
committed
ci: auth-react
- Sets up workflow to run auth-react tests - Updates test-servers to work with updated tests
1 parent 1273c46 commit f6eb753

File tree

12 files changed

+685
-265
lines changed

12 files changed

+685
-265
lines changed
+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Auth-React Tests - L1
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
push:
10+
branches:
11+
- master
12+
- "v[0-9]+.[0-9]+"
13+
tags:
14+
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
15+
16+
jobs:
17+
define-versions:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
fdiVersions: ${{ steps.versions.outputs.fdiVersions }}
21+
cdiVersions: ${{ steps.versions.outputs.cdiVersions }}
22+
pyVersions: '["3.8", "3.13"]'
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: supertokens/get-supported-versions-action@main
26+
id: versions
27+
with:
28+
has-fdi: true
29+
has-cdi: true
30+
31+
setup-auth-react:
32+
runs-on: ubuntu-latest
33+
needs: define-versions
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
38+
39+
outputs:
40+
AUTH_REACT__LOG_DIR: ${{ steps.envs.outputs.AUTH_REACT__LOG_DIR }}
41+
AUTH_REACT__SCREENSHOT_DIR: ${{ steps.envs.outputs.AUTH_REACT__SCREENSHOT_DIR }}
42+
AUTH_REACT__APP_SERVER: ${{ steps.envs.outputs.AUTH_REACT__APP_SERVER }}
43+
AUTH_REACT__NODE_PORT: ${{ steps.envs.outputs.AUTH_REACT__NODE_PORT }}
44+
AUTH_REACT__TEST_MODE: ${{ steps.envs.outputs.AUTH_REACT__TEST_MODE }}
45+
AUTH_REACT__PORT: ${{ steps.envs.outputs.AUTH_REACT__PORT }}
46+
specs: ${{ steps.envs.outputs.specs }}
47+
matrix: ${{ steps.setup-matrix.outputs.matrix }}
48+
49+
steps:
50+
- uses: supertokens/get-versions-action@main
51+
id: versions
52+
with:
53+
driver-name: python
54+
fdi-version: ${{ matrix.fdi-version }}
55+
env:
56+
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}
57+
58+
- uses: supertokens/auth-react-testing-action/setup@main
59+
id: envs
60+
with:
61+
# auth-react-version: ${{ steps.versions.outputs.authReactVersionXy }}
62+
auth-react-version: ci/github-actions/auth-react/v${{ steps.versions.outputs.authReactVersionXy }}.0
63+
node-sdk-version: ${{ steps.versions.outputs.nodeTag }}
64+
fdi-version: ${{ matrix.fdi-version }}
65+
66+
- id: setup-matrix
67+
uses: supertokens/extended-matrix-action@main
68+
with:
69+
artifact-id: ${{ matrix.fdi-version }}
70+
matrix: |
71+
py-version: ${{ needs.define-versions.outputs.pyVersions }}
72+
framework: ["django", "fastapi", "flask"]
73+
spec: ${{ steps.envs.outputs.specs }}
74+
75+
launch-fdi-workflows:
76+
uses: ./.github/workflows/auth-react-test-2.yml
77+
needs:
78+
- define-versions
79+
- setup-auth-react
80+
strategy:
81+
max-parallel: 1 # This is important to avoid ddos GHA API
82+
fail-fast: false # Don't fail fast to avoid locking TF State
83+
matrix:
84+
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
85+
name: FDI ${{ matrix.fdi-version }}
86+
with:
87+
artifact-id: ${{ matrix.fdi-version }}
88+
AUTH_REACT__LOG_DIR: ${{ needs.setup-auth-react.outputs.AUTH_REACT__LOG_DIR }}
89+
AUTH_REACT__SCREENSHOT_DIR: ${{ needs.setup-auth-react.outputs.AUTH_REACT__SCREENSHOT_DIR }}
90+
AUTH_REACT__APP_SERVER: ${{ needs.setup-auth-react.outputs.AUTH_REACT__APP_SERVER }}
91+
AUTH_REACT__NODE_PORT: ${{ needs.setup-auth-react.outputs.AUTH_REACT__NODE_PORT }}
92+
AUTH_REACT__TEST_MODE: ${{ needs.setup-auth-react.outputs.AUTH_REACT__TEST_MODE }}
93+
AUTH_REACT__PORT: ${{ needs.setup-auth-react.outputs.AUTH_REACT__PORT }}
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Auth-React Tests - L2
2+
on:
3+
workflow_call:
4+
inputs:
5+
artifact-id:
6+
description: "Matrix artifact ID"
7+
required: true
8+
type: string
9+
10+
AUTH_REACT__LOG_DIR:
11+
description: AUTH_REACT__LOG_DIR
12+
required: true
13+
type: string
14+
15+
AUTH_REACT__SCREENSHOT_DIR:
16+
description: AUTH_REACT__SCREENSHOT_DIR
17+
required: true
18+
type: string
19+
20+
AUTH_REACT__APP_SERVER:
21+
description: AUTH_REACT__APP_SERVER
22+
required: true
23+
type: string
24+
25+
AUTH_REACT__NODE_PORT:
26+
description: AUTH_REACT__NODE_PORT
27+
required: true
28+
type: string
29+
30+
AUTH_REACT__TEST_MODE:
31+
description: AUTH_REACT__TEST_MODE
32+
required: true
33+
type: string
34+
35+
AUTH_REACT__PORT:
36+
description: AUTH_REACT__PORT
37+
required: true
38+
type: string
39+
40+
41+
jobs:
42+
retrieve-matrix:
43+
runs-on: ubuntu-latest
44+
45+
outputs:
46+
matrix: ${{ steps.get-matrix.outputs.matrix }}
47+
48+
steps:
49+
- uses: actions/download-artifact@v4
50+
with:
51+
name: matrix-${{ inputs.artifact-id }}
52+
- id: get-matrix
53+
run: |
54+
matrix=$(<matrix-${{ inputs.artifact-id }}.json)
55+
echo "matrix=$matrix" | tee -a "$GITHUB_OUTPUT"
56+
57+
launch-test-workflows:
58+
needs:
59+
- retrieve-matrix
60+
61+
strategy:
62+
max-parallel: 1 # This is important to avoid ddos GHA API
63+
fail-fast: false # Don't fail fast to avoid locking TF State
64+
matrix: ${{ fromJson(needs.retrieve-matrix.outputs.matrix) }}
65+
66+
uses: ./.github/workflows/auth-react-test-3.yml
67+
name: Group ${{ matrix.name }}
68+
with:
69+
matrix: ${{ matrix.items }}
70+
fdi-version: ${{ inputs.artifact-id }}
71+
AUTH_REACT__LOG_DIR: ${{ inputs.AUTH_REACT__LOG_DIR }}
72+
AUTH_REACT__SCREENSHOT_DIR: ${{ inputs.AUTH_REACT__SCREENSHOT_DIR }}
73+
AUTH_REACT__APP_SERVER: ${{ inputs.AUTH_REACT__APP_SERVER }}
74+
AUTH_REACT__NODE_PORT: ${{ inputs.AUTH_REACT__NODE_PORT }}
75+
AUTH_REACT__TEST_MODE: ${{ inputs.AUTH_REACT__TEST_MODE }}
76+
AUTH_REACT__PORT: ${{ inputs.AUTH_REACT__PORT }}
+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Auth-React Tests - L3
2+
on:
3+
workflow_call:
4+
inputs:
5+
fdi-version:
6+
description: "FDI Version for this set of tests"
7+
required: true
8+
type: string
9+
10+
matrix:
11+
description: "Matrix"
12+
required: true
13+
type: string
14+
15+
AUTH_REACT__LOG_DIR:
16+
description: AUTH_REACT__LOG_DIR
17+
required: true
18+
type: string
19+
20+
AUTH_REACT__SCREENSHOT_DIR:
21+
description: AUTH_REACT__SCREENSHOT_DIR
22+
required: true
23+
type: string
24+
25+
AUTH_REACT__APP_SERVER:
26+
description: AUTH_REACT__APP_SERVER
27+
required: true
28+
type: string
29+
30+
AUTH_REACT__NODE_PORT:
31+
description: AUTH_REACT__NODE_PORT
32+
required: true
33+
type: string
34+
35+
AUTH_REACT__TEST_MODE:
36+
description: AUTH_REACT__TEST_MODE
37+
required: true
38+
type: string
39+
40+
AUTH_REACT__PORT:
41+
description: AUTH_REACT__PORT
42+
required: true
43+
type: string
44+
45+
46+
jobs:
47+
test:
48+
if: ${{ inputs.matrix != '{"include":[]}' }}
49+
runs-on: ubuntu-latest
50+
strategy:
51+
max-parallel: 10
52+
fail-fast: false # Don't fail fast to avoid locking TF State
53+
matrix: ${{ fromJson(inputs.matrix) }}
54+
55+
env:
56+
SUPERTOKENS_CORE_PORT: 3567
57+
SUPERTOKENS_CORE_HOST: localhost
58+
TEST_MODE: testing
59+
# Auth react setup envs
60+
AUTH_REACT__LOG_DIR: ${{ inputs.AUTH_REACT__LOG_DIR }}
61+
AUTH_REACT__SCREENSHOT_DIR: ${{ inputs.AUTH_REACT__SCREENSHOT_DIR }}
62+
AUTH_REACT__APP_SERVER: ${{ inputs.AUTH_REACT__APP_SERVER }}
63+
AUTH_REACT__NODE_PORT: ${{ inputs.AUTH_REACT__NODE_PORT }}
64+
AUTH_REACT__TEST_MODE: ${{ inputs.AUTH_REACT__TEST_MODE }}
65+
AUTH_REACT__PORT: ${{ inputs.AUTH_REACT__PORT }}
66+
67+
steps:
68+
- uses: actions/checkout@v4
69+
with:
70+
path: supertokens-python
71+
72+
- uses: actions/setup-python@v5
73+
with:
74+
python-version: ${{ matrix.py-version }}
75+
76+
- name: Create virtual environment and install dependencies
77+
working-directory: supertokens-python
78+
# Upgrade `pip` and `setuptools` to have the latest versions before further installs
79+
run: |
80+
python3 -m venv venv
81+
source venv/bin/activate
82+
python3 -m pip install pip setuptools --upgrade
83+
make dev-install && rm -rf src
84+
85+
- name: Start core
86+
working-directory: supertokens-python
87+
run: docker compose up --wait
88+
89+
- name: Start Server (django)
90+
if: matrix.framework == 'django'
91+
working-directory: supertokens-python
92+
run: |
93+
source venv/bin/activate
94+
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
95+
cd tests/auth-react/django3x
96+
97+
mkdir -p $AUTH_REACT__LOG_DIR
98+
uvicorn mysite.asgi:application --port 8083 &> $AUTH_REACT__LOG_DIR/django.log &
99+
100+
- name: Start Server (fastapi)
101+
if: matrix.framework == 'fastapi'
102+
working-directory: supertokens-python
103+
run: |
104+
source venv/bin/activate
105+
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
106+
cd tests/auth-react/fastapi-server
107+
108+
mkdir -p $AUTH_REACT__LOG_DIR
109+
uvicorn app:app --host 0.0.0.0 --port 8083 &> $AUTH_REACT__LOG_DIR/fastapi.log &
110+
111+
- name: Start Server (flask)
112+
if: matrix.framework == 'flask'
113+
working-directory: supertokens-python
114+
run: |
115+
source venv/bin/activate
116+
export PYTHONPATH="${PYTHONPATH}:$(pwd)"
117+
cd tests/auth-react/flask-server
118+
119+
mkdir -p $AUTH_REACT__LOG_DIR
120+
python3 app.py --port 8083 &> $AUTH_REACT__LOG_DIR/flask.log &
121+
122+
- uses: supertokens/auth-react-testing-action@main
123+
with:
124+
fdi-version: ${{ inputs.fdi-version }}
125+
check-name-suffix: '[FDI=${{ inputs.fdi-version }}][Py=${{ matrix.py-version }}][Framework=${{ matrix.framework }}][Spec=${{ matrix.spec }}]'
126+
path: supertokens-auth-react
127+
spec: ${{ matrix.spec }}

.github/workflows/test.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "Test Workflow"
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
10+
jobs:
11+
define-versions:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
fdiVersions: ${{ steps.versions.outputs.fdiVersions }}
15+
cdiVersions: ${{ steps.versions.outputs.cdiVersions }}
16+
pyVersions: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]'
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: supertokens/get-supported-versions-action@main
20+
id: versions
21+
with:
22+
has-fdi: true
23+
has-cdi: true
24+
25+
test:
26+
runs-on: ubuntu-latest
27+
needs: define-versions
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
cdi-version: ${{ fromJSON(needs.define-versions.outputs.cdiVersions) }}
32+
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
33+
steps:
34+
- uses: supertokens/get-versions-action@main
35+
id: versions
36+
with:
37+
driver-name: python
38+
cdi-version: ${{ matrix.cdi-version }}
39+
fdi-version: ${{ matrix.fdi-version }}
40+
env:
41+
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88

99
## [unreleased]
10+
- Sets up workflow to run auth-react tests
11+
- Updates test-servers to work with updated tests
1012

1113
## [0.29.0] - 2025-03-03
1214
### Breaking changes

compose.yml

+10
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ services:
66
# Uses `$SUPERTOKENS_CORE_PORT` when available, else 3567 for local port
77
- ${SUPERTOKENS_CORE_PORT:-3567}:3567
88
platform: linux/amd64
9+
depends_on: [oauth]
10+
environment:
11+
OAUTH_PROVIDER_PUBLIC_SERVICE_URL: http://oauth:4444
12+
OAUTH_PROVIDER_ADMIN_SERVICE_URL: http://oauth:4445
13+
OAUTH_PROVIDER_CONSENT_LOGIN_BASE_URL: http://localhost:3001/auth
14+
OAUTH_CLIENT_SECRET_ENCRYPTION_KEY: asdfasdfasdfasdfasdf
915
healthcheck:
1016
test: bash -c 'curl -s "http://127.0.0.1:3567/hello" | grep "Hello"'
1117
interval: 10s
1218
timeout: 5s
1319
retries: 5
20+
21+
oauth:
22+
image: supertokens/oauth2-test:latest
23+
platform: linux/amd64

tests/auth-react/auth-react.env

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Github
2+
GITHUB_CLIENT_ID=3252a5c90b03cf443809
3+
GITHUB_CLIENT_SECRET=52d734435c33ba639e4c96dc0637b1732034f44b
4+
# Google
5+
GOOGLE_CLIENT_ID=32344485696-ghkrbkgc6e3ar39nvmmbuvgn0g71923s.apps.googleusercontent.com
6+
GOOGLE_CLIENT_SECRET=hK_o4jHsglS_qdCU6qGgoMz2
7+
# Facebook
8+
FACEBOOK_CLIENT_ID=1149041618882342
9+
FACEBOOK_CLIENT_SECRET=d6bb1171262bbe9095053145de07cd32
10+
# Auth0
11+
AUTH0_CLIENT_ID=hlhUyF1OvpCYqODkkjdeNAuDdVdDNkIm
12+
AUTH0_CLIENT_SECRET=CBNLgo3j2G-RuZWowNV5x9rPNio1O44y4sEl_jZSOWIQ1Pad_4hN-qD8TWs405pa
13+
AUTH0_DOMAIN=dev-3myi6b3e.us.auth0.com

0 commit comments

Comments
 (0)