Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(workflow): add cache to workflows using actions/setup-node #5697

Merged
merged 4 commits into from
Oct 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/canary-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths:
- 'packages/**'
- "packages/**"

jobs:
publish-canary:
Expand All @@ -21,6 +21,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Prepare git
run: |
git config --global user.name "Docusaurus Canary"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: npm
- 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!)
run: npm ci
- name: Check immutable yarn.lock
run: git diff --exit-code
- name: Lint
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/v2-build-blog-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
branches:
- main
paths:
- 'website-1.x/blog/**'
- 'packages/docusaurus/**'
- "website-1.x/blog/**"
- "packages/docusaurus/**"

jobs:
build:
Expand All @@ -15,9 +15,11 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: npm
- name: Installation
uses: bahmutov/npm-install@v1
with:
install-command: yarn
run: npm ci
- name: Build blog-only
run: yarn workspace website build:blogOnly
10 changes: 6 additions & 4 deletions .github/workflows/v2-build-size-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: npm
- uses: preactjs/compressed-size-action@v2
with:
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}'
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"
6 changes: 4 additions & 2 deletions .github/workflows/v2-build-time-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths-ignore:
- 'website/docs/**'
- "website/docs/**"

jobs:
build:
Expand All @@ -14,10 +14,12 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: npm
- name: Installation
uses: bahmutov/npm-install@v1
with:
install-command: yarn
run: npm ci

# Ensure build with a cold cache does not increase too much
- name: Build (cold cache)
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/v2-tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['12', '14']
node: ["12", "14"]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Installation
uses: bahmutov/npm-install@v1
with:
install-command: yarn
run: npm ci
- name: Generate test-website project against main branch
run: |
KEEP_CONTAINER=true yarn test:build:website -s
Expand All @@ -49,18 +50,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['14']
nodeLinker: ['pnp', 'node-modules']
node: ["14"]
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: npm
- name: Installation
uses: bahmutov/npm-install@v1
with:
install-command: yarn
run: npm ci

- name: Generate test-website project against main branch
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/v2-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
node: ['12', '14']
node: ["12", "14"]
steps:
- name: Support longpaths
run: git config --system core.longpaths true
Expand All @@ -20,6 +20,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Installation
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
- name: Docusaurus Jest Tests
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/v2-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['12', '14']
node: ["12", "14"]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Installation
uses: bahmutov/npm-install@v1
with:
install-command: yarn
run: npm ci
- name: Test
run: yarn test
- name: TypeCheck website
Expand Down