Skip to content

Commit 2bebf03

Browse files
committed
ci: backend-sdk-testing
- Sets up workflow to run backend-sdk-testing tests - Updates test-servers to work with updated tests
1 parent f78e62d commit 2bebf03

File tree

4 files changed

+113
-1
lines changed

4 files changed

+113
-1
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: "Backend SDK Tests"
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.9", "3.10", "3.11", "3.12", "3.13"]'
23+
nodeVersions: '["20"]'
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: supertokens/get-supported-versions-action@main
27+
id: versions
28+
with:
29+
has-fdi: true
30+
has-cdi: true
31+
32+
test:
33+
runs-on: ubuntu-latest
34+
needs: define-versions
35+
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
cdi-version: ${{ fromJSON(needs.define-versions.outputs.cdiVersions) }}
40+
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
41+
py-version: ${{ fromJson(needs.define-versions.outputs.pyVersions) }}
42+
node-version: ${{ fromJson(needs.define-versions.outputs.nodeVersions) }}
43+
44+
env:
45+
API_PORT: 3030
46+
SUPERTOKENS_CORE_PORT: 3567
47+
SUPERTOKENS_CORE_HOST: localhost
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
with:
52+
# Checking out to a custom path since the test repo will also be cloned
53+
path: supertokens-python
54+
55+
- uses: supertokens/get-versions-action@main
56+
id: versions
57+
with:
58+
driver-name: python
59+
cdi-version: ${{ matrix.cdi-version }}
60+
fdi-version: ${{ matrix.fdi-version }}
61+
env:
62+
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}
63+
64+
- uses: actions/setup-node@v4
65+
with:
66+
node-version: ${{ matrix.node-version }}
67+
68+
- name: Create virtual environment and install dependencies
69+
working-directory: supertokens-python
70+
# Upgrade `pip` and `setuptools` to have the latest versions before further installs
71+
run: |
72+
python3 -m venv venv
73+
source venv/bin/activate
74+
python3 -m pip install pip setuptools --upgrade
75+
make dev-install && rm -rf src
76+
- name: Start core and server
77+
working-directory: supertokens-python
78+
env:
79+
SUPERTOKENS_ENV: testing
80+
SUPERTOKENS_CORE_VERSION: ${{ steps.versions.outputs.coreVersionXy }}
81+
run: |
82+
source venv/bin/activate
83+
docker compose up --build --wait
84+
python3 tests/test-server/app.py &
85+
- uses: supertokens/backend-sdk-testing-action@main
86+
with:
87+
# version: ${{ matrix.fdi-version }}
88+
version: ci/github-actions/containerized-core/${{ matrix.fdi-version }}
89+
check-name-suffix: '[CDI=${{ matrix.cdi-version }}][Core=${{ steps.versions.outputs.coreVersionXy }}][FDI=${{ matrix.fdi-version }}][Py=${{ matrix.py-version }}][Node=${{ matrix.node-version }}]'
90+
path: backend-sdk-testing

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
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 backend-sdk-testing
11+
- Updates test-servers to work with updated tests
1012

1113
## [0.29.1] - 2025-04-11
1214
- Fixes an issue where `removeDevice` API allowed removing TOTP devices without the user completing MFA.

compose.yml

Lines changed: 10 additions & 0 deletions
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/test-server/app.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ def origin_func( # pylint: disable=unused-argument, dangerous-default-value
9494
return origin
9595
return "http://localhost:8080"
9696

97+
core_host: str = os.environ.get("SUPERTOKENS_CORE_HOST", "localhost")
98+
core_port: str = os.environ.get("SUPERTOKENS_CORE_PORT", "3567")
99+
core_url = f"http://{core_host}:{core_port}"
100+
97101
init(
98102
app_info=InputAppInfo(
99103
app_name="SuperTokens",
100104
api_domain="http://api.supertokens.io",
101105
origin=origin_func,
102106
),
103-
supertokens_config=SupertokensConfig(connection_uri="http://localhost:3567"),
107+
supertokens_config=SupertokensConfig(connection_uri=core_url),
104108
framework="flask",
105109
recipe_list=[emailpassword.init(), session.init()],
106110
)
@@ -739,6 +743,12 @@ def reset_override_params_api():
739743
return jsonify({"ok": True})
740744

741745

746+
@app.route("/test/resetoverridelogs", methods=["GET"]) # type: ignore
747+
def reset_override_logs():
748+
override_logging.reset_override_logs()
749+
return jsonify({"ok": True})
750+
751+
742752
@app.route("/test/getoverridelogs", methods=["GET"]) # type: ignore
743753
def get_override_logs():
744754
return jsonify({"logs": override_logging.override_logs})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy