Skip to content

feat: dev and release pipelines #590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: 0.29
Choose a base branch
from
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
6 changes: 2 additions & 4 deletions .github/workflows/auth-react-test-1-django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ on:
- reopened
- synchronize
push:
branches:
- master
- "v[0-9]+.[0-9]+"
tags:
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
- dev-v[0-9]+.[0-9]+.[0-9]+

jobs:
define-versions:
Expand All @@ -22,6 +19,7 @@ jobs:
pyVersions: '["3.8", "3.13"]'
steps:
- uses: actions/checkout@v4

- uses: supertokens/get-supported-versions-action@main
id: versions
with:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/auth-react-test-1-fastapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ on:
- reopened
- synchronize
push:
branches:
- master
- "v[0-9]+.[0-9]+"
tags:
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
- dev-v[0-9]+.[0-9]+.[0-9]+

jobs:
define-versions:
Expand All @@ -22,6 +19,7 @@ jobs:
pyVersions: '["3.8", "3.13"]'
steps:
- uses: actions/checkout@v4

- uses: supertokens/get-supported-versions-action@main
id: versions
with:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/auth-react-test-1-flask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ on:
- reopened
- synchronize
push:
branches:
- master
- "v[0-9]+.[0-9]+"
tags:
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
- dev-v[0-9]+.[0-9]+.[0-9]+

jobs:
define-versions:
Expand All @@ -22,6 +19,7 @@ jobs:
pyVersions: '["3.8", "3.13"]'
steps:
- uses: actions/checkout@v4

- uses: supertokens/get-supported-versions-action@main
id: versions
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/auth-react-test-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
# Checking out to a custom path since the test repo will also be cloned
path: supertokens-python

- uses: actions/setup-python@v5
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/backend-sdk-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ on:
- reopened
- synchronize
push:
branches:
- master
- "v[0-9]+.[0-9]+"
tags:
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
- dev-v[0-9]+.[0-9]+.[0-9]+

jobs:
define-versions:
Expand All @@ -23,6 +20,7 @@ jobs:
nodeVersions: '["20"]'
steps:
- uses: actions/checkout@v4

- uses: supertokens/get-supported-versions-action@main
id: versions
with:
Expand Down Expand Up @@ -82,10 +80,11 @@ jobs:
run: |
source venv/bin/activate
docker compose up --build --wait
python3 tests/test-server/app.py &
python3 tests/test-server/app.py &> python.log &

- uses: supertokens/backend-sdk-testing-action@main
with:
version: ${{ matrix.fdi-version }}
check-name-suffix: '[CDI=${{ matrix.cdi-version }}][Core=${{ steps.versions.outputs.coreVersionXy }}][FDI=${{ matrix.fdi-version }}][Py=${{ matrix.py-version }}][Node=${{ matrix.node-version }}]'
path: backend-sdk-testing
app-server-logs: ${{ github.workspace }}/supertokens-python/python.log
13 changes: 9 additions & 4 deletions .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ on:
- reopened
- synchronize
push:
branches:
- master
- "v[0-9]+.[0-9]+"
tags:
- "(dev-)?v[0-9]+.[0-9]+.[0-9]+"
- dev-v[0-9]+.[0-9]+.[0-9]+

jobs:
define-versions:
runs-on: ubuntu-latest
outputs:
pyVersions: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]'

steps:
# Required to avoid errors in runs due to no steps
- name: Placeholder
run: echo "Placeholder"

lint-format:
name: Check linting and formatting
runs-on: ubuntu-latest
Expand All @@ -28,15 +30,18 @@ jobs:
py-version: ${{ fromJSON(needs.define-versions.outputs.pyVersions) }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py-version }}

- name: Create virtual environment and install dependencies
run: |
python3 -m venv venv
source venv/bin/activate
python3 -m pip install pip setuptools --upgrade
make dev-install && rm -rf src

- name: Run checks
# New steps require sourcing the venv again
run: |
Expand Down
140 changes: 140 additions & 0 deletions .github/workflows/pipeline-dev-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: "Dev Tag Pipeline"

on:
workflow_dispatch:
inputs:
branch:
description: The branch to create the dev tag on
type: string
required: true

permissions:
contents: write

jobs:
setup:
runs-on: ubuntu-latest

outputs:
constantsVersion: ${{ steps.versions.outputs.constantsVersion }}
constantsVersionXy: ${{ steps.versions.outputs.constantsVersionXy }}
setupVersion: ${{ steps.versions.outputs.setupVersion }}
setupVersionXy: ${{ steps.versions.outputs.setupVersionXy }}
newestVersion: ${{ steps.versions.outputs.newestVersion }}
targetBranch: ${{ steps.versions.outputs.targetBranch }}
devTag: ${{ steps.versions.outputs.devTag }}
releaseTag: ${{ steps.versions.outputs.releaseTag }}


steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
# Need a complete fetch to make the master merge check work
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.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
- name: Check if branch needs master merge
run: |
if [[ $(git log origin/master ^HEAD) != "" ]]; then
echo "You need to merge master into this branch."
exit 1
fi

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

echo "constantsVersion=$constantsVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "constantsVersionXy=$constantsVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "setupVersion=$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "setupVersionXy=$setupVersionXy" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "newestVersion=$newestVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "targetBranch=$targetBranch" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"

echo "devTag=dev-v$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"
echo "releaseTag=v$setupVersion" | tee -a "$GITHUB_OUTPUT" "$GITHUB_ENV"

- name: Check tag and branch correctness
run: |
if [[ "${{ steps.versions.outputs.setupVersion }}" != ${{ inputs.branch }}* ]]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branch input in the condition is missing quotes, which could lead to shell expansion issues if the branch name contains special characters. Consider updating to:

if [[ "${{ steps.versions.outputs.setupVersion }}" != "${{ inputs.branch }}"* ]]

This ensures proper string comparison regardless of what characters might be in the branch name.

Suggested change
if [[ "${{ steps.versions.outputs.setupVersion }}" != ${{ inputs.branch }}* ]]
if [[ "${{ steps.versions.outputs.setupVersion }}" != "${{ inputs.branch }}"* ]]

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

then
echo "Adding tag to wrong branch"
exit 1
fi

if git rev-parse ${{ steps.versions.outputs.releaseTag }} >/dev/null 2>&1
then
echo "The released version of this tag already exists."
exit 1
fi

- name: Delete tag if already tagged
run: |
git tag --delete ${{ steps.versions.outputs.devTag }} || true
git push --delete origin ${{ steps.versions.outputs.devTag }} || true

- name: Install dependencies
run: make dev-install

- name: Build docs
run: make build-docs

- name: Commit doc changes
run: |
git add --all
git commit --allow-empty -nm "doc: update docs for ${{ steps.versions.outputs.releaseTag }} tag"
git push

- name: Create and push tag
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 tag ${{ steps.versions.outputs.devTag }}
git push --tags --follow-tags

mark-dev-tag-as-not-passed:
runs-on: ubuntu-latest
needs:
- setup

steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.setup.outputs.devTag }}
fetch-tags: true

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

- run: |
./hooks/populate-hook-constants.sh

curl --fail-with-body -X PUT \
https://api.supertokens.io/0/driver \
-H 'Content-Type: application/json' \
-H 'api-version: 0' \
-d "{
\"password\": \"${{ secrets.SUPERTOKENS_API_KEY }}\",
\"version\":\"${{ needs.setup.outputs.setupVersion }}\",
\"name\": \"python\",
\"frontendDriverInterfaces\": ${{ steps.versions.outputs.fdiVersions }},
\"coreDriverInterfaces\": ${{ steps.versions.outputs.cdiVersions }}
}"
Loading
Loading