Skip to content

Commit d4e9b49

Browse files
authored
Merge pull request #138 from supertokens/feat/gha/adds-dev-release-pipelines
feat: adds dev/release pipelines, auth-react tests
2 parents b8be3cf + fe087a5 commit d4e9b49

File tree

9 files changed

+893
-109
lines changed

9 files changed

+893
-109
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Auth-React Tests - L1
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
push:
10+
tags:
11+
- dev-v[0-9]+.[0-9]+.[0-9]+
12+
13+
# Only one instance of this workflow will run on the same ref (PR/Branch/Tag)
14+
# Previous runs will be cancelled.
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
define-versions:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
fdiVersions: ${{ steps.versions.outputs.fdiVersions }}
24+
webJsInterfaceVersion: ${{ steps.versions.outputs.webJsInterfaceVersion }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: supertokens/get-supported-versions-action@main
29+
id: versions
30+
with:
31+
has-fdi: true
32+
has-web-js: true
33+
34+
setup-auth-react:
35+
runs-on: ubuntu-latest
36+
needs: define-versions
37+
strategy:
38+
fail-fast: true
39+
matrix:
40+
fdi-version: ${{ fromJSON(needs.define-versions.outputs.fdiVersions) }}
41+
42+
outputs:
43+
AUTH_REACT__LOG_DIR: ${{ steps.envs.outputs.AUTH_REACT__LOG_DIR }}
44+
AUTH_REACT__SCREENSHOT_DIR: ${{ steps.envs.outputs.AUTH_REACT__SCREENSHOT_DIR }}
45+
AUTH_REACT__NODE_PORT: ${{ steps.envs.outputs.AUTH_REACT__NODE_PORT }}
46+
AUTH_REACT__APP_SERVER: ${{ steps.envs.outputs.AUTH_REACT__NODE_PORT }}
47+
AUTH_REACT__TEST_MODE: ${{ steps.envs.outputs.AUTH_REACT__TEST_MODE }}
48+
AUTH_REACT__PORT: ${{ steps.envs.outputs.AUTH_REACT__PORT }}
49+
specs: ${{ steps.envs.outputs.specs }}
50+
fdiVersions: ${{ needs.define-versions.outputs.fdiVersions }}
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
path: supertokens-web-js
56+
57+
- uses: actions/setup-node@v4
58+
with:
59+
node-version: 20
60+
61+
- uses: supertokens/get-versions-action@main
62+
id: versions
63+
with:
64+
driver-name: node
65+
fdi-version: ${{ matrix.fdi-version }}
66+
fetch-frontend-versions: false
67+
web-js-interface-version: ${{ needs.define-versions.outputs.webJsInterfaceVersion }}
68+
env:
69+
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}
70+
71+
- uses: supertokens/auth-react-testing-action/setup@main
72+
id: envs
73+
with:
74+
auth-react-version: ${{ steps.versions.outputs.webJsReactVersionXy }}
75+
node-sdk-version: ${{ steps.versions.outputs.nodeTag }}
76+
fdi-version: ${{ matrix.fdi-version }}
77+
use-common-app-and-test-server: "true"
78+
persist-workspace: "false"
79+
80+
# We will use this in the test run to get the core version
81+
- uses: actions/checkout@v4
82+
with:
83+
repository: supertokens/supertokens-node
84+
ref: ${{ steps.versions.outputs.nodeTag }}
85+
path: supertokens-node
86+
87+
- name: Copy over required dependencies
88+
run: |
89+
cd supertokens-web-js
90+
# Create a tarball of the web-js package
91+
npm pack
92+
93+
cd ../supertokens-auth-react
94+
# Extract the tarball to the auth-react package
95+
tar -xf ../supertokens-web-js/supertokens-web-js-*.tgz --strip-components=1 -C node_modules/supertokens-web-js
96+
# # Remove existing website package and link to the one from web-js
97+
# rm -rf node_modules/supertokens-website
98+
# ln -s "../supertokens-web-js/node_modules/supertokens-website" node_modules
99+
100+
- name: Set up auth-react with new dependencies
101+
working-directory: supertokens-auth-react/examples/for-tests
102+
env:
103+
# Common
104+
APP_SERVER: ${{ steps.envs.outputs.AUTH_REACT__APP_SERVER }}
105+
NODE_PORT: ${{ steps.envs.outputs.AUTH_REACT__NODE_PORT }}
106+
TEST_MODE: ${{ steps.envs.outputs.AUTH_REACT__TEST_MODE }}
107+
# Step-specific
108+
CI: true
109+
BROWSER: none
110+
PORT: ${{ steps.envs.outputs.AUTH_REACT__PORT }}
111+
REACT_APP_API_PORT: ${{ steps.envs.outputs.AUTH_REACT__APP_SERVER }}
112+
run: |
113+
npm run prep
114+
115+
- uses: bissolli/gh-action-persist-workspace@v2
116+
with:
117+
action: persist
118+
artifactName: auth-react-${{ matrix.fdi-version }}
119+
120+
launch-test-workflow:
121+
uses: ./.github/workflows/auth-react-test-2.yml
122+
needs: setup-auth-react
123+
name: FDI ${{ matrix.fdi-version }}
124+
strategy:
125+
max-parallel: 1 # This is important to avoid ddos GHA API
126+
fail-fast: false # Don't fail fast to avoid locking TF State
127+
matrix:
128+
fdi-version: ${{ fromJSON(needs.setup-auth-react.outputs.fdiVersions) }}
129+
with:
130+
fdi-version: ${{ matrix.fdi-version }}
131+
specs: ${{ needs.setup-auth-react.outputs.specs }}
132+
AUTH_REACT__LOG_DIR: ${{ needs.setup-auth-react.outputs.AUTH_REACT__LOG_DIR }}
133+
AUTH_REACT__SCREENSHOT_DIR: ${{ needs.setup-auth-react.outputs.AUTH_REACT__SCREENSHOT_DIR }}
134+
AUTH_REACT__APP_SERVER: ${{ needs.setup-auth-react.outputs.AUTH_REACT__APP_SERVER }}
135+
AUTH_REACT__NODE_PORT: ${{ needs.setup-auth-react.outputs.AUTH_REACT__NODE_PORT }}
136+
AUTH_REACT__TEST_MODE: ${{ needs.setup-auth-react.outputs.AUTH_REACT__TEST_MODE }}
137+
AUTH_REACT__PORT: ${{ needs.setup-auth-react.outputs.AUTH_REACT__PORT }}
138+
secrets: inherit
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Auth-React Tests - L2
2+
on:
3+
workflow_call:
4+
inputs:
5+
fdi-version:
6+
description: "FDI Version"
7+
required: true
8+
type: string
9+
10+
specs:
11+
description: "Spec Files"
12+
required: true
13+
type: string
14+
15+
AUTH_REACT__LOG_DIR:
16+
description: AUTH_REACT__LOG_DIR
17+
required: true
18+
type: string
19+
20+
AUTH_REACT__SCREENSHOT_DIR:
21+
description: AUTH_REACT__SCREENSHOT_DIR
22+
required: true
23+
type: string
24+
25+
AUTH_REACT__APP_SERVER:
26+
description: AUTH_REACT__APP_SERVER
27+
required: true
28+
type: string
29+
30+
AUTH_REACT__NODE_PORT:
31+
description: AUTH_REACT__NODE_PORT
32+
required: true
33+
type: string
34+
35+
AUTH_REACT__TEST_MODE:
36+
description: AUTH_REACT__TEST_MODE
37+
required: true
38+
type: string
39+
40+
AUTH_REACT__PORT:
41+
description: AUTH_REACT__PORT
42+
required: true
43+
type: string
44+
45+
jobs:
46+
test:
47+
runs-on: ubuntu-latest
48+
49+
strategy:
50+
max-parallel: 10
51+
fail-fast: false
52+
matrix:
53+
spec: ${{ fromJSON(inputs.specs) }}
54+
55+
env:
56+
SUPERTOKENS_CORE_PORT: 3567
57+
SUPERTOKENS_CORE_HOST: localhost
58+
TEST_MODE: testing
59+
# Auth react setup envs
60+
AUTH_REACT__LOG_DIR: ${{ inputs.AUTH_REACT__LOG_DIR }}
61+
AUTH_REACT__SCREENSHOT_DIR: ${{ inputs.AUTH_REACT__SCREENSHOT_DIR }}
62+
AUTH_REACT__NODE_PORT: ${{ inputs.AUTH_REACT__NODE_PORT }}
63+
AUTH_REACT__APP_SERVER: ${{ inputs.AUTH_REACT__NODE_PORT }}
64+
AUTH_REACT__TEST_MODE: ${{ inputs.AUTH_REACT__TEST_MODE }}
65+
AUTH_REACT__PORT: ${{ inputs.AUTH_REACT__PORT }}
66+
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}
67+
68+
steps:
69+
- uses: actions/setup-node@v4
70+
with:
71+
node-version: 20
72+
73+
- uses: bissolli/gh-action-persist-workspace@v2
74+
with:
75+
action: retrieve
76+
artifactName: auth-react-${{ inputs.fdi-version }}
77+
78+
- name: Get Node CDI versions
79+
id: node-cdi-versions
80+
uses: supertokens/get-supported-versions-action@main
81+
with:
82+
has-cdi: true
83+
working-directory: supertokens-node
84+
85+
- uses: supertokens/get-versions-action@main
86+
id: versions
87+
with:
88+
driver-name: node
89+
fdi-version: ${{ inputs.fdi-version }}
90+
91+
- name: Get last Node CDI version
92+
id: last-node-cdi-version
93+
run: |
94+
export lastVersion=$(echo '${{ steps.node-cdi-versions.outputs.cdiVersions }}' | jq -r '.[-1]')
95+
echo "lastNodeCdiVersion=$lastVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
96+
97+
- name: Get Core version
98+
id: core-version
99+
uses: supertokens/get-versions-action@main
100+
with:
101+
driver-name: node
102+
cdi-version: ${{ steps.last-node-cdi-version.outputs.lastNodeCdiVersion }}
103+
env:
104+
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}
105+
106+
- name: Start core
107+
run: docker compose up --wait
108+
working-directory: supertokens-web-js
109+
env:
110+
SUPERTOKENS_CORE_VERSION: ${{ steps.core-version.outputs.coreVersionXy }}
111+
112+
- uses: supertokens/auth-react-testing-action@main
113+
name: test ${{ matrix.spec }} for ${{ inputs.fdi-version }}
114+
with:
115+
fdi-version: ${{ inputs.fdi-version }}
116+
check-name-suffix: "[FDI=${{ inputs.fdi-version }}][Spec=${{ matrix.spec }}]"
117+
path: supertokens-auth-react
118+
spec: ${{ matrix.spec }}
119+
retrieve-workspace: "false"

0 commit comments

Comments
 (0)