From 30024b5212cdb75bf5b7ac4d3d32efc2dad6e6a0 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Thu, 19 Oct 2023 22:36:26 -0400 Subject: [PATCH 01/16] build(repo): Test change --- .changeset/big-files-tickle.md | 2 ++ .github/workflows/ci.yml | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 .changeset/big-files-tickle.md diff --git a/.changeset/big-files-tickle.md b/.changeset/big-files-tickle.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/big-files-tickle.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eda022c7e26..becd988c891 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,11 +5,9 @@ on: merge_group: pull_request: branches: - - main - build/turbo-ci-poc env: NODE_VERSION: '18' - SINCE_BRANCH: 'build/turbo-ci-poc' # origin/main concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -36,12 +34,12 @@ jobs: with: cache-prefix: turbo- - - name: Require Changeset - run: if [ "${{ github.event.pull_request.user.login }}" = "clerk-cookie" ]; then echo 'Skipping' && exit 0; else npx changeset status --since=${{ env.SINCE_BRANCH }}; fi - - name: Install NPM Dependencies run: npm ci --audit=false --fund=false + - name: Require Changeset + run: if [ "${{ github.event.pull_request.user.login }}" = "clerk-cookie" ]; then echo 'Skipping' && exit 0; else npx changeset status --since=origin/main; fi + - name: Check Formatting run: npm run format:check From 8113b5ce90ebdc51619fb3aa3dd044c892884ec9 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Thu, 19 Oct 2023 23:00:45 -0400 Subject: [PATCH 02/16] build(repo): Add unit tests --- .github/workflows/ci.yml | 42 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index becd988c891..5e868b7930a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,30 +53,30 @@ jobs: - name: Run lint run: npm run lint -- --output-logs=errors-only -- --quiet - # unit-tests: - # name: Unit Tests - # needs: formatting-linting - # runs-on: ${{ vars.RUNNER_LARGE }} - # strategy: - # matrix: - # node-version: [ 18, 19 ] - # steps: - # - name: Checkout Repo - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 + unit-tests: + name: Unit Tests + needs: formatting-linting + runs-on: ${{ vars.RUNNER_LARGE }} + strategy: + matrix: + node-version: [ 18 ] # [ 18, 19 ] + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 - # - name: Setup NodeJS ${{ matrix.node-version }} - # uses: actions/setup-node@v3 - # with: - # node-version: ${{ matrix.node-version }} - # cache: "npm" + - name: Setup NodeJS ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" - # - name: Install NPM Dependencies - # run: npm ci --audit=false --fund=false + - name: Install NPM Dependencies + run: npm ci --audit=false --fund=false - # - name: Run tests - # run: npm run test:ci + - name: Run tests + run: npm run test:ci # integration-tests: # name: Integration Tests From ea83f05770c4713e98b75460c01e75111d5c6080 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Thu, 19 Oct 2023 23:14:15 -0400 Subject: [PATCH 03/16] build(repo): Update cache dirs --- .github/workflows/ci.yml | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e868b7930a..c5e7d3078b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,8 @@ on: - build/turbo-ci-poc env: NODE_VERSION: '18' + TURBO_CACHE_DIR: ./.turbo-cache + TURBO_CACHE_PREFIX: turbo- concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -27,14 +29,21 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} - cache: "npm" - name: Turborepo Remote Server uses: dtinth/setup-github-actions-caching-for-turbo@v1 with: - cache-prefix: turbo- + cache-prefix: ${{ env.TURBO_CACHE_PREFIX }} + + - name: Cache node modules + uses: actions/cache@v3 + id: npm-cache + with: + path: ./node_modules + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-node-modules-${{ hashFiles('**/package-lock.json') }} - name: Install NPM Dependencies + if: steps.npm-cache.outputs.cache-hit != 'true' run: npm ci --audit=false --fund=false - name: Require Changeset @@ -44,14 +53,14 @@ jobs: run: npm run format:check - name: Lint packages using publint - run: npm run lint:publint + run: npm run lint:publint -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} - name: Lint types using attw - run: npm run lint:attw + run: npm run lint:attw -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} continue-on-error: true # TODO: Remove this when all related errors are fixed - name: Run lint - run: npm run lint -- --output-logs=errors-only -- --quiet + run: npm run lint -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} -- --quiet unit-tests: name: Unit Tests @@ -70,13 +79,25 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: "npm" + + - name: Turborepo Remote Server + uses: dtinth/setup-github-actions-caching-for-turbo@v1 + with: + cache-prefix: ${{ env.TURBO_CACHE_PREFIX }} + + - name: Cache node modules + uses: actions/cache@v3 + id: npm-cache + with: + path: ./node_modules + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-node-modules-${{ hashFiles('**/package-lock.json') }} - name: Install NPM Dependencies + if: steps.npm-cache.outputs.cache-hit != 'true' run: npm ci --audit=false --fund=false - name: Run tests - run: npm run test:ci + run: npm run test:ci -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} # integration-tests: # name: Integration Tests From 93891344750989e85b77b2ee0669691ee896651e Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 20 Oct 2023 00:04:12 -0400 Subject: [PATCH 04/16] build(repo): Add Node v19 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5e7d3078b4..58933f21a35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: runs-on: ${{ vars.RUNNER_LARGE }} strategy: matrix: - node-version: [ 18 ] # [ 18, 19 ] + node-version: [ 18, 19 ] steps: - name: Checkout Repo uses: actions/checkout@v3 From 92c2f16925894a7e02656f27d723d53f6f983b96 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 20 Oct 2023 00:25:52 -0400 Subject: [PATCH 05/16] build(repo): Attempt e2e --- .github/workflows/ci.yml | 147 ++++++++++++++++++++++----------------- package-lock.json | 25 +++---- package.json | 1 + 3 files changed, 97 insertions(+), 76 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58933f21a35..568b95811b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,7 @@ jobs: formatting-linting: name: Formatting & Linting runs-on: ${{ vars.RUNNER_LARGE }} + steps: - name: Checkout Repo uses: actions/checkout@v3 @@ -66,9 +67,11 @@ jobs: name: Unit Tests needs: formatting-linting runs-on: ${{ vars.RUNNER_LARGE }} + strategy: matrix: node-version: [ 18, 19 ] + steps: - name: Checkout Repo uses: actions/checkout@v3 @@ -99,67 +102,83 @@ jobs: - name: Run tests run: npm run test:ci -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} - # integration-tests: - # name: Integration Tests - # needs: formatting-linting - # runs-on: ${{ vars.RUNNER_LARGE }} - # strategy: - # matrix: - # test-name: [ 'generic', 'nextjs', 'remix' ] - # services: - # verdaccio: - # image: verdaccio/verdaccio:5 - # ports: - # - 4873:4873 - # steps: - # - name: Checkout Repo - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - - # - name: Setup NodeJS ${{ env.NODE_VERSION }} - # uses: actions/setup-node@v3 - # with: - # node-version: ${{ env.NODE_VERSION }} - # cache: "npm" - - # - name: Install NPM Dependencies - # run: | - # npm ci --audit=false --fund=false - # npm set @clerk:registry http://localhost:4873/ - - # - name: Get Playwright Version - # id: playwright-version - # run: echo "VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> "$GITHUB_OUTPUT" - - # - name: Cache Playwright Binaries - # uses: actions/cache@v3 - # id: playwright-cache - # with: - # path: ~/.cache/ms-playwright - # key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.VERSION }}}} - - # - name: Install Playwright Browsers - # if: steps.playwright-cache.outputs.cache-hit != 'true' - # run: npx playwright install --with-deps - - # - name: Publish to Verdaccio - # run: npm run release:verdaccio # Fails early if the default npm registry is used - - # - name: Install @clerk/backend in /integration - # run: (cd integration && npm init -y && npm install @clerk/backend) - - # - name: Run Playwright tests - # run: 'npm run test:integration:${{ matrix.test-name }}' - # env: - # INTEGRATION_INSTANCE_KEYS: ${{ secrets.INTEGRATION_INSTANCE_KEYS }} - # MAILSAC_API_KEY: ${{ secrets.MAILSAC_API_KEY }} - # E2E_CLERK_VERSION: 'latest' - - # - name: Upload Playwright Report for ${{ matrix.test-name }} - # uses: actions/upload-artifact@v3 - # if: always() - # with: - # name: playwright-report-${{ matrix.test-name }} - # path: playwright-report/ - # retention-days: 30 + integration-tests: + name: Integration Tests + needs: formatting-linting + runs-on: ${{ vars.RUNNER_LARGE }} + + strategy: + matrix: + test-name: [ 'generic', 'nextjs', 'remix' ] + + services: + verdaccio: + image: verdaccio/verdaccio:5 + ports: + - 4873:4873 + + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup NodeJS ${{ env.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Turborepo Remote Server + uses: dtinth/setup-github-actions-caching-for-turbo@v1 + with: + cache-prefix: ${{ env.TURBO_CACHE_PREFIX }} + + - name: Cache node modules + uses: actions/cache@v3 + id: npm-cache + with: + path: ./node_modules + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-node-modules-${{ hashFiles('**/package-lock.json') }} + + - name: Install NPM Dependencies + if: steps.npm-cache.outputs.cache-hit != 'true' + run: npm ci --audit=false --fund=false + + - name: Update NPM Registry + run: npm set registry http://localhost:4873/ + + - name: Get Playwright Version + id: playwright-version + run: echo "VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> "$GITHUB_OUTPUT" + + - name: Cache Playwright Binaries + uses: actions/cache@v3 + id: playwright-cache + with: + path: ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.VERSION }} + + - name: Install Playwright Browsers + if: steps.playwright-cache.outputs.cache-hit != 'true' + run: npx playwright install --with-deps + + - name: Publish to Verdaccio + run: npm run release:verdaccio # Fails early if the default npm registry is used + + - name: Install @clerk/backend in /integration + run: (cd integration && npm init -y && npm install @clerk/backend) + + - name: Run Playwright tests + run: npm run test:integration:${{ matrix.test-name }} + env: + INTEGRATION_INSTANCE_KEYS: ${{ secrets.INTEGRATION_INSTANCE_KEYS }} + MAILSAC_API_KEY: ${{ secrets.MAILSAC_API_KEY }} + E2E_CLERK_VERSION: 'latest' + + - name: Upload Playwright Report for ${{ matrix.test-name }} + uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report-${{ github.ref }}-${{ matrix.test-name }} + path: playwright-report/ + retention-days: 30 diff --git a/package-lock.json b/package-lock.json index 4bb590f1c5a..3be6b897c60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@commitlint/config-conventional": "^17.7.0", "@emotion/jest": "^11.11.0", "@faker-js/faker": "^8.1.0", + "@playwright/test": "^1.39.0", "@testing-library/dom": "^8.19.0", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", @@ -68,6 +69,7 @@ }, "integration": { "version": "0.0.0", + "extraneous": true, "license": "MIT", "devDependencies": { "@playwright/test": "^1.38.1", @@ -7056,11 +7058,12 @@ } }, "node_modules/@playwright/test": { - "version": "1.38.1", + "version": "1.39.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.39.0.tgz", + "integrity": "sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "playwright": "1.38.1" + "playwright": "1.39.0" }, "bin": { "playwright": "cli.js" @@ -19017,10 +19020,6 @@ "dev": true, "license": "0BSD" }, - "node_modules/integration": { - "resolved": "integration", - "link": true - }, "node_modules/internal-slot": { "version": "1.0.5", "license": "MIT", @@ -25333,11 +25332,12 @@ "license": "MIT" }, "node_modules/playwright": { - "version": "1.38.1", + "version": "1.39.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz", + "integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.38.1" + "playwright-core": "1.39.0" }, "bin": { "playwright": "cli.js" @@ -25350,9 +25350,10 @@ } }, "node_modules/playwright-core": { - "version": "1.38.1", + "version": "1.39.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz", + "integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw==", "dev": true, - "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, diff --git a/package.json b/package.json index 3ab56242dc7..c9ebe299951 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "@commitlint/config-conventional": "^17.7.0", "@emotion/jest": "^11.11.0", "@faker-js/faker": "^8.1.0", + "@playwright/test": "^1.39.0", "@testing-library/dom": "^8.19.0", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", From 581e07afc842c50ca7c6a6638ebd503f47d978c3 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 20 Oct 2023 03:07:12 -0400 Subject: [PATCH 06/16] build(repo): Use Verdaccio .bin file --- .github/workflows/ci.yml | 34 ++++++++++++++++------------------ verdaccio.yaml | 16 ++++++++++++++++ 2 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 verdaccio.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 568b95811b3..4c4c5fa703d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: with: cache-prefix: ${{ env.TURBO_CACHE_PREFIX }} - - name: Cache node modules + - name: Cache node_modules uses: actions/cache@v3 id: npm-cache with: @@ -88,7 +88,7 @@ jobs: with: cache-prefix: ${{ env.TURBO_CACHE_PREFIX }} - - name: Cache node modules + - name: Cache node_modules uses: actions/cache@v3 id: npm-cache with: @@ -111,12 +111,6 @@ jobs: matrix: test-name: [ 'generic', 'nextjs', 'remix' ] - services: - verdaccio: - image: verdaccio/verdaccio:5 - ports: - - 4873:4873 - steps: - name: Checkout Repo uses: actions/checkout@v3 @@ -133,7 +127,7 @@ jobs: with: cache-prefix: ${{ env.TURBO_CACHE_PREFIX }} - - name: Cache node modules + - name: Cache node_modules uses: actions/cache@v3 id: npm-cache with: @@ -147,6 +141,9 @@ jobs: - name: Update NPM Registry run: npm set registry http://localhost:4873/ + - name: Run Verdaccio + run: nohup ./node_modules/.bin/verdaccio --config ./verdaccio.yaml & sleep 5 + - name: Get Playwright Version id: playwright-version run: echo "VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> "$GITHUB_OUTPUT" @@ -156,7 +153,7 @@ jobs: id: playwright-cache with: path: ~/.cache/ms-playwright - key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.VERSION }} + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-playwright-${{ steps.playwright-version.outputs.VERSION }} - name: Install Playwright Browsers if: steps.playwright-cache.outputs.cache-hit != 'true' @@ -166,7 +163,8 @@ jobs: run: npm run release:verdaccio # Fails early if the default npm registry is used - name: Install @clerk/backend in /integration - run: (cd integration && npm init -y && npm install @clerk/backend) + working-directory: ./integration + run: npm init -y && npm install @clerk/backend - name: Run Playwright tests run: npm run test:integration:${{ matrix.test-name }} @@ -175,10 +173,10 @@ jobs: MAILSAC_API_KEY: ${{ secrets.MAILSAC_API_KEY }} E2E_CLERK_VERSION: 'latest' - - name: Upload Playwright Report for ${{ matrix.test-name }} - uses: actions/upload-artifact@v3 - if: always() - with: - name: playwright-report-${{ github.ref }}-${{ matrix.test-name }} - path: playwright-report/ - retention-days: 30 + # - name: Upload Playwright Report for ${{ matrix.test-name }} + # uses: actions/upload-artifact@v3 + # if: always() + # with: + # name: playwright-report-${{ github.ref }}-${{ matrix.test-name }} + # path: playwright-report/ + # retention-days: 30 diff --git a/verdaccio.yaml b/verdaccio.yaml new file mode 100644 index 00000000000..ad9c91bfa34 --- /dev/null +++ b/verdaccio.yaml @@ -0,0 +1,16 @@ +storage: ./.verdaccio/storage +uplinks: + npmjs: + url: https://registry.npmjs.org/ +packages: + '@clerk/*': + access: $all + publish: $all + 'gatsby-plugin-clerk': + access: $all + publish: $all + '**': + access: $all + publish: $all + proxy: npmjs +log: { type: stdout, format: pretty, level: http } From 611ede101703ad057ca72615c72bf76b4ca9461f Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 20 Oct 2023 03:22:34 -0400 Subject: [PATCH 07/16] build(repo): Add Verdaccio auth --- .github/workflows/ci.yml | 5 ++++- verdaccio.yaml | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c4c5fa703d..8a9ca03348f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,7 +142,10 @@ jobs: run: npm set registry http://localhost:4873/ - name: Run Verdaccio - run: nohup ./node_modules/.bin/verdaccio --config ./verdaccio.yaml & sleep 5 + run: | + nohup ./node_modules/.bin/verdaccio --config ./verdaccio.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: Get Playwright Version id: playwright-version diff --git a/verdaccio.yaml b/verdaccio.yaml index ad9c91bfa34..97478ce7f04 100644 --- a/verdaccio.yaml +++ b/verdaccio.yaml @@ -1,4 +1,7 @@ storage: ./.verdaccio/storage +auth: + htpasswd: + file: ./.verdaccio/htpasswd uplinks: npmjs: url: https://registry.npmjs.org/ From 31c43335d0617b4df41e1c6400798909ae7a775f Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 20 Oct 2023 13:22:00 -0400 Subject: [PATCH 08/16] build(repo): Test Turborepo Remote --- .github/workflows/ci.yml | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a9ca03348f..39744ab04fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,10 +6,14 @@ on: pull_request: branches: - build/turbo-ci-poc + env: NODE_VERSION: '18' TURBO_CACHE_DIR: ./.turbo-cache TURBO_CACHE_PREFIX: turbo- + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ vars.TURBO_TEAM }} + TURBO_REMOTE_ONLY: true concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -31,11 +35,6 @@ jobs: with: node-version: ${{ env.NODE_VERSION }} - - name: Turborepo Remote Server - uses: dtinth/setup-github-actions-caching-for-turbo@v1 - with: - cache-prefix: ${{ env.TURBO_CACHE_PREFIX }} - - name: Cache node_modules uses: actions/cache@v3 id: npm-cache @@ -83,11 +82,6 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Turborepo Remote Server - uses: dtinth/setup-github-actions-caching-for-turbo@v1 - with: - cache-prefix: ${{ env.TURBO_CACHE_PREFIX }} - - name: Cache node_modules uses: actions/cache@v3 id: npm-cache @@ -122,11 +116,6 @@ jobs: with: node-version: ${{ env.NODE_VERSION }} - - name: Turborepo Remote Server - uses: dtinth/setup-github-actions-caching-for-turbo@v1 - with: - cache-prefix: ${{ env.TURBO_CACHE_PREFIX }} - - name: Cache node_modules uses: actions/cache@v3 id: npm-cache From fdde5bc97a11fcf951ba59e13a806e2449dfb76b Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 20 Oct 2023 17:08:11 -0400 Subject: [PATCH 09/16] build(repo): Update commands and ENVs --- .github/workflows/checks.yml | 2 +- .github/workflows/ci.yml | 53 +++++++++++++++++++++++------------- package.json | 1 - packages/clerk-js/turbo.json | 20 -------------- turbo.json | 33 ++-------------------- 5 files changed, 38 insertions(+), 71 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index afef97f5473..1ba514e7810 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -50,7 +50,7 @@ jobs: with: use-turbo-cache: 'true' - name: Run tests - run: npm run test:ci + run: npm run test -- -- --maxWorkers=70% # TODO: Remove test:ci publint: name: Run publint diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39744ab04fe..a06f2c92869 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,12 +8,13 @@ on: - build/turbo-ci-poc env: + FORCE_COLOR: '1' NODE_VERSION: '18' - TURBO_CACHE_DIR: ./.turbo-cache - TURBO_CACHE_PREFIX: turbo- - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: ${{ vars.TURBO_TEAM }} + TURBO_ARGS: --output-logs=new-only --cache-dir=./.turbo-cache --concurrency=8 + TURBO_TOKEN: ${{ secrets.TEST_TURBO_TOKEN }} + TURBO_TEAM: ${{ secrets.TEST_TURBO_TEAM }} TURBO_REMOTE_ONLY: true + TURBO_CONCURRENCY: 8 # Available CPU in RUNNER_LARGE concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -42,6 +43,17 @@ jobs: path: ./node_modules key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-node-modules-${{ hashFiles('**/package-lock.json') }} + - name: List Environment Details + run: | + echo "NODE_VERSION=${{ env.NODE_VERSION }}" + echo "NODE_ENV = $NODE_ENV" + echo "NODE_VERSION = $NODE_VERSION" + echo "NODE_VERSION (GH) = ${{ env.NODE_VERSION }}" + echo "NPM_VERSION = $NPM_VERSION" + echo "TURBO_ARGS = ${{ env.TURBO_ARGS}}" + echo "TURBO_TEAM = ${{ env.TURBO_TEAM }}" + echo "TURBO_TOKEN = ${{ env.TURBO_TOKEN}}" + - name: Install NPM Dependencies if: steps.npm-cache.outputs.cache-hit != 'true' run: npm ci --audit=false --fund=false @@ -53,14 +65,14 @@ jobs: run: npm run format:check - name: Lint packages using publint - run: npm run lint:publint -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} + run: npm run lint:publint -- ${{ env.TURBO_ARGS }} - name: Lint types using attw - run: npm run lint:attw -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} + run: npm run lint:attw -- ${{ env.TURBO_ARGS }} continue-on-error: true # TODO: Remove this when all related errors are fixed - name: Run lint - run: npm run lint -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} -- --quiet + run: npm run lint -- ${{ env.TURBO_ARGS }} -- --quiet unit-tests: name: Unit Tests @@ -87,14 +99,16 @@ jobs: id: npm-cache with: path: ./node_modules - key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-node-modules-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-node-${{ matrix.node-version }}-node-modules-${{ hashFiles('**/package-lock.json') }} - name: Install NPM Dependencies if: steps.npm-cache.outputs.cache-hit != 'true' run: npm ci --audit=false --fund=false - name: Run tests - run: npm run test:ci -- --output-logs=errors-only --cache-dir=${{ env.TURBO_CACHE_DIR }} + run: npm run test -- ${{ env.TURBO_ARGS }} + env: + NODE_VERSION: ${{ matrix.node-version }} integration-tests: name: Integration Tests @@ -127,15 +141,6 @@ jobs: if: steps.npm-cache.outputs.cache-hit != 'true' run: npm ci --audit=false --fund=false - - name: Update NPM Registry - run: npm set registry http://localhost:4873/ - - - name: Run Verdaccio - run: | - nohup ./node_modules/.bin/verdaccio --config ./verdaccio.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: Get Playwright Version id: playwright-version run: echo "VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> "$GITHUB_OUTPUT" @@ -151,8 +156,18 @@ jobs: if: steps.playwright-cache.outputs.cache-hit != 'true' run: npx playwright install --with-deps + - name: Update NPM Registry + run: npm set registry http://localhost:4873/ + + - name: Run Verdaccio + run: | + nohup ./node_modules/.bin/verdaccio --config ./verdaccio.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 - run: npm run release:verdaccio # Fails early if the default npm registry is used + run: | + if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; npm run build -- ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi", - name: Install @clerk/backend in /integration working-directory: ./integration diff --git a/package.json b/package.json index c9ebe299951..b4974147812 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "release:verdaccio": "if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else TURBO_CONCURRENCY=4 npm run build && changeset publish --no-git-tag; fi", "test": "FORCE_COLOR=1 turbo test --concurrency=${TURBO_CONCURRENCY:-80%}", "test:cache:clear": "FORCE_COLOR=1 turbo test:cache:clear --continue --concurrency=${TURBO_CONCURRENCY:-80%}", - "test:ci": "FORCE_COLOR=1 turbo test --concurrency=${TURBO_CONCURRENCY:-80%}", "test:integration:base": "DEBUG=1 npx playwright test --config integration/playwright.config.ts", "test:integration:deployment:nextjs": "DEBUG=1 npx playwright test --config integration/playwright.deployments.config.ts", "test:integration:generic": "E2E_APP_ID=react.vite.* npm run test:integration:base -- --grep @generic", diff --git a/packages/clerk-js/turbo.json b/packages/clerk-js/turbo.json index 07391097f92..2490ef4530a 100644 --- a/packages/clerk-js/turbo.json +++ b/packages/clerk-js/turbo.json @@ -39,26 +39,6 @@ "tsup.config.ts", "webpack.config.js", - "!**/__snapshots__/**", - "!coverage/**", - "!examples/**", - "!node_modules/**" - ] - }, - "test:ci": { - "dependsOn": ["build"], - "inputs": [ - "*.d.ts", - "**/package.json", - "bundlewatch.config.json", - "jest.*", - "src/**", - "tests/**", - "tsconfig.json", - "tsconfig.*.json", - "tsup.config.ts", - "webpack.config.js", - "!**/__snapshots__/**", "!coverage/**", "!examples/**", diff --git a/turbo.json b/turbo.json index debb80d97be..3f6b380e2e4 100644 --- a/turbo.json +++ b/turbo.json @@ -6,32 +6,25 @@ "globalDependencies": [ ".changeset/changelog.js", ".changeset/config.json", - ".dockerignore", ".github/**", ".jit", ".nvmrc", ".prettier*", "jest.*.ts", - "packages/eslint-config-custom/index.js", - "package.json", "package-lock.json", "tsconfig.json", "tsconfig.*.json", - "verdaccio.*.yaml" + "verdaccio.yaml" ], + "globalDotEnv": ["**/.env.local", "**/.env"], "globalEnv": [ - "CI", "CLERK_*", "GATSBY_CLERK_*", "NEXT_PUBLIC_CLERK_*", "MAILSAC_API_KEY", "NODE_ENV", - "NODE_EXTRA_CA_CERTS", "NODE_VERSION", "NPM_VERSION", - "RUNNER_ARCH", - "RUNNER_DEBUG", - "RUNNER_OS", "TZ", "VERCEL" ], @@ -72,6 +65,7 @@ }, "clean": { "dependsOn": [], + "cache": false }, "test": { @@ -98,27 +92,6 @@ "test:cache:clear": { "cache": false }, - "test:ci": { - "dependsOn": ["build"], - "inputs": [ - "*.d.ts", - "**/package.json", - "bundlewatch.config.json", - "jest.*", - "src/**", - "tests/**", - "tsconfig.json", - "tsconfig.*.json", - "tsup.config.ts", - - "!**/__snapshots__/**", - "!coverage/**", - "!examples/**", - "!node_modules/**" - ], - "outputMode": "new-only", - "outputs": [] - }, "lint": { "dependsOn": ["^build"], "outputs": [] From 69925de3fbd515bbced1af12d23169a2951d2126 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 20 Oct 2023 17:18:46 -0400 Subject: [PATCH 10/16] build(repo): Update to Node 20 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a06f2c92869..95dc590a201 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: strategy: matrix: - node-version: [ 18, 19 ] + node-version: [ 18, 20 ] steps: - name: Checkout Repo @@ -167,7 +167,7 @@ jobs: - name: Publish to Verdaccio run: | - if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; npm run build -- ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi", + if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else npm run build -- ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi", - name: Install @clerk/backend in /integration working-directory: ./integration From 3de0ca175689722866cf112a0398ee88b127fb1f Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 20 Oct 2023 17:31:56 -0400 Subject: [PATCH 11/16] build(repo): Update arg patterns --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95dc590a201..5e259a452e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: run: npm ci --audit=false --fund=false - name: Run tests - run: npm run test -- ${{ env.TURBO_ARGS }} + run: npx turbo test ${{ env.TURBO_ARGS }} env: NODE_VERSION: ${{ matrix.node-version }} @@ -167,7 +167,7 @@ jobs: - name: Publish to Verdaccio run: | - if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else npm run build -- ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi", + if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else npx turbo build ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi", - name: Install @clerk/backend in /integration working-directory: ./integration From 6d958d9730f290a929ba2520beeb3785173599c4 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Mon, 23 Oct 2023 12:44:45 -0400 Subject: [PATCH 12/16] build(repo): Remove errant comma --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e259a452e0..fe74c7a5d96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,7 +167,7 @@ jobs: - name: Publish to Verdaccio run: | - if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else npx turbo build ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi", + if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else npx turbo build ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi" - name: Install @clerk/backend in /integration working-directory: ./integration From 6534b6723061834cf227ee1191fa155786a5e7a6 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Mon, 23 Oct 2023 13:13:04 -0400 Subject: [PATCH 13/16] build(repo): Don't escape command --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe74c7a5d96..119b85c9646 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ env: TURBO_ARGS: --output-logs=new-only --cache-dir=./.turbo-cache --concurrency=8 TURBO_TOKEN: ${{ secrets.TEST_TURBO_TOKEN }} TURBO_TEAM: ${{ secrets.TEST_TURBO_TEAM }} - TURBO_REMOTE_ONLY: true + TURBO_REMOTE_ONLY: false TURBO_CONCURRENCY: 8 # Available CPU in RUNNER_LARGE concurrency: @@ -167,7 +167,7 @@ jobs: - name: Publish to Verdaccio run: | - if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else npx turbo build ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi" + if [ "$(npm config get registry)" = "https://registry.npmjs.org/" ]; then echo 'Error: Using default registry' && exit 1; else npx turbo build ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi - name: Install @clerk/backend in /integration working-directory: ./integration From 2df45c25c6e8d611bd8e4dc535f6251c5a06001a Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Mon, 23 Oct 2023 14:52:46 -0400 Subject: [PATCH 14/16] build(repo): Use npx for changeset; checkout v4 --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 119b85c9646..fb37da43392 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,9 +27,10 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 + show-progress: false - name: Setup NodeJS ${{ env.NODE_VERSION }} uses: actions/setup-node@v3 @@ -85,9 +86,10 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 + show-progress: false - name: Setup NodeJS ${{ matrix.node-version }} uses: actions/setup-node@v3 @@ -121,9 +123,10 @@ jobs: steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 + show-progress: false - name: Setup NodeJS ${{ env.NODE_VERSION }} uses: actions/setup-node@v3 From 9bdf1c65c20de535a1a58dabbf05f4f7fd888f52 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Mon, 23 Oct 2023 15:08:12 -0400 Subject: [PATCH 15/16] build(repo): Assign TURBO_REMOTE_CACHE_SIGNATURE_KEY --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb37da43392..0ee98a8bbf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,8 @@ env: TURBO_ARGS: --output-logs=new-only --cache-dir=./.turbo-cache --concurrency=8 TURBO_TOKEN: ${{ secrets.TEST_TURBO_TOKEN }} TURBO_TEAM: ${{ secrets.TEST_TURBO_TEAM }} - TURBO_REMOTE_ONLY: false + TURBO_REMOTE_CACHE_SIGNATURE_KEY: 'foobar-8121639a-9e90-4a8c-9021-689a769e4945' # TODO: secrets.TEST_TURBO_REMOTE_CACHE_SIGNATURE_KEY + TURBO_REMOTE_ONLY: true TURBO_CONCURRENCY: 8 # Available CPU in RUNNER_LARGE concurrency: @@ -24,6 +25,8 @@ jobs: formatting-linting: name: Formatting & Linting runs-on: ${{ vars.RUNNER_LARGE }} + env: + TURBO_REMOTE_ONLY: false steps: - name: Checkout Repo From 64dac1b31322fa06e4d2a5d0f15f743d931ac2f7 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Mon, 23 Oct 2023 15:14:32 -0400 Subject: [PATCH 16/16] chore(repo): Use npx changeset --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ee98a8bbf5..b3777dd7044 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -173,7 +173,7 @@ jobs: - name: Publish to Verdaccio run: | - if [ "$(npm config get registry)" = "https://registry.npmjs.org/" ]; then echo 'Error: Using default registry' && exit 1; else npx turbo build ${{ env.TURBO_ARGS }} && changeset publish --no-git-tag; fi + if [ "$(npm config get registry)" = "https://registry.npmjs.org/" ]; then echo 'Error: Using default registry' && exit 1; else npx turbo build ${{ env.TURBO_ARGS }} && npx changeset publish --no-git-tag; fi - name: Install @clerk/backend in /integration working-directory: ./integration