Skip to content

Commit d2a0ba4

Browse files
feat: dev and release pipelines (#590)
* feat: adds draft of workflows * update: enable auth-react * feat: migrates dev and release tag steps * fix: mark as success http method * feat: setup testable pipelines * fix: minor issues with workflows * update: move tests to commit, simplify pipelines * update: backend-sdk-testing to match webauthn branch * update: remove placeholder step - Required only in workflow calls * update: enable steps, add option to skip tests check * fix: add steps to lint-code workflow * update: adds publish doc job * feat: adds app server log dir for website tests * Apply suggestions from code review Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * fix: remove backtick Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * fix: backticks, conditionals * update: use new PAT * feat: adds concurrency limits to test workflows - Ensures that only the last instance of the workflow on a ref runs - Cancels previous workflows - Useful in PRs where multiple commits might be pushed in succession * update: cleanup comment * fix: minor syntax issues * fix: minor syntax issues * update: docs workflow stage to prod --------- Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
1 parent 1d431dc commit d2a0ba4

12 files changed

+578
-49
lines changed

.github/workflows/auth-react-test-1-django.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ on:
77
- reopened
88
- synchronize
99
push:
10-
branches:
11-
- master
12-
- "v[0-9]+.[0-9]+"
1310
tags:
14-
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
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
1518

1619
jobs:
1720
define-versions:
@@ -22,6 +25,7 @@ jobs:
2225
pyVersions: '["3.8", "3.13"]'
2326
steps:
2427
- uses: actions/checkout@v4
28+
2529
- uses: supertokens/get-supported-versions-action@main
2630
id: versions
2731
with:

.github/workflows/auth-react-test-1-fastapi.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ on:
77
- reopened
88
- synchronize
99
push:
10-
branches:
11-
- master
12-
- "v[0-9]+.[0-9]+"
1310
tags:
14-
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
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
1518

1619
jobs:
1720
define-versions:
@@ -22,6 +25,7 @@ jobs:
2225
pyVersions: '["3.8", "3.13"]'
2326
steps:
2427
- uses: actions/checkout@v4
28+
2529
- uses: supertokens/get-supported-versions-action@main
2630
id: versions
2731
with:

.github/workflows/auth-react-test-1-flask.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ on:
77
- reopened
88
- synchronize
99
push:
10-
branches:
11-
- master
12-
- "v[0-9]+.[0-9]+"
1310
tags:
14-
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
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
1518

1619
jobs:
1720
define-versions:
@@ -22,6 +25,7 @@ jobs:
2225
pyVersions: '["3.8", "3.13"]'
2326
steps:
2427
- uses: actions/checkout@v4
28+
2529
- uses: supertokens/get-supported-versions-action@main
2630
id: versions
2731
with:

.github/workflows/auth-react-test-3.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
steps:
6868
- uses: actions/checkout@v4
6969
with:
70+
# Checking out to a custom path since the test repo will also be cloned
7071
path: supertokens-python
7172

7273
- uses: actions/setup-python@v5

.github/workflows/backend-sdk-testing.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ on:
77
- reopened
88
- synchronize
99
push:
10-
branches:
11-
- master
12-
- "v[0-9]+.[0-9]+"
1310
tags:
14-
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
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
1518

1619
jobs:
1720
define-versions:
@@ -23,6 +26,7 @@ jobs:
2326
nodeVersions: '["20"]'
2427
steps:
2528
- uses: actions/checkout@v4
29+
2630
- uses: supertokens/get-supported-versions-action@main
2731
id: versions
2832
with:
@@ -82,10 +86,11 @@ jobs:
8286
run: |
8387
source venv/bin/activate
8488
docker compose up --build --wait
85-
python3 tests/test-server/app.py &
89+
python3 tests/test-server/app.py &> python.log &
8690
8791
- uses: supertokens/backend-sdk-testing-action@main
8892
with:
8993
version: ${{ matrix.fdi-version }}
9094
check-name-suffix: '[CDI=${{ matrix.cdi-version }}][Core=${{ steps.versions.outputs.coreVersionXy }}][FDI=${{ matrix.fdi-version }}][Py=${{ matrix.py-version }}][Node=${{ matrix.node-version }}]'
9195
path: backend-sdk-testing
96+
app-server-logs: ${{ github.workspace }}/supertokens-python/python.log

.github/workflows/lint-code.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,26 @@ on:
77
- reopened
88
- synchronize
99
push:
10-
branches:
11-
- master
12-
- "v[0-9]+.[0-9]+"
1310
tags:
14-
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
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
1518

1619
jobs:
1720
define-versions:
1821
runs-on: ubuntu-latest
1922
outputs:
2023
pyVersions: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]'
2124

25+
steps:
26+
# Required to avoid errors in runs due to no steps
27+
- name: Placeholder
28+
run: echo "Placeholder"
29+
2230
lint-format:
2331
name: Check linting and formatting
2432
runs-on: ubuntu-latest
@@ -28,15 +36,18 @@ jobs:
2836
py-version: ${{ fromJSON(needs.define-versions.outputs.pyVersions) }}
2937
steps:
3038
- uses: actions/checkout@v4
39+
3140
- uses: actions/setup-python@v5
3241
with:
3342
python-version: ${{ matrix.py-version }}
43+
3444
- name: Create virtual environment and install dependencies
3545
run: |
3646
python3 -m venv venv
3747
source venv/bin/activate
3848
python3 -m pip install pip setuptools --upgrade
3949
make dev-install && rm -rf src
50+
4051
- name: Run checks
4152
# New steps require sourcing the venv again
4253
run: |

.github/workflows/lint-pr.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
- edited
99
- synchronize
1010

11+
# Only one instance of this workflow will run on the same ref (PR/Branch/Tag)
12+
# Previous runs will be cancelled.
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
1117
jobs:
1218
lint-pr-title:
1319
name: Lint PR Title
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: "Dev Tag Pipeline"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: The branch to create the dev tag on
8+
type: string
9+
required: true
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
setup:
16+
runs-on: ubuntu-latest
17+
18+
outputs:
19+
constantsVersion: ${{ steps.versions.outputs.constantsVersion }}
20+
constantsVersionXy: ${{ steps.versions.outputs.constantsVersionXy }}
21+
setupVersion: ${{ steps.versions.outputs.setupVersion }}
22+
setupVersionXy: ${{ steps.versions.outputs.setupVersionXy }}
23+
newestVersion: ${{ steps.versions.outputs.newestVersion }}
24+
targetBranch: ${{ steps.versions.outputs.targetBranch }}
25+
devTag: ${{ steps.versions.outputs.devTag }}
26+
releaseTag: ${{ steps.versions.outputs.releaseTag }}
27+
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
ref: ${{ inputs.branch }}
33+
# Need a complete fetch to make the master merge check work
34+
fetch-depth: 0
35+
fetch-tags: true
36+
token: ${{ secrets.ALL_REPO_PAT }}
37+
38+
39+
- name: Setup git
40+
run: |
41+
# NOTE: The user email is {user.id}+{user.login}@users.noreply.github.com.
42+
# See users API: https://api.github.com/users/github-actions%5Bbot%5D
43+
git config user.name "github-actions[bot]"
44+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
45+
46+
git fetch origin master
47+
- name: Check if branch needs master merge
48+
run: |
49+
if [[ $(git log origin/master ^HEAD) != "" ]]; then
50+
echo "You need to merge master into this branch."
51+
exit 1
52+
fi
53+
54+
- name: Populate variables
55+
id: versions
56+
run: |
57+
. ./hooks/populate-hook-constants.sh
58+
59+
echo "constantsVersion=$constantsVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
60+
echo "constantsVersionXy=$constantsVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
61+
echo "setupVersion=$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
62+
echo "setupVersionXy=$setupVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
63+
echo "newestVersion=$newestVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
64+
echo "targetBranch=$targetBranch" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
65+
66+
echo "devTag=dev-v$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
67+
echo "releaseTag=v$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
68+
69+
- name: Check tag and branch correctness
70+
run: |
71+
if [[ "${{ steps.versions.outputs.setupVersion }}" != ${{ inputs.branch }}* ]]
72+
then
73+
echo "Adding tag to wrong branch"
74+
exit 1
75+
fi
76+
77+
if git rev-parse ${{ steps.versions.outputs.releaseTag }} >/dev/null 2>&1
78+
then
79+
echo "The released version of this tag already exists."
80+
exit 1
81+
fi
82+
83+
- name: Delete tag if already tagged
84+
run: |
85+
git tag --delete ${{ steps.versions.outputs.devTag }} || true
86+
git push --delete origin ${{ steps.versions.outputs.devTag }} || true
87+
88+
- name: Install dependencies
89+
run: make dev-install
90+
91+
- name: Build docs
92+
run: make build-docs
93+
94+
- name: Commit doc changes
95+
run: |
96+
git add --all
97+
git commit --allow-empty -nm "doc: update docs for ${{ steps.versions.outputs.releaseTag }} tag"
98+
git push
99+
100+
- name: Create and push tag
101+
run: |
102+
# NOTE: The user email is {user.id}+{user.login}@users.noreply.github.com.
103+
# See users API: https://api.github.com/users/github-actions%5Bbot%5D
104+
git config user.name "github-actions[bot]"
105+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
106+
107+
git tag ${{ steps.versions.outputs.devTag }}
108+
git push --tags --follow-tags
109+
110+
mark-dev-tag-as-not-passed:
111+
runs-on: ubuntu-latest
112+
needs:
113+
- setup
114+
115+
steps:
116+
- uses: actions/checkout@v4
117+
with:
118+
ref: ${{ needs.setup.outputs.devTag }}
119+
fetch-tags: true
120+
121+
- id: versions
122+
uses: supertokens/get-supported-versions-action@main
123+
with:
124+
has-cdi: true
125+
has-fdi: true
126+
127+
- run: |
128+
./hooks/populate-hook-constants.sh
129+
130+
curl --fail-with-body -X PUT \
131+
https://api.supertokens.io/0/driver \
132+
-H 'Content-Type: application/json' \
133+
-H 'api-version: 0' \
134+
-d "{
135+
\"password\": \"${{ secrets.SUPERTOKENS_API_KEY }}\",
136+
\"version\":\"${{ needs.setup.outputs.setupVersion }}\",
137+
\"name\": \"python\",
138+
\"frontendDriverInterfaces\": ${{ steps.versions.outputs.fdiVersions }},
139+
\"coreDriverInterfaces\": ${{ steps.versions.outputs.cdiVersions }}
140+
}"

0 commit comments

Comments
 (0)