refactor: use yarn (#1619)

This commit is contained in:
Himself65
2023-03-20 02:05:02 -05:00
committed by GitHub
parent f6c1423361
commit fe2d244460
33 changed files with 21642 additions and 19727 deletions

View File

@@ -24,40 +24,39 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: https://npm.pkg.github.com
scope: '@toeverything'
cache: 'pnpm'
cache: 'yarn'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- run: node scripts/module-resolve/ci.cjs
- name: Restore cache
uses: actions/cache@v3
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
${{ runner.os }}-yarn-
- run: pnpm i --no-frozen-lockfile
- run: yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }}
- name: Lint
run: |
pnpm lint --max-warnings=0
yarn lint --max-warnings=0
# - name: Test
# run: pnpm test
# run: yarn test
- name: Build
run: pnpm build
run: yarn build
env:
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
@@ -68,7 +67,7 @@ jobs:
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
- name: Export
run: pnpm export
run: yarn export
- name: Upload artifact
uses: actions/upload-artifact@v3

View File

@@ -23,28 +23,27 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Restore cache
uses: actions/cache@v3
cache: 'yarn'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
apps/web/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
${{ runner.os }}-yarn-
- run: pnpm i
- run: pnpm lint --max-warnings=0
- run: yarn install
- run: yarn lint --max-warnings=0
- name: Build
run: pnpm i && pnpm build
run: yarn build
env:
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
@@ -55,7 +54,7 @@ jobs:
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
- name: Export
run: pnpm export
run: yarn export
- name: Upload artifact
uses: actions/upload-artifact@v3
@@ -90,13 +89,22 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- run: pnpm i
cache: 'yarn'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- name: Download artifact
uses: actions/download-artifact@v3
with:
@@ -106,12 +114,12 @@ jobs:
- name: Install playwright browsers
run: npx playwright install chromium
- name: Run playwright tests
run: pnpm test -- --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
run: yarn test --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}
env:
COVERAGE: true
- name: Collect code coverage report
run: pnpm exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
- name: Upload e2e test coverage results
uses: codecov/codecov-action@v3
@@ -138,13 +146,22 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm i
cache: 'yarn'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- name: Download artifact
uses: actions/download-artifact@v3
with:
@@ -152,7 +169,7 @@ jobs:
path: ./apps/web/.next
- name: Unit Test
run: pnpm run test:unit:coverage
run: yarn run test:unit:coverage
- name: Upload unit test coverage results
uses: codecov/codecov-action@v3
@@ -171,33 +188,32 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'
registry-url: https://npm.pkg.github.com
scope: '@toeverything'
cache: 'pnpm'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: node scripts/module-resolve/ci.cjs
- name: Restore cache
uses: actions/cache@v3
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
- run: pnpm i --no-frozen-lockfile
- run: yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }}
- name: Build
run: pnpm build
run: yarn build
env:
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
@@ -208,7 +224,7 @@ jobs:
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
- name: Export
run: pnpm export
run: yarn export
- name: Upload artifact
uses: actions/upload-artifact@v3
@@ -286,13 +302,22 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm i
node-version: 18
cache: 'yarn'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- name: Download artifact
uses: actions/download-artifact@v3
with:
@@ -303,13 +328,13 @@ jobs:
run: npx playwright install chromium
- name: Run e2e & unit tests
run: |
pnpm test -- --forbid-only
pnpm run test:unit:coverage
yarn test --forbid-only
yarn run test:unit:coverage
env:
COVERAGE: true
- name: Collect code coverage report
run: pnpm exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
run: yarn exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
- name: Upload e2e test coverage results
uses: codecov/codecov-action@v3

View File

@@ -34,14 +34,18 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
node-version: 18
cache: 'pnpm'
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install
working-directory: apps/electron
- name: before-make
working-directory: apps/electron

View File

@@ -1,39 +0,0 @@
name: Compressed Size
on:
pull_request_target:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: https://npm.pkg.github.com
scope: '@toeverything'
cache: 'pnpm'
- uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/apps/web/.next/cache
key: ${{ runner.os }}-affine-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-affine-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Build
run: |
pnpm install --frozen-lockfile
pnpm run build
- uses: preactjs/compressed-size-action@v2
env:
ENABLE_DEBUG_PAGE: ''
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
build-script: 'export'
pattern: 'apps/web/out/**/*.{js,css,html,json}'
compression: 'brotli'

View File

@@ -26,23 +26,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm i
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- name: Check Language Key
if: github.ref != 'refs/heads/master'
working-directory: ./packages/i18n
run: pnpm run sync-languages:check
run: yarn run sync-languages:check
env:
TOLGEE_API_KEY: ${{ secrets.TOLGEE_API_KEY }}
- name: Sync Languages
if: github.ref == 'refs/heads/master'
working-directory: ./packages/i18n
run: pnpm run sync-languages
run: yarn run sync-languages
env:
TOLGEE_API_KEY: ${{ secrets.TOLGEE_API_KEY }}

View File

@@ -20,29 +20,23 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Restore cache
uses: actions/cache@v3
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
${{ runner.os }}-yarn-
- run: pnpm i
- run: yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }}
- name: Build
run: pnpm build
run: yarn build
env:
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
@@ -53,7 +47,7 @@ jobs:
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
- name: Export
run: pnpm export
run: yarn export
- name: Upload artifact
uses: actions/upload-artifact@v3

View File

@@ -1,61 +0,0 @@
name: Update block-suite version
on:
schedule:
# At 02:00 UTC
- cron: '0 2 * * *'
workflow_dispatch:
# Cancels all previous workflow runs for pull requests that have not completed.
# See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# The concurrency group contains the workflow name and the branch name for
# pull requests or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm i
- name: Get old version
id: old-version
run: |
PACKAGE_VERSION=$(cat apps/web/package.json | jq '.dependencies["@blocksuite/editor"]' | tr -d '"')
echo "old-version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
- name: Update block-suite version
run: pnpm update:core
- name: Get new version
id: new-version
run: |
PACKAGE_VERSION=$(cat apps/web/package.json | jq '.dependencies["@blocksuite/editor"]' | tr -d '"')
echo "new-version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
# https://github.com/actions-js/push
- name: Commit push
uses: actions-js/push@master
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
message: 'chore: bump blocksuite from ${{ steps.old-version.outputs.old-version }} to ${{ steps.new-version.outputs.new-version }}'
force: true
branch: refs/heads/bot/bump-core
# see https://github.com/repo-sync/pull-request
- name: Create Pull Request
uses: repo-sync/pull-request@v2
with:
source_branch: bot/bump-core
pr_title: 'Bump blocksuite to ${{ steps.new-version.outputs.new-version }}'
pr_body: 'Please carefully check the editor functionality before merging the PR.'
github_token: ${{ secrets.GITHUB_TOKEN }}