Skip to content
Open
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
9 changes: 7 additions & 2 deletions .github/workflows/auth-react-test-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ on:
- opened
- reopened
- synchronize
- labeled
- unlabeled
push:
tags:
- dev-v[0-9]+.[0-9]+.[0-9]+
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.
Expand All @@ -18,6 +20,7 @@ concurrency:

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 }}
Expand All @@ -32,6 +35,7 @@ jobs:
has-web-js: true

setup-auth-react:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
runs-on: ubuntu-latest
needs: define-versions
strategy:
Expand Down Expand Up @@ -118,6 +122,7 @@ jobs:
artifactName: auth-react-${{ matrix.fdi-version }}

launch-test-workflow:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
uses: ./.github/workflows/auth-react-test-2.yml
needs: setup-auth-react
name: FDI ${{ matrix.fdi-version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/auth-react-test-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ on:

jobs:
test:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-tests')
runs-on: ubuntu-latest

strategy:
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: "Check if docs need an update"

on:
push:
branches:
- "[0-9]+.[0-9]+"

permissions:
contents: write

# 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:
check-docs:
name: Check if docs need an update
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
# Need a complete fetch to make the master merge check work
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.ALL_REPO_PAT }}

- name: Setup git
run: |
# NOTE: The user email is {user.id}+{user.login}@users.noreply.github.com.
# See users API: https://api.github.com/users/github-actions%5Bbot%5D
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin master

- uses: actions/setup-node@v5
with:
node-version: 20

- name: Populate variables
id: versions
run: |
. ./hooks/populate-hook-constants.sh

echo "packageVersion=$packageVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "packageVersionXy=$packageVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "packageLockVersion=$packageLockVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "packageLockVersionXy=$packageLockVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "newestVersion=$newestVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "targetBranch=$targetBranch" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"

- name: Check tag and branch correctness
run: |
if [[ "${{ steps.versions.outputs.packageVersion }}" != "${{ steps.versions.outputs.packageLockVersion }}" ]]
then
echo "The package version and package lock version do not match."
exit 1
fi

if [[ "refs/heads/${{ steps.versions.outputs.packageVersion }}" != ${{ github.ref }}* ]]
then
echo "Branch name and package version mismatch"
exit 1
fi

- name: Install dependencies
run: npm install

- name: Build docs
run: |
npm run build-pretty
npm run build-docs

- name: Check for changes in docs and create a commit if necessary
run: |
git update-index --really-refresh

if git diff-index --quiet HEAD; then
# No-op, docs are updated
else
# Update docs and create a commit on the branch
git add --all
git commit -nm "doc: update docs for v${{ steps.versions.outputs.packageVersion }} tag"
git push
fi
130 changes: 130 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Web JS Integration 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 }}
wjiVersions: ${{ steps.versions.outputs.webJsInterfaceVersion }}
nodeVersions: '["20"]'
nodeFdiVersionMap: ${{ steps.node-versions.outputs.fdiVersions }}
specs: ${{ steps.specs.outputs.specs }}
steps:
- uses: actions/checkout@v4

- uses: supertokens/get-supported-versions-action@main
id: versions
with:
has-fdi: true
has-web-js: true

- 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 }}

- name: Get test specs
id: specs
run: |
echo "specs=$(find 'test/integration' -name '*.test.js' -type f | sort | jq -Rsc 'split("\n")[:-1]' | jq -r 'tostring')" | tee -a "$GITHUB_OUTPUT"

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:
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
node-version: ${{ fromJson(needs.define-versions.outputs.nodeVersions) }}
spec: ${{ fromJSON(needs.define-versions.outputs.specs) }}

env:
API_PORT: 3030
SUPERTOKENS_CORE_PORT: 3567
SUPERTOKENS_CORE_HOST: localhost
SUPERTOKENS_ENV: testing
TEST_MODE: testing

steps:
- uses: actions/checkout@v4
with:
path: supertokens-web-js

- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Get Node version from current FDI version
id: node-version
run: |
nodeVersion=$(echo '${{ needs.define-versions.outputs.nodeFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]')
echo "nodeVersion=${nodeVersion}" >> $GITHUB_OUTPUT

- uses: actions/checkout@v4
with:
repository: supertokens/supertokens-node
path: supertokens-node

- uses: supertokens/get-supported-versions-action@main
id: node-cdi-versions
with:
has-cdi: true
working-directory: supertokens-node

- uses: supertokens/actions/get-versions-from-repo@main
id: core-versions
with:
repo: supertokens-core
github-token: ${{ secrets.GITHUB_TOKEN }}
cdi-versions: ${{steps.node-cdi-versions.outputs.cdiVersions }}

- name: Get core version from latest CDI version
id: core-version
run: |
lastCdiVersion=$(echo '${{ steps.node-cdi-versions.outputs.cdiVersions }}' | jq -r '.[-1]')
coreVersion=$(echo '${{ steps.core-versions.outputs.cdiVersions }}' | jq -r ".[\"$lastCdiVersion\"]")
echo "coreVersion=${coreVersion}" >> $GITHUB_OUTPUT

- name: Start core
working-directory: supertokens-web-js
env:
SUPERTOKENS_CORE_VERSION: ${{ steps.core-version.outputs.coreVersion }}
run: |
docker compose up --build --wait

- name: Setup server
working-directory: supertokens-web-js/test/server
env:
NODE_PORT: 8082
run: |
npm i
node . &

- name: Run tests
working-directory: supertokens-web-js
run: |
npm i
npx mocha --spec "${{ matrix.spec }}"
Loading
Loading