Skip to content

ci: website #577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 178 additions & 0 deletions .github/workflows/website-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
name: "Website Tests"

on:
pull_request:
types:
- opened
- reopened
- synchronize
push:
branches:
- master
- "v[0-9]+.[0-9]+"
tags:
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"

jobs:
define-versions:
runs-on: ubuntu-latest
outputs:
fdiVersions: ${{ steps.versions.outputs.fdiVersions }}
cdiVersions: ${{ steps.versions.outputs.cdiVersions }}
pyVersions: '["3.8", "3.13"]'
steps:
- uses: actions/checkout@v4
- uses: supertokens/get-supported-versions-action@main
id: versions
with:
has-fdi: true
has-cdi: true

test:
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:
- uses: actions/checkout@v4
with:
path: supertokens-python

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py-version }}

- uses: supertokens/get-versions-action@main
id: versions
with:
driver-name: python
fdi-version: ${{ matrix.fdi-version }}
env:
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}

- name: Start core
working-directory: supertokens-python
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 &> app-server.log &
gunicorn mysite.wsgi --bind 0.0.0.0:8082 &> 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 &> app-server.log &
uvicorn mysite.asgi:application --port 8082 &> 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 &> app-server.log &
gunicorn mysite.wsgi --bind 0.0.0.0:8082 &> 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 &> app-server.log &
uvicorn mysite.asgi:application --port 8082 &> 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 &> app-server.log &
uvicorn app:app --host 0.0.0.0 --port 8082 &> 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 &> app-server.log &
python3 app.py --port 8082 &> 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 &> app-server.log &
python3 app.py --port 8082 &> app-server-cross-domain.log &

- uses: supertokens/website-testing-action@main
with:
version: ${{ steps.versions.outputs.frontendVersionXy }}
node-sdk-version: ${{ steps.versions.outputs.nodeTag }}
path: supertokens-website
check-name-suffix: '[Py=${{ matrix.py-version }}][FDI=${{ matrix.fdi-version }}][Framework=${{ matrix.framework }}]'
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [unreleased]
- Sets up workflow to run backend-sdk-testing
- Updates test-servers to work with updated tests
- Adds workflow to test supertokens-website
- Updates `frontendIntegration` servers

## [0.29.1] - 2025-04-11
- Fixes an issue where `removeDevice` API allowed removing verified TOTP devices without the user completing MFA.
Expand Down
8 changes: 4 additions & 4 deletions tests/frontendIntegration/django2x/mysite/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["localhost.org", "localhost", "0.0.0.0"]
ALLOWED_HOSTS = ["localhost.org", "localhost", "0.0.0.0", "cross.localhost"]

CORS_ORIGIN_WHITELIST = [
"http://localhost.org:8080",
"http://localhost:8080",
]
CORS_ALLOW_ALL_ORIGINS = True
CORS_ALLOW_CREDENTIALS = True
CORS_ALLOWED_ORIGINS = [
"http://localhost.org:8080",
"http://localhost:8080",
]
CORS_ALLOWED_ORIGIN_REGEXES = [
"http://localhost.org:8080",
"http://localhost:8080",
]

CORS_ALLOW_METHODS = [
Expand Down
10 changes: 9 additions & 1 deletion tests/frontendIntegration/django2x/mysite/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
# to help middleware function with uvicorn (to ensure supertokens init is called)
from polls.views import config

config(True, False, None)
core_host = os.environ.get("SUPERTOKENS_CORE_HOST", "localhost")
core_port = os.environ.get("SUPERTOKENS_CORE_PORT", "3567")

config(
core_url=f"http://{core_host}:{core_port}",
enable_anti_csrf=True,
enable_jwt=False,
jwt_property_name=None,
)

application = get_wsgi_application()
8 changes: 6 additions & 2 deletions tests/frontendIntegration/django2x/polls/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
path("index.html", views.send_file, name="index.html"), # type: ignore
path("login", views.login, name="login"), # type: ignore
path("login-2.18", views.login_218, name="login_218"), # type: ignore
path(
"test/setup/st",
views.setup_st, # type: ignore
name="setup_st",
),
path("beforeeach", views.before_each, name="beforeeach"), # type: ignore
path("after", views.after, name="after"), # type: ignore
path("testUserConfig", views.test_config, name="testUserConfig"), # type: ignore
path(
"multipleInterceptors",
Expand Down Expand Up @@ -40,8 +46,6 @@
name="refreshAttemptedTime",
),
path("auth/session/refresh", views.refresh, name="refresh"), # type: ignore
path("setAntiCsrf", views.set_anti_csrf, name="setAntiCsrf"),
path("setEnableJWT", views.set_enable_jwt, name="setEnableJWT"),
path("featureFlags", views.feature_flags, name="featureFlags"),
path(
"reinitialiseBackendConfig",
Expand Down
Loading
Loading
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