There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
ci: reduce yarn cache (#2983)
LongYinanbacd00655dcb
diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.ymlindex 02efa4063a..dab9d80df9 100644--- a/.github/actions/setup-node/action.yml+++ b/.github/actions/setup-node/action.yml@@ -13,10 +13,18 @@ inputs:description: 'Run the install step for Playwright.'required: falsedefault: 'false'+ electron-install:+ description: 'Download the Electron binary'+ required: false+ default: 'true'npm-token:description: 'The NPM token to use for private packages.'required: falsedefault: ''+ hard-link-nm:+ description: 'set nmMode to hardlinks-local in .yarnrc.yml'+ required: false+ default: 'true'runs:using: 'composite'@@ -29,33 +37,10 @@ runs:scope: '@toeverything'cache: 'yarn'- - name: Expose yarn config as "$GITHUB_OUTPUT"- id: yarn-config+ - name: Set nmMode+ if: ${{ inputs.hard-link-nm == 'true' }}shell: bash- run: |- echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT-- - name: Restore yarn cache- uses: actions/cache@v3- id: yarn-download-cache- with:- path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }}- key: yarn-download-cache-${{ hashFiles('yarn.lock') }}- restore-keys: |- yarn-download-cache--- - name: Restore node_modules cache- uses: actions/cache@v3- with:- path: '**/node_modules'- key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}-- - name: Restore yarn install state- id: yarn-install-state-cache- uses: actions/cache@v3- with:- path: .yarn/ci-cache/- key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}+ run: yarn config set nmMode hardlinks-local- name: yarn installif: ${{ inputs.package-install == 'true' }}@@ -64,9 +49,9 @@ runs:run: yarn install ${{ inputs.extra-flags }}env:NODE_AUTH_TOKEN: ${{ inputs.npm-token }}- YARN_ENABLE_GLOBAL_CACHE: 'false'- YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gzHUSKY: '0'+ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'+ ELECTRON_SKIP_BINARY_DOWNLOAD: '1'- name: yarn install (try again)if: ${{ steps.install.outcome == 'failure' }}@@ -74,9 +59,9 @@ runs:run: yarn install ${{ inputs.extra-flags }}env:NODE_AUTH_TOKEN: ${{ inputs.npm-token }}- YARN_ENABLE_GLOBAL_CACHE: 'false'- YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gzHUSKY: '0'+ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'+ ELECTRON_SKIP_BINARY_DOWNLOAD: '1'- name: Get installed Playwright versionid: playwright-version@@ -113,3 +98,26 @@ runs:shell: bashif: inputs.playwright-install == 'true' && steps.playwright-cache.outputs.cache-hit != 'true'run: yarn playwright install --with-deps++ - name: Get installed Electron version+ id: electron-version+ if: ${{ inputs.electron-install == 'true' }}+ shell: bash+ run: |+ echo "version=$(yarn why --json electron | grep -h 'workspace:.' | jq --raw-output '.children[].locator' | sed -e 's/@playwright\/test@.*://' | head -n 1)" >> $GITHUB_OUTPUT++ - uses: actions/cache@v3+ id: electron-cache+ if: ${{ inputs.electron-install == 'true' }}+ with:+ path: 'node_modules/.cache/electron'+ key: '${{ runner.os }}-electron-${{ steps.electron-version.outputs.version }}'+ restore-keys: |+ ${{ runner.os }}-electron-++ - name: Install Electron binary+ shell: bash+ if: inputs.electron-install == 'true'+ run: node apps/electron/node_modules/electron/install.js+ env:+ ELECTRON_OVERRIDE_DIST_PATH: ./node_modules/.cache/electrondiff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 9ee82661e5..3318eaeb4c 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -43,6 +43,8 @@ jobs:- uses: actions/checkout@v3- name: Setup Node.jsuses: ./.github/actions/setup-node+ with:+ electron-install: false- name: Run i18n codegenrun: yarn i18n-codegen gen- name: Run Type Check@@ -50,7 +52,10 @@ jobs:- name: Run ESLintrun: yarn lint --max-warnings=0 --cache- name: Run Prettier- run: yarn prettier . --ignore-unknown --cache --check+ # Set nmMode in `actions/setup-node` will modify the .yarnrc.yml+ run: |+ git checkout .yarnrc.yml+ yarn prettier . --ignore-unknown --cache --check- name: Run circularrun: yarn circular- name: Upload server dist@@ -69,6 +74,8 @@ jobs:- uses: actions/checkout@v3- name: Setup Node.jsuses: ./.github/actions/setup-node+ with:+ electron-install: false- run: yarn nx build @affine/docsenv:NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}@@ -82,6 +89,8 @@ jobs:- uses: actions/checkout@v3- name: Setup Node.jsuses: ./.github/actions/setup-node+ with:+ electron-install: false- run: yarn nx build @affine/storybookenv:NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}@@ -187,6 +196,7 @@ jobs:uses: ./.github/actions/setup-nodewith:playwright-install: true+ electron-install: false- name: Download storybook artifactuses: actions/download-artifact@v3with:@@ -213,6 +223,7 @@ jobs:uses: ./.github/actions/setup-nodewith:playwright-install: true+ electron-install: false- name: Download artifactuses: actions/download-artifact@v3with:@@ -256,6 +267,7 @@ jobs:uses: ./.github/actions/setup-nodewith:playwright-install: true+ electron-install: false- name: Download next staticuses: actions/download-artifact@v3@@ -327,6 +339,7 @@ jobs:uses: ./.github/actions/setup-nodewith:playwright-install: true+ hard-link-nm: false- name: Build AFFiNE nativeuses: ./.github/actions/build-rustwith:@@ -396,6 +409,8 @@ jobs:- uses: actions/checkout@v3- name: Setup Node.jsuses: ./.github/actions/setup-node+ with:+ electron-install: false- name: Build Infrarun: yarn run build:infra