Skip to content

chore: rebuild-docs #154

chore: rebuild-docs

chore: rebuild-docs #154

Workflow file for this run

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 }}
nodeVersions: '["20"]'
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:
node-version: ${{ fromJSON(needs.define-versions.outputs.nodeVersions) }}
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
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:
path: supertokens-node
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-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-node
env:
SUPERTOKENS_CORE_VERSION: ${{ steps.versions.outputs.coreVersion }}
run: docker compose up --wait
- name: Install SDK dependencies
working-directory: supertokens-node
run: npm i
- name: Start test server
working-directory: supertokens-node/test/frontendIntegration
env:
TEST_MODE: testing
run: |
npm i
NODE_PORT=8080 node . &> ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}/app-server.log &
NODE_PORT=8082 node . &> ${{ 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: "[Node=${{ matrix.node-version }}][FDI=${{ matrix.fdi-version }}]"
app-server-logs: ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }}