mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
chore(workflow): add cache to workflows using actions/setup-node (#5697)
* ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows * Use cache: yarn * Reformat Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
parent
9247332334
commit
41346e0abf
10 changed files with 44 additions and 50 deletions
3
.github/workflows/canary-release.yml
vendored
3
.github/workflows/canary-release.yml
vendored
|
@ -5,7 +5,7 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- 'packages/**'
|
- packages/**
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-canary:
|
publish-canary:
|
||||||
|
@ -21,6 +21,7 @@ jobs:
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
cache: yarn
|
||||||
- name: Prepare git
|
- name: Prepare git
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "Docusaurus Canary"
|
git config --global user.name "Docusaurus Canary"
|
||||||
|
|
22
.github/workflows/codeql-analysis.yml
vendored
22
.github/workflows/codeql-analysis.yml
vendored
|
@ -1,13 +1,14 @@
|
||||||
name: "CodeQL"
|
name: CodeQL
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches:
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
branches:
|
||||||
branches: [ main ]
|
- main
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '25 22 * * 3'
|
- cron: 25 22 * * 3
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
|
@ -21,24 +22,17 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
language: [ 'javascript' ]
|
language:
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
- javascript
|
||||||
# Learn more:
|
|
||||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v1
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
||||||
# By default, queries listed here will override any specified in a config file.
|
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
||||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v1
|
||||||
|
|
8
.github/workflows/lint.yml
vendored
8
.github/workflows/lint.yml
vendored
|
@ -12,11 +12,11 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
- name: Installation
|
|
||||||
uses: bahmutov/npm-install@v1
|
|
||||||
with:
|
with:
|
||||||
install-command: yarn install
|
cache: yarn
|
||||||
# install-command: yarn install --immutable # Fails if yarn.lock is modified (unfortunately only works for Yarn 2, and --frozen-lockfile is not the same!)
|
- name: Installation
|
||||||
|
run: yarn
|
||||||
|
# run: yarn install --immutable # Fails if yarn.lock is modified (unfortunately only works for Yarn 2, and --frozen-lockfile is not the same!)
|
||||||
- name: Check immutable yarn.lock
|
- name: Check immutable yarn.lock
|
||||||
run: git diff --exit-code
|
run: git diff --exit-code
|
||||||
- name: Lint
|
- name: Lint
|
||||||
|
|
9
.github/workflows/v2-build-blog-only.yml
vendored
9
.github/workflows/v2-build-blog-only.yml
vendored
|
@ -5,8 +5,7 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- 'website-1.x/blog/**'
|
- packages/docusaurus/**
|
||||||
- 'packages/docusaurus/**'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -15,9 +14,9 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
- name: Installation
|
|
||||||
uses: bahmutov/npm-install@v1
|
|
||||||
with:
|
with:
|
||||||
install-command: yarn
|
cache: yarn
|
||||||
|
- name: Installation
|
||||||
|
run: yarn
|
||||||
- name: Build blog-only
|
- name: Build blog-only
|
||||||
run: yarn workspace website build:blogOnly
|
run: yarn workspace website build:blogOnly
|
||||||
|
|
8
.github/workflows/v2-build-size-report.yml
vendored
8
.github/workflows/v2-build-size-report.yml
vendored
|
@ -17,11 +17,13 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
cache: yarn
|
||||||
- uses: preactjs/compressed-size-action@v2
|
- uses: preactjs/compressed-size-action@v2
|
||||||
with:
|
with:
|
||||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
build-script: 'build:website:en'
|
build-script: build:website:en
|
||||||
pattern: '{website/build/assets/js/main*js,website/build/assets/css/styles*css,website/.docusaurus/globalData.json,website/build/index.html,website/build/blog/index.html,website/build/blog/**/introducing-docusaurus/*,website/build/docs/index.html,website/build/docs/installation/index.html,website/build/tests/docs/index.html,website/build/tests/docs/standalone/index.html}'
|
pattern: '{website/build/assets/js/main*js,website/build/assets/css/styles*css,website/.docusaurus/globalData.json,website/build/index.html,website/build/blog/index.html,website/build/blog/**/introducing-docusaurus/*,website/build/docs/index.html,website/build/docs/installation/index.html,website/build/tests/docs/index.html,website/build/tests/docs/standalone/index.html}'
|
||||||
strip-hash: '\.([^;]\w{7})\.'
|
strip-hash: '\.([^;]\w{7})\.'
|
||||||
minimum-change-threshold: 30
|
minimum-change-threshold: 30
|
||||||
compression: 'none'
|
compression: none
|
||||||
|
|
8
.github/workflows/v2-build-time-perf.yml
vendored
8
.github/workflows/v2-build-time-perf.yml
vendored
|
@ -5,7 +5,7 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'website/docs/**'
|
- website/docs/**
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -14,10 +14,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
- name: Installation
|
|
||||||
uses: bahmutov/npm-install@v1
|
|
||||||
with:
|
with:
|
||||||
install-command: yarn
|
cache: yarn
|
||||||
|
- name: Installation
|
||||||
|
run: yarn
|
||||||
|
|
||||||
# Ensure build with a cold cache does not increase too much
|
# Ensure build with a cold cache does not increase too much
|
||||||
- name: Build (cold cache)
|
- name: Build (cold cache)
|
||||||
|
|
2
.github/workflows/v2-lighthouse-report.yml
vendored
2
.github/workflows/v2-lighthouse-report.yml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
||||||
uses: jakepartusch/wait-for-netlify-action@v1
|
uses: jakepartusch/wait-for-netlify-action@v1
|
||||||
id: netlify
|
id: netlify
|
||||||
with:
|
with:
|
||||||
site_name: 'docusaurus-2'
|
site_name: docusaurus-2
|
||||||
max_timeout: 600
|
max_timeout: 600
|
||||||
- name: Audit URLs using Lighthouse
|
- name: Audit URLs using Lighthouse
|
||||||
id: lighthouse_audit
|
id: lighthouse_audit
|
||||||
|
|
12
.github/workflows/v2-tests-e2e.yml
vendored
12
.github/workflows/v2-tests-e2e.yml
vendored
|
@ -21,10 +21,9 @@ jobs:
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
|
cache: yarn
|
||||||
- name: Installation
|
- name: Installation
|
||||||
uses: bahmutov/npm-install@v1
|
run: yarn
|
||||||
with:
|
|
||||||
install-command: yarn
|
|
||||||
- name: Generate test-website project against main branch
|
- name: Generate test-website project against main branch
|
||||||
run: |
|
run: |
|
||||||
KEEP_CONTAINER=true yarn test:build:website -s
|
KEEP_CONTAINER=true yarn test:build:website -s
|
||||||
|
@ -50,17 +49,16 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node: ['14']
|
node: ['14']
|
||||||
nodeLinker: ['pnp', 'node-modules']
|
nodeLinker: [pnp, node-modules]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js ${{ matrix.node }}
|
- name: Use Node.js ${{ matrix.node }}
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
|
cache: yarn
|
||||||
- name: Installation
|
- name: Installation
|
||||||
uses: bahmutov/npm-install@v1
|
run: yarn
|
||||||
with:
|
|
||||||
install-command: yarn
|
|
||||||
|
|
||||||
- name: Generate test-website project against main branch
|
- name: Generate test-website project against main branch
|
||||||
run: |
|
run: |
|
||||||
|
|
1
.github/workflows/v2-tests-windows.yml
vendored
1
.github/workflows/v2-tests-windows.yml
vendored
|
@ -20,6 +20,7 @@ jobs:
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
|
cache: yarn
|
||||||
- name: Installation
|
- name: Installation
|
||||||
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
|
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
|
||||||
- name: Docusaurus Jest Tests
|
- name: Docusaurus Jest Tests
|
||||||
|
|
5
.github/workflows/v2-tests.yml
vendored
5
.github/workflows/v2-tests.yml
vendored
|
@ -18,10 +18,9 @@ jobs:
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
|
cache: yarn
|
||||||
- name: Installation
|
- name: Installation
|
||||||
uses: bahmutov/npm-install@v1
|
run: yarn
|
||||||
with:
|
|
||||||
install-command: yarn
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: yarn test
|
run: yarn test
|
||||||
- name: TypeCheck website
|
- name: TypeCheck website
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue