Skip to content
Merged
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
39 changes: 39 additions & 0 deletions .github/workflows/base-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
workflow_call:

jobs:
build:
# if: ${{ github.repository == 'clerkinc/javascript' }}
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Build
run: npm run build
- name: Upload package artifacts
uses: actions/upload-artifact@v3
with:
name: package-artifacts
path: ./node_modules/.cache/turbo
retention-days: 1
- name: Configure npm to use Verdaccio
run: |
npm set registry http://localhost:4873/
nohup ./node_modules/.bin/verdaccio --config ./verdaccio.publish.yaml &
sleep 5
./node_modules/.bin/npm-cli-adduser -u user -p pass -e test@test.com -r http://localhost:4873/
./node_modules/.bin/npm-cli-login -u user -p pass -e test@test.com -r http://localhost:4873/
- name: Publish to Verdaccio
# The command below includes a sanity check
# and fails early if the default npm registry is used
run: |
npm run release:verdaccio
- name: List published packages
run: |
ls -all .verdaccio/storage/@clerk
- uses: actions/upload-artifact@v3
with:
name: verdaccio
path: .verdaccio
15 changes: 15 additions & 0 deletions .github/workflows/base-changeset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
workflow_call:

jobs:
check:
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.sha}}
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
- run: npx changeset status --since=origin/main
62 changes: 62 additions & 0 deletions .github/workflows/base-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Integration reusable workflow
on:
workflow_call:
inputs:
SCRIPT:
required: true
type: string
secrets:
INTEGRATION_INSTANCE_KEYS:
required: true
MAILSAC_API_KEY:
required: true

jobs:
run:
continue-on-error: true
timeout-minutes: 60
runs-on: ${{ vars.RUNNER_LARGE }}
concurrency:
group: integration-${{ github.ref }}-${{ inputs.script }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright Browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Download Verdaccio artifacts
uses: actions/download-artifact@v3
with:
name: verdaccio
path: .verdaccio
- name: Run Verdaccio
run: |
npm set registry http://localhost:4873/
nohup ./node_modules/.bin/verdaccio --config ./verdaccio.install.yaml &
sleep 5
- name: Install @clerk/backend in /integration
run: |
cd integration && npm init -y && npm install @clerk/backend && cd ..
- name: Run Playwright tests
run: ${{ inputs.SCRIPT }}
env:
INTEGRATION_INSTANCE_KEYS: ${{ secrets.INTEGRATION_INSTANCE_KEYS }}
MAILSAC_API_KEY: ${{ secrets.MAILSAC_API_KEY }}
E2E_CLERK_VERSION: 'latest'
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
13 changes: 13 additions & 0 deletions .github/workflows/base-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
workflow_call:

jobs:
check:
continue-on-error: true
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- run: npm run lint
12 changes: 12 additions & 0 deletions .github/workflows/base-prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on:
workflow_call:

jobs:
check:
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- run: npm run format:check
34 changes: 34 additions & 0 deletions .github/workflows/base-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
workflow_call:

jobs:
registry:
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Download turbo cache
uses: actions/download-artifact@v3
with:
name: package-artifacts
path: ./node_modules/.cache/turbo
- name: Configure npm to use Verdaccio
run: |
npm set registry http://localhost:4873/
nohup ./node_modules/.bin/verdaccio --config ./verdaccio.publish.yaml &
sleep 5
./node_modules/.bin/npm-cli-adduser -u user -p pass -e test@test.com -r http://localhost:4873/
./node_modules/.bin/npm-cli-login -u user -p pass -e test@test.com -r http://localhost:4873/
- name: Publish to Verdaccio
# The command below includes a sanity check
# and fails early if the default npm registry is used
run: |
npm run release:verdaccio
- name: List published packages
run: |
ls -all .verdaccio/storage/@clerk
- uses: actions/upload-artifact@v3
with:
name: verdaccio
path: .verdaccio
104 changes: 104 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Quality checks and tests
on:
pull_request:
branches: [ main ]

concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: true

jobs:
prettier:
name: Prettier
uses: ./.github/workflows/base-prettier.yml

eslint:
name: Eslint
uses: ./.github/workflows/base-lint.yml

changeset:
name: Require changeset
uses: ./.github/workflows/base-changeset.yml

build:
if: ${{ github.repository == 'clerkinc/javascript' }}
name: Build & publish
needs: [ prettier, changeset ]
uses: ./.github/workflows/base-build.yml

unit-tests:
name: Run unit tests
needs: build
runs-on: ${{ vars.RUNNER_LARGE }}
strategy:
matrix:
node-version: [ 18, 19 ]
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Download turbo cache
uses: actions/download-artifact@v3
with:
name: package-artifacts
path: ./node_modules/.cache/turbo
- name: Run tests
run: npm run test:ci

publint:
name: Run publint
needs: build
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Download turbo cache
uses: actions/download-artifact@v3
with:
name: package-artifacts
path: ./node_modules/.cache/turbo
- name: Lint packages using publint
run: npm run lint:publint

attw:
name: Run attw
needs: build
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Download turbo cache
uses: actions/download-artifact@v3
with:
name: package-artifacts
path: ./node_modules/.cache/turbo
- name: Lint types using attw
# Remove this when all related errors are fixed
continue-on-error: true
run: npm run lint:attw

integration-generic:
name: Integration (Generic)
needs: build
uses: ./.github/workflows/base-e2e.yml
with:
SCRIPT: 'npm run test:integration:generic'
secrets: inherit

integration-nextjs:
name: Integration (NextJS)
needs: build
uses: ./.github/workflows/base-e2e.yml
with:
SCRIPT: 'npm run test:integration:nextjs'
secrets: inherit

integration-remix:
name: Integration (Remix)
needs: build
uses: ./.github/workflows/base-e2e.yml
with:
SCRIPT: 'npm run test:integration:remix'
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- uses: actions/labeler@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lock-threads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:

jobs:
action:
runs-on: ubuntu-latest
runs-on: ${{ vars.RUNNER_NORMAL }}
steps:
- uses: actions/stale@v8
with:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/nightly-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Nightly upstream tests
on:
workflow_dispatch:
schedule:
- cron: '0 7 * * *'

jobs:
build:
name: Build packages and upload artifacts
uses: ./.github/workflows/base-build.yml

integration-nextjs:
name: Integration (NextJS canary)
needs: build
uses: ./.github/workflows/base-e2e.yml
with:
SCRIPT: 'E2E_NEXTJS_VERSION=canary npm run test:integration:nextjs'
secrets: inherit

notify-slack:
name: Notify Slack
needs: integration-nextjs
if: ${{ contains(needs.*.result, 'failure') }}
runs-on: ${{ vars.RUNNER_LARGE }}
steps:
- name: Report Status
uses: ravsamhq/notify-slack-action@v1
with:
status: 'failure'
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SDK_E2E_ALERTS_WEBHOOK_URL }}
Loading