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
154 changes: 41 additions & 113 deletions .github/workflows/ci-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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 }}
Expand Down
115 changes: 115 additions & 0 deletions .github/workflows/nightly-compatibility.yml
Original file line number Diff line number Diff line change
@@ -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
Loading