From bb08776c895ba2e6fcb33ed8d09d51ca6bc57c57 Mon Sep 17 00:00:00 2001 From: Mike North Date: Sun, 4 May 2025 16:04:59 -0700 Subject: [PATCH 1/4] update CI workflow name --- .github/workflows/ci-website.yml | 182 ++++++++----------------------- 1 file changed, 44 insertions(+), 138 deletions(-) diff --git a/.github/workflows/ci-website.yml b/.github/workflows/ci-website.yml index 1d6edf86..59c87026 100644 --- a/.github/workflows/ci-website.yml +++ b/.github/workflows/ci-website.yml @@ -15,100 +15,62 @@ on: - '.github/**' - 'package.json' - 'yarn.lock' - jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: volta-cli/action@v4 - - # Add yarn cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - ${{ runner.os }}-node-${{ matrix.node-version }}- - ${{ runner.os }}- - - # Add build cache - - name: Cache build output - uses: actions/cache@v3 - with: - path: | - **/dist - **/build - **/.cache - **/public - key: ${{ runner.os }}-node-${{ matrix.node-version }}-build-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-build- - ${{ runner.os }}-node-${{ matrix.node-version }}- - ${{ runner.os }}- - - run: yarn - - name: Build run: yarn build - - name: Lint run: yarn lint - - name: Test run: yarn test - - name: Cypress uses: cypress-io/github-action@v6 with: working-directory: packages/website start: yarn test-cypress + key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} install-command: yarn install browser: chrome wait-on: 'http://localhost:8000' wait-on-timeout: 120 - cache-key: cypress-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + os-compatibility: + needs: build + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + # - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v4 + - uses: volta-cli/action@v4 + - run: yarn + - name: Build + run: yarn build + - name: Test + run: yarn test node-compatibility: needs: build runs-on: ubuntu-latest + strategy: - fail-fast: false matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [20] + # node-version: [16.x, 18.x, 20.x] steps: - uses: actions/checkout@v4 - uses: volta-cli/action@v4 with: node-version: ${{ matrix.node-version }} yarn-version: 3.6.4 - - # Add yarn cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - ${{ runner.os }}-node-${{ matrix.node-version }}- - ${{ runner.os }}- - - run: yarn - name: Build run: yarn build @@ -119,56 +81,19 @@ jobs: with: working-directory: packages/website start: yarn test-cypress + key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} install-command: yarn install browser: chrome wait-on: 'http://localhost:8000' wait-on-timeout: 120 - cache-key: cypress-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - os-compatibility: - needs: build - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - os: windows-latest - node-version: 20 - - os: ubuntu-latest - node-version: 20 - steps: - - uses: actions/checkout@v4 - - uses: volta-cli/action@v4 - with: - node-version: ${{ matrix.node-version }} - yarn-version: 3.6.4 - - # Add yarn cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn- - ${{ matrix.os }}-node-${{ matrix.node-version }}- - ${{ matrix.os }}- - ts-compatibility: needs: build runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental }} strategy: - fail-fast: false matrix: - node-version: [20.x] typescript-version: [beta, next] include: - typescript-version: beta @@ -177,62 +102,43 @@ jobs: - typescript-version: next experimental: true name: 'ts-canary' + steps: - uses: actions/checkout@v4 - uses: volta-cli/action@v4 + - run: yarn + - name: Installing TypeScript ${{ matrix.typescript-version }} + run: yarn workspaces foreach --exclude hello-ts --exclude '@mike-north/typescript-courses' -vpi add -D typescript@${{ matrix.typescript-version}} + - name: Build + run: yarn build + - name: Type-check website + run: yarn postinstall && yarn typecheck + - name: Test + run: yarn test + - name: Cypress + uses: cypress-io/github-action@v6 with: - node-version: ${{ matrix.node-version }} - yarn-version: 3.6.4 - - # Add yarn cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}-yarn- - ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}- - ${{ runner.os }}-node-${{ matrix.node-version }}- - ${{ runner.os }}- + working-directory: packages/website + start: yarn test-cypress + key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + install-command: yarn install + browser: chrome + wait-on: 'http://localhost:8000' + wait-on-timeout: 120 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} publish: - needs: [build, os-compatibility, node-compatibility, ts-compatibility] + needs: + [build, os-compatibility, node-compatibility, ts-compatibility] runs-on: ubuntu-latest if: success() && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - uses: volta-cli/action@v4 - with: - node-version: 20.x - yarn-version: 3.6.4 - - # Add yarn cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-node-20-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-20-yarn- - ${{ runner.os }}-node-20- - ${{ runner.os }}- - - run: yarn - - name: Build run: yarn workspace website run build-prod - - uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.ACCESS_TOKEN }} From a0e274580bc23abef895a82104b53e1da635b716 Mon Sep 17 00:00:00 2001 From: Mike North Date: Sun, 4 May 2025 16:13:05 -0700 Subject: [PATCH 2/4] Cypress cache key uses proper parameter name --- .github/workflows/ci-website.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-website.yml b/.github/workflows/ci-website.yml index 59c87026..08a4d36a 100644 --- a/.github/workflows/ci-website.yml +++ b/.github/workflows/ci-website.yml @@ -33,11 +33,11 @@ jobs: with: working-directory: packages/website start: yarn test-cypress - key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} install-command: yarn install browser: chrome wait-on: 'http://localhost:8000' wait-on-timeout: 120 + cache-key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} os-compatibility: @@ -81,7 +81,7 @@ jobs: with: working-directory: packages/website start: yarn test-cypress - key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + cache-key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} install-command: yarn install browser: chrome wait-on: 'http://localhost:8000' @@ -120,7 +120,7 @@ jobs: with: working-directory: packages/website start: yarn test-cypress - key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + cache-key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} install-command: yarn install browser: chrome wait-on: 'http://localhost:8000' From 8440b2c5daf44922988957ab57a849798136e9ab Mon Sep 17 00:00:00 2001 From: Mike North Date: Sun, 4 May 2025 16:31:09 -0700 Subject: [PATCH 3/4] add gha caching --- .github/workflows/ci-website.yml | 182 +++++++++++++++++++++++-------- 1 file changed, 138 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci-website.yml b/.github/workflows/ci-website.yml index 08a4d36a..1d6edf86 100644 --- a/.github/workflows/ci-website.yml +++ b/.github/workflows/ci-website.yml @@ -15,19 +15,57 @@ on: - '.github/**' - 'package.json' - 'yarn.lock' + jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: volta-cli/action@v4 + + # Add yarn cache + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Restore yarn cache + uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + ${{ runner.os }}-node-${{ matrix.node-version }}- + ${{ runner.os }}- + + # Add build cache + - name: Cache build output + uses: actions/cache@v3 + with: + path: | + **/dist + **/build + **/.cache + **/public + key: ${{ runner.os }}-node-${{ matrix.node-version }}-build-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-build- + ${{ runner.os }}-node-${{ matrix.node-version }}- + ${{ runner.os }}- + - run: yarn + - name: Build run: yarn build + - name: Lint run: yarn lint + - name: Test run: yarn test + - name: Cypress uses: cypress-io/github-action@v6 with: @@ -37,40 +75,40 @@ jobs: browser: chrome wait-on: 'http://localhost:8000' wait-on-timeout: 120 - cache-key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + cache-key: cypress-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - os-compatibility: - needs: build - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - # - macos-latest - - windows-latest - steps: - - uses: actions/checkout@v4 - - uses: volta-cli/action@v4 - - run: yarn - - name: Build - run: yarn build - - name: Test - run: yarn test node-compatibility: needs: build runs-on: ubuntu-latest - strategy: + fail-fast: false matrix: - node-version: [20] - # node-version: [16.x, 18.x, 20.x] + node-version: [16.x, 18.x, 20.x] steps: - uses: actions/checkout@v4 - uses: volta-cli/action@v4 with: node-version: ${{ matrix.node-version }} yarn-version: 3.6.4 + + # Add yarn cache + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Restore yarn cache + uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- + ${{ runner.os }}-node-${{ matrix.node-version }}- + ${{ runner.os }}- + - run: yarn - name: Build run: yarn build @@ -81,19 +119,56 @@ jobs: with: working-directory: packages/website start: yarn test-cypress - cache-key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} install-command: yarn install browser: chrome wait-on: 'http://localhost:8000' wait-on-timeout: 120 + cache-key: cypress-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + os-compatibility: + needs: build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + node-version: 20 + - os: ubuntu-latest + node-version: 20 + steps: + - uses: actions/checkout@v4 + - uses: volta-cli/action@v4 + with: + node-version: ${{ matrix.node-version }} + yarn-version: 3.6.4 + + # Add yarn cache + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Restore yarn cache + uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn- + ${{ matrix.os }}-node-${{ matrix.node-version }}- + ${{ matrix.os }}- + ts-compatibility: needs: build runs-on: ubuntu-latest continue-on-error: ${{ matrix.experimental }} strategy: + fail-fast: false matrix: + node-version: [20.x] typescript-version: [beta, next] include: - typescript-version: beta @@ -102,43 +177,62 @@ jobs: - typescript-version: next experimental: true name: 'ts-canary' - steps: - uses: actions/checkout@v4 - uses: volta-cli/action@v4 - - run: yarn - - name: Installing TypeScript ${{ matrix.typescript-version }} - run: yarn workspaces foreach --exclude hello-ts --exclude '@mike-north/typescript-courses' -vpi add -D typescript@${{ matrix.typescript-version}} - - name: Build - run: yarn build - - name: Type-check website - run: yarn postinstall && yarn typecheck - - name: Test - run: yarn test - - name: Cypress - uses: cypress-io/github-action@v6 with: - working-directory: packages/website - start: yarn test-cypress - cache-key: cypress-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - install-command: yarn install - browser: chrome - wait-on: 'http://localhost:8000' - wait-on-timeout: 120 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + node-version: ${{ matrix.node-version }} + yarn-version: 3.6.4 + + # Add yarn cache + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Restore yarn cache + uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}-yarn- + ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}- + ${{ runner.os }}-node-${{ matrix.node-version }}- + ${{ runner.os }}- publish: - needs: - [build, os-compatibility, node-compatibility, ts-compatibility] + needs: [build, os-compatibility, node-compatibility, ts-compatibility] runs-on: ubuntu-latest if: success() && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - uses: volta-cli/action@v4 + with: + node-version: 20.x + yarn-version: 3.6.4 + + # Add yarn cache + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Restore yarn cache + uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-node-20-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-20-yarn- + ${{ runner.os }}-node-20- + ${{ runner.os }}- + - run: yarn + - name: Build run: yarn workspace website run build-prod + - uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.ACCESS_TOKEN }} From feefd6736c2e48dfaccf5f6be9a9aa54a05fce2a Mon Sep 17 00:00:00 2001 From: Mike North Date: Sun, 4 May 2025 16:58:22 -0700 Subject: [PATCH 4/4] lighten routine CI job, and run compability testing nightly if changes occur --- .github/workflows/ci-website.yml | 154 ++++++-------------- .github/workflows/nightly-compatibility.yml | 115 +++++++++++++++ 2 files changed, 156 insertions(+), 113 deletions(-) create mode 100644 .github/workflows/nightly-compatibility.yml diff --git a/.github/workflows/ci-website.yml b/.github/workflows/ci-website.yml index 1d6edf86..963e7e02 100644 --- a/.github/workflows/ci-website.yml +++ b/.github/workflows/ci-website.yml @@ -16,13 +16,18 @@ on: - 'package.json' - 'yarn.lock' +env: + NODE_VERSION: 20.x # LTS version + jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: volta-cli/action@v4 + with: + node-version: ${{ env.NODE_VERSION }} + yarn-version: 3.6.4 # Add yarn cache - name: Get yarn cache directory path @@ -34,38 +39,19 @@ jobs: id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-lts-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - ${{ runner.os }}-node-${{ matrix.node-version }}- + ${{ runner.os }}-node-lts-yarn- + ${{ runner.os }}-node-lts- ${{ runner.os }}- - - # Add build cache - - name: Cache build output - uses: actions/cache@v3 - with: - path: | - **/dist - **/build - **/.cache - **/public - key: ${{ runner.os }}-node-${{ matrix.node-version }}-build-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-build- - ${{ runner.os }}-node-${{ matrix.node-version }}- - ${{ runner.os }}- - - - run: yarn + - run: yarn - name: Build run: yarn build - - name: Lint run: yarn lint - - name: Test run: yarn test - - name: Cypress uses: cypress-io/github-action@v6 with: @@ -75,22 +61,30 @@ jobs: browser: chrome wait-on: 'http://localhost:8000' wait-on-timeout: 120 - cache-key: cypress-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + cache-key: cypress-${{ runner.os }}-node-lts-${{ hashFiles('**/yarn.lock') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - node-compatibility: + ts-compatibility: needs: build runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false matrix: - node-version: [16.x, 18.x, 20.x] + typescript-version: [beta, next] + include: + - typescript-version: beta + experimental: false + name: 'ts-beta' + - typescript-version: next + experimental: true + name: 'ts-canary' steps: - uses: actions/checkout@v4 - uses: volta-cli/action@v4 with: - node-version: ${{ matrix.node-version }} + node-version: ${{ env.NODE_VERSION }} yarn-version: 3.6.4 # Add yarn cache @@ -103,17 +97,27 @@ jobs: id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-lts-ts-${{ matrix.typescript-version }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-yarn- - ${{ runner.os }}-node-${{ matrix.node-version }}- + ${{ runner.os }}-node-lts-ts-${{ matrix.typescript-version }}-yarn- + ${{ runner.os }}-node-lts-ts-${{ matrix.typescript-version }}- + ${{ runner.os }}-node-lts- ${{ runner.os }}- - run: yarn + + - name: Installing TypeScript ${{ matrix.typescript-version }} + run: yarn workspaces foreach --exclude hello-ts --exclude '@mike-north/typescript-courses' -vpi add -D typescript@${{ matrix.typescript-version }} + - name: Build run: yarn build + + - name: Type-check website + run: yarn postinstall && yarn typecheck + - name: Test run: yarn test + - name: Cypress uses: cypress-io/github-action@v6 with: @@ -123,93 +127,19 @@ jobs: browser: chrome wait-on: 'http://localhost:8000' wait-on-timeout: 120 - cache-key: cypress-${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + cache-key: cypress-${{ runner.os }}-node-lts-ts-${{ matrix.typescript-version }}-${{ hashFiles('**/yarn.lock') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - os-compatibility: - needs: build - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - os: windows-latest - node-version: 20 - - os: ubuntu-latest - node-version: 20 - steps: - - uses: actions/checkout@v4 - - uses: volta-cli/action@v4 - with: - node-version: ${{ matrix.node-version }} - yarn-version: 3.6.4 - - # Add yarn cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn- - ${{ matrix.os }}-node-${{ matrix.node-version }}- - ${{ matrix.os }}- - - ts-compatibility: - needs: build - runs-on: ubuntu-latest - continue-on-error: ${{ matrix.experimental }} - strategy: - fail-fast: false - matrix: - node-version: [20.x] - typescript-version: [beta, next] - include: - - typescript-version: beta - experimental: false - name: 'ts-beta' - - typescript-version: next - experimental: true - name: 'ts-canary' - steps: - - uses: actions/checkout@v4 - - uses: volta-cli/action@v4 - with: - node-version: ${{ matrix.node-version }} - yarn-version: 3.6.4 - - # Add yarn cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - - name: Restore yarn cache - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}-yarn- - ${{ runner.os }}-node-${{ matrix.node-version }}-ts-${{ matrix.typescript-version }}- - ${{ runner.os }}-node-${{ matrix.node-version }}- - ${{ runner.os }}- - publish: - needs: [build, os-compatibility, node-compatibility, ts-compatibility] + needs: [build, ts-compatibility] runs-on: ubuntu-latest if: success() && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - uses: volta-cli/action@v4 with: - node-version: 20.x + node-version: ${{ env.NODE_VERSION }} yarn-version: 3.6.4 # Add yarn cache @@ -222,17 +152,15 @@ jobs: id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-node-20-yarn-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-lts-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-node-20-yarn- - ${{ runner.os }}-node-20- + ${{ runner.os }}-node-lts-yarn- + ${{ runner.os }}-node-lts- ${{ runner.os }}- - run: yarn - - name: Build run: yarn workspace website run build-prod - - uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.ACCESS_TOKEN }} diff --git a/.github/workflows/nightly-compatibility.yml b/.github/workflows/nightly-compatibility.yml new file mode 100644 index 00000000..f1dd7520 --- /dev/null +++ b/.github/workflows/nightly-compatibility.yml @@ -0,0 +1,115 @@ +name: Nightly Compatibility Tests + +on: + schedule: + - cron: '0 3 * * *' # Run at 3am every day + workflow_dispatch: # Allow manual trigger + +jobs: + check-changes: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.changed }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for all branches and tags + + - name: Check for code changes + id: check + run: | + LAST_RUN=$(gh api repos/${{ github.repository }}/actions/workflows/nightly-compatibility.yml/runs --jq 'first(.workflow_runs[] | select(.conclusion != null and .status == "completed")).created_at') + if [ -z "$LAST_RUN" ]; then + echo "No previous successful run found, running tests" + echo "changed=true" >> $GITHUB_OUTPUT + else + git diff --quiet $LAST_RUN..HEAD 'packages/**/*' '.github/**' 'package.json' 'yarn.lock' + if [ $? -eq 1 ]; then + echo "Changes detected since last run" + echo "changed=true" >> $GITHUB_OUTPUT + else + echo "No changes detected" + echo "changed=false" >> $GITHUB_OUTPUT + fi + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + windows-compatibility: + needs: check-changes + if: needs.check-changes.outputs.should_run == 'true' + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - uses: volta-cli/action@v4 + with: + node-version: ${{ env.NODE_VERSION }} + yarn-version: 3.6.4 + + # Add yarn cache + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Restore yarn cache + uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: windows-node-lts-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + windows-node-lts-yarn- + windows-node-lts- + windows- + + - run: yarn + - name: Build + run: yarn build + - name: Test + run: yarn test + + node-compatibility: + needs: check-changes + if: needs.check-changes.outputs.should_run == 'true' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [21.x, 22.x] # Current and Next + include: + - node-version: 21.x + name: 'node-current' + - node-version: 22.x + name: 'node-next' + experimental: true + continue-on-error: ${{ matrix.experimental || false }} + steps: + - uses: actions/checkout@v4 + + - uses: volta-cli/action@v4 + with: + node-version: ${{ matrix.node-version }} + yarn-version: 3.6.4 + + # Add yarn cache + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Restore yarn cache + uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.name }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.name }}-yarn- + ${{ runner.os }}-${{ matrix.name }}- + ${{ runner.os }}- + + - run: yarn + - name: Build + run: yarn build + - name: Test + run: yarn test \ No newline at end of file