|
| 1 | +name: "Website 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.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 | + test: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + needs: define-versions |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + py-version: ${{ fromJSON(needs.define-versions.outputs.pyVersions) }} |
| 38 | + fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }} |
| 39 | + framework: |
| 40 | + - django2x |
| 41 | + - django3x |
| 42 | + - drf_sync |
| 43 | + - drf_async |
| 44 | + - fastapi |
| 45 | + - flask |
| 46 | + - flask-nest-asyncio |
| 47 | + |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + with: |
| 51 | + path: supertokens-python |
| 52 | + |
| 53 | + - uses: actions/setup-python@v5 |
| 54 | + with: |
| 55 | + python-version: ${{ matrix.py-version }} |
| 56 | + |
| 57 | + - uses: supertokens/get-versions-action@main |
| 58 | + id: versions |
| 59 | + with: |
| 60 | + driver-name: python |
| 61 | + fdi-version: ${{ matrix.fdi-version }} |
| 62 | + env: |
| 63 | + SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }} |
| 64 | + |
| 65 | + - name: Start core |
| 66 | + working-directory: supertokens-python |
| 67 | + run: docker compose up --wait |
| 68 | + |
| 69 | + - name: Setup venv |
| 70 | + working-directory: supertokens-python |
| 71 | + run: | |
| 72 | + python3 -m venv venv |
| 73 | + source venv/bin/activate |
| 74 | + python3 -m pip install pip setuptools --upgrade |
| 75 | +
|
| 76 | + - name: Install dependencies and start servers (django2x) |
| 77 | + if: matrix.framework == 'django2x' |
| 78 | + working-directory: supertokens-python |
| 79 | + run: | |
| 80 | + source venv/bin/activate |
| 81 | + make with-django2x |
| 82 | +
|
| 83 | + # Django2 uses `cgi`, deprecated in 3.13 |
| 84 | + if [ ${{ matrix.py-version == '3.13' }} ]; then |
| 85 | + pip install legacy-cgi |
| 86 | + fi |
| 87 | +
|
| 88 | + export PYTHONPATH="${PYTHONPATH}:$(pwd)" |
| 89 | + cd tests/frontendIntegration/django2x |
| 90 | +
|
| 91 | + gunicorn mysite.wsgi --bind 0.0.0.0:8080 &> app-server.log & |
| 92 | + gunicorn mysite.wsgi --bind 0.0.0.0:8082 &> app-server-cross-domain.log & |
| 93 | +
|
| 94 | + - name: Install dependencies and start servers (django3x) |
| 95 | + if: matrix.framework == 'django3x' |
| 96 | + working-directory: supertokens-python |
| 97 | + run: | |
| 98 | + source venv/bin/activate |
| 99 | + make with-django |
| 100 | +
|
| 101 | + export PYTHONPATH="${PYTHONPATH}:$(pwd)" |
| 102 | + cd tests/frontendIntegration/django3x |
| 103 | +
|
| 104 | + uvicorn mysite.asgi:application --port 8080 &> app-server.log & |
| 105 | + uvicorn mysite.asgi:application --port 8082 &> app-server-cross-domain.log & |
| 106 | +
|
| 107 | + - name: Install dependencies and start servers (drf_sync) |
| 108 | + if: matrix.framework == 'drf_sync' |
| 109 | + working-directory: supertokens-python |
| 110 | + run: | |
| 111 | + source venv/bin/activate |
| 112 | + make with-drf |
| 113 | +
|
| 114 | + export PYTHONPATH="${PYTHONPATH}:$(pwd)" |
| 115 | + cd tests/frontendIntegration/drf_sync |
| 116 | +
|
| 117 | + gunicorn mysite.wsgi --bind 0.0.0.0:8080 &> app-server.log & |
| 118 | + gunicorn mysite.wsgi --bind 0.0.0.0:8082 &> app-server-cross-domain.log & |
| 119 | +
|
| 120 | + - name: Install dependencies and start servers (drf_async) |
| 121 | + if: matrix.framework == 'drf_async' |
| 122 | + working-directory: supertokens-python |
| 123 | + run: | |
| 124 | + source venv/bin/activate |
| 125 | + make with-drf |
| 126 | +
|
| 127 | + export PYTHONPATH="${PYTHONPATH}:$(pwd)" |
| 128 | + cd tests/frontendIntegration/drf_async |
| 129 | +
|
| 130 | + uvicorn mysite.asgi:application --port 8080 &> app-server.log & |
| 131 | + uvicorn mysite.asgi:application --port 8082 &> app-server-cross-domain.log & |
| 132 | +
|
| 133 | + - name: Install dependencies and start servers (fastapi) |
| 134 | + if: matrix.framework == 'fastapi' |
| 135 | + working-directory: supertokens-python |
| 136 | + run: | |
| 137 | + source venv/bin/activate |
| 138 | + make with-fastapi |
| 139 | +
|
| 140 | + export PYTHONPATH="${PYTHONPATH}:$(pwd)" |
| 141 | + cd tests/frontendIntegration/fastapi-server |
| 142 | +
|
| 143 | + uvicorn app:app --host 0.0.0.0 --port 8080 &> app-server.log & |
| 144 | + uvicorn app:app --host 0.0.0.0 --port 8082 &> app-server-cross-domain.log & |
| 145 | +
|
| 146 | + - name: Install dependencies and start servers (flask) |
| 147 | + if: matrix.framework == 'flask' |
| 148 | + working-directory: supertokens-python |
| 149 | + run: | |
| 150 | + source venv/bin/activate |
| 151 | + make with-flask |
| 152 | +
|
| 153 | + export PYTHONPATH="${PYTHONPATH}:$(pwd)" |
| 154 | + cd tests/frontendIntegration/flask-server |
| 155 | +
|
| 156 | + python3 app.py --port 8080 &> app-server.log & |
| 157 | + python3 app.py --port 8082 &> app-server-cross-domain.log & |
| 158 | +
|
| 159 | + - name: Install dependencies and start servers (flask-nest-asyncio) |
| 160 | + if: matrix.framework == 'flask-nest-asyncio' |
| 161 | + working-directory: supertokens-python |
| 162 | + run: | |
| 163 | + source venv/bin/activate |
| 164 | + make with-flask |
| 165 | + python -m pip install nest-asyncio |
| 166 | +
|
| 167 | + export PYTHONPATH="${PYTHONPATH}:$(pwd)" |
| 168 | + cd tests/frontendIntegration/flask-server |
| 169 | +
|
| 170 | + python3 app.py --port 8080 &> app-server.log & |
| 171 | + python3 app.py --port 8082 &> app-server-cross-domain.log & |
| 172 | +
|
| 173 | + - uses: supertokens/website-testing-action@main |
| 174 | + with: |
| 175 | + version: ${{ steps.versions.outputs.frontendVersionXy }} |
| 176 | + node-sdk-version: ${{ steps.versions.outputs.nodeTag }} |
| 177 | + path: supertokens-website |
| 178 | + check-name-suffix: '[Py=${{ matrix.py-version }}][FDI=${{ matrix.fdi-version }}][Framework=${{ matrix.framework }}]' |
0 commit comments