Skip to content
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

CI: node 22 #3899

Merged
merged 2 commits into from
Dec 21, 2024
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
27 changes: 13 additions & 14 deletions .github/workflows/ci-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ on:
paths:
- 'templates/**'

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

jobs:
build:
name: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.18.x]
template:
- plate-template
- plate-playground-template
Expand All @@ -37,27 +40,23 @@ jobs:
version: 8.6.1
run_install: false

- name: Use Node.js ${{ matrix.node-version }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 22
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: ♻️ Setup pnpm cache
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: $(pnpm store path)
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
${{ runner.os }}-pnpm-

- name: 📥 Install
- name: 📥 Install dependencies
run: pnpm install --no-frozen-lockfile

- name: 🏗 Run build
- name: 🏗 Build
run: pnpm build
33 changes: 20 additions & 13 deletions .github/workflows/clean-up-pr-caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,30 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: 🧹 Cleanup
- name: 🧹 Cleanup caches
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
run: |
# Install GitHub CLI cache extension
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
echo "Fetching list of cache keys..."
cacheKeys=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1)
## Setting this to not fail the workflow while deleting cache keys.
# Continue even if some cache deletions fail
set +e
if [ -z "$cacheKeys" ]; then
echo "No caches found to delete"
exit 0
fi
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
for cacheKey in $cacheKeys; do
echo "Deleting cache: $cacheKey"
gh actions-cache delete "$cacheKey" -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
echo "Cache cleanup completed"
25 changes: 13 additions & 12 deletions .github/workflows/lint-typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,23 @@ on:
- 'scripts'
- 'patches'

# Add concurrency to cancel redundant runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-typecheck:
name: ${{ matrix.command }}
name: Lint and Typecheck
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.18.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 22

- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install
Expand All @@ -66,24 +68,23 @@ jobs:
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: packages-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}

- name: 🏗 Run build
- name: 🏗 Build
run: yarn build

- name: 🔬 Linter
- name: 🔬 Lint
run: yarn lint

- name: 🕵️ Typecheck
run: yarn typecheck:all

notify-lint-typecheck-failure:
notify-failure:
name: Discord Notification
runs-on: ubuntu-latest
needs:
- lint-typecheck
needs: [lint-typecheck]
if: ${{ github.event_name == 'push' && failure() }}

steps:
- name: Notify
- name: Send Discord Notification
uses: nobrayner/discord-webhook@v1
with:
github-token: ${{ secrets.X_GITHUB_READ_ACTIONS_TOKEN }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/notify-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ jobs:
name: Discord Notification
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/@udecode/plate@') }}

steps:
- name: get-version
- name: Extract Version
id: version
run: echo "output=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT

- name: notify
- name: Send Discord Notification
uses: sebastianpopp/discord-action@releases/v2
with:
webhook: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ jobs:
update-registry:
name: Update Registry
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.18.x]

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

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 22

- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install
Expand All @@ -49,3 +50,5 @@ jobs:
committer: GitHub <[email protected]>
branch: registry
delete-branch: true
add-paths: |
apps/www/**/*
23 changes: 9 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,34 @@ on:

jobs:
release:
# Basic security: the release job can only be executed from this repo and from the main branch (not a remote thing)
if: ${{ github.repository == 'udecode/plate' && contains('refs/heads/main',github.ref)}}
name: Release and changelog
runs-on: ubuntu-latest
# Basic security: the release job can only be executed from this repo and from the main branch
if: ${{ github.repository == 'udecode/plate' && contains('refs/heads/main',github.ref)}}

steps:
- name: Checkout Repo
- name: 📥 Checkout Repo
uses: actions/checkout@v4
with:
# To run comparison we need more than the latest commit.
# @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
# To run comparison we need more than the latest commit
fetch-depth: 0

- name: ♻️ Use Node.js 18.x
- name: ♻️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.18.x
node-version: 22

- name: 📥 Monorepo install
- name: 📦 Monorepo install
uses: ./.github/actions/yarn-nm-install

# @link https://github.com/changesets/action
- name: 🦋 Create Release Pull Request or Publish to npm
- name: 🦋 Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
# publish: yarn g:release
cwd: ${{ github.workspace }}
title: '[Release] Version packages'
publish: yarn release
# Optional, might be used in conjunction with GITHUB_TOKEN to
# allow running the workflows on a Version package action.
# Be aware of security implications.
# setupGitUser: true
env:
# See https://github.com/changesets/action/issues/147
HOME: ${{ github.workspace }}
Expand Down
35 changes: 16 additions & 19 deletions .github/workflows/sync-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,66 +12,63 @@ on:

jobs:
build:
name: build
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.18.x]
template:
- plate-template
- plate-playground-template
defaults:
run:
working-directory: templates/${{ matrix.template }}

steps:
- uses: actions/checkout@v4

- uses: pnpm/[email protected]
name: Install pnpm
- name: 📦 Install pnpm
uses: pnpm/[email protected]
with:
version: 8.6.1
run_install: false

- name: Use Node.js ${{ matrix.node-version }}
- name: ♻️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 22
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
name: Setup pnpm cache
- name: 🔄 Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: $(pnpm store path)
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
${{ runner.os }}-pnpm-

- name: 📥 Install dependencies
run: pnpm install --no-frozen-lockfile

- name: 🏗 Run build
- name: 🏗 Build
run: pnpm build

sync:
needs: build
runs-on: ubuntu-latest
if: ${{ success() }}
strategy:
fail-fast: false
matrix:
template:
- plate-template
- plate-playground-template
if: ${{ success() }}

steps:
- uses: actions/checkout@v4
- name: Sync Templates

- name: 🔄 Sync Templates
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
run: ./scripts/sync-templates.sh "templates/${{ matrix.template }}"
Expand Down
23 changes: 12 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,21 @@ on:

jobs:
test:
name: ${{ matrix.command }}
name: Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.18.x]

# Add concurrency to cancel redundant runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
- name: ♻️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 22

- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install
Expand All @@ -68,21 +70,20 @@ jobs:
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: packages-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}

- name: 🏗 Run build
- name: 🏗 Build
run: yarn build

- name: 🧪 Unit tests
- name: 🧪 Run tests
run: yarn test

notify-test-failure:
name: Discord Notification
runs-on: ubuntu-latest
needs:
- test
needs: [test]
if: ${{ github.event_name == 'push' && failure() }}

steps:
- name: Notify
- name: 🔔 Send Discord Notification
uses: nobrayner/discord-webhook@v1
with:
github-token: ${{ secrets.X_GITHUB_READ_ACTIONS_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.12.1
v22
Loading