mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 00:39:45 +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:
|
||||
- main
|
||||
paths:
|
||||
- 'packages/**'
|
||||
- packages/**
|
||||
|
||||
jobs:
|
||||
publish-canary:
|
||||
|
@ -21,6 +21,7 @@ jobs:
|
|||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: yarn
|
||||
- name: Prepare git
|
||||
run: |
|
||||
git config --global user.name "Docusaurus Canary"
|
||||
|
|
38
.github/workflows/codeql-analysis.yml
vendored
38
.github/workflows/codeql-analysis.yml
vendored
|
@ -1,13 +1,14 @@
|
|||
name: "CodeQL"
|
||||
name: CodeQL
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ main ]
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '25 22 * * 3'
|
||||
- cron: 25 22 * * 3
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
|
@ -21,24 +22,17 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# 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
|
||||
language:
|
||||
- javascript
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
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: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
|
|
8
.github/workflows/lint.yml
vendored
8
.github/workflows/lint.yml
vendored
|
@ -12,11 +12,11 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- name: Installation
|
||||
uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
install-command: yarn install
|
||||
# install-command: yarn install --immutable # Fails if yarn.lock is modified (unfortunately only works for Yarn 2, and --frozen-lockfile is not the same!)
|
||||
cache: yarn
|
||||
- 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
|
||||
run: git diff --exit-code
|
||||
- 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:
|
||||
- main
|
||||
paths:
|
||||
- 'website-1.x/blog/**'
|
||||
- 'packages/docusaurus/**'
|
||||
- packages/docusaurus/**
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -15,9 +14,9 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- name: Installation
|
||||
uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
install-command: yarn
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
- name: Build blog-only
|
||||
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:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
cache: yarn
|
||||
- uses: preactjs/compressed-size-action@v2
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
build-script: 'build:website:en'
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
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}'
|
||||
strip-hash: '\.([^;]\w{7})\.'
|
||||
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:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'website/docs/**'
|
||||
- website/docs/**
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -14,10 +14,10 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- name: Installation
|
||||
uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
install-command: yarn
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn
|
||||
|
||||
# Ensure build with a cold cache does not increase too much
|
||||
- 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
|
||||
id: netlify
|
||||
with:
|
||||
site_name: 'docusaurus-2'
|
||||
site_name: docusaurus-2
|
||||
max_timeout: 600
|
||||
- name: Audit URLs using Lighthouse
|
||||
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
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
install-command: yarn
|
||||
run: yarn
|
||||
- name: Generate test-website project against main branch
|
||||
run: |
|
||||
KEEP_CONTAINER=true yarn test:build:website -s
|
||||
|
@ -50,17 +49,16 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
node: ['14']
|
||||
nodeLinker: ['pnp', 'node-modules']
|
||||
nodeLinker: [pnp, node-modules]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
install-command: yarn
|
||||
run: yarn
|
||||
|
||||
- name: Generate test-website project against main branch
|
||||
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
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
|
||||
- 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
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- name: Installation
|
||||
uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
install-command: yarn
|
||||
run: yarn
|
||||
- name: Test
|
||||
run: yarn test
|
||||
- name: TypeCheck website
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue