Skip to content

Version Packages

Version Packages #591

Workflow file for this run

name: Lint and typecheck
on:
push:
branches:
- main
- next
paths:
- 'packages/**'
- '.github/workflows/lint-typecheck.yml'
- '.yarnrc.yml'
- 'yarn.lock'
- '.prettier*'
- '.eslint*'
- 'jest.config.js'
- 'tsconfig.json'
- 'turbo.json'
- 'config'
- 'scripts'
- 'patches'
pull_request:
types:
- opened
- synchronize
- reopened
paths:
- 'packages/**'
- '.github/workflows/**'
- '.yarnrc.yml'
- 'yarn.lock'
- '.prettier*'
- '.eslint*'
- 'jest.config.js'
- 'tsconfig.json'
- 'turbo.json'
- 'config'
- 'scripts'
- 'patches'
jobs:
lint-typecheck:
name: ${{ matrix.command }}
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# Fetch all git history so that yarn workspaces --since can compare with the correct commits
# @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
fetch-depth: 0
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
# Why not using setup-node 2.2+ cache option (yet) ?
# see https://github.com/belgattitude/nextjs-monorepo-example/pull/369
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: |
yarn-cache-folder-
- name: Restore packages cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/**.[jt]sx?', 'packages/**.json') }}
restore-keys: |
${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-
- name: Install
run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install
- name: Build
run: yarn build
- name: Build apps contentlayer
run: yarn g:typecheck:apps
# Lint packages that have changed (--include & --since)
- name: Lint
run: yarn lint
# Typecheck packages that have changed (--include & --since)
- name: Test
run: yarn typecheck
notify-lint-typecheck-failure:
name: Discord Notification
runs-on: ubuntu-20.04
needs:
- lint-typecheck
if: ${{ github.event_name == 'push' && failure() }}
steps:
- name: Notify
uses: nobrayner/discord-webhook@v1
with:
github-token: ${{ secrets.X_GITHUB_READ_ACTIONS_TOKEN }}
discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }}
description: ${{ github.event.number && format('https://github.com/udecode/plate/pull/{0}', github.event.number) || 'Push' }}