mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 00:09:48 +02:00
chore: simplify CI setup (#4447)
* improve ci * improve ci * use actions/setup-node@v2 everywhere * run pwd for test * debug gh action * debug glob CI issue? * Separate v1/v2 tests due to shell conflict * cleanup * test v1 change * circleci fix * fix test docusaurus v1 paths * Refactor CI script names and use paths to filter actions from running unnecessary * fix lighthouse url * v1 tests runInBand * try to fix v1 tests race conditions * change rootDir for v1 tests * minor CI improvements
This commit is contained in:
parent
1135d19333
commit
3422f80a9a
26 changed files with 243 additions and 187 deletions
|
@ -1,27 +1,14 @@
|
|||
name: Canary releases
|
||||
name: Canary Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'packages/**'
|
||||
|
||||
jobs:
|
||||
checkPackagesHaveChanged:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
packagesHaveChanged: ${{ steps.filter.outputs.packagesHaveChanged }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
packagesHaveChanged:
|
||||
- 'packages/**'
|
||||
|
||||
publish-canary:
|
||||
needs: checkPackagesHaveChanged
|
||||
if: ${{ needs.checkPackagesHaveChanged.outputs.packagesHaveChanged == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -29,7 +16,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Prepare git
|
21
.github/workflows/lint.yml
vendored
Normal file
21
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- name: Installation
|
||||
run: yarn
|
||||
- name: Lint
|
||||
run: yarn lint
|
||||
- name: Prettier Code
|
||||
run: yarn prettier:diff
|
||||
- name: Prettier Docs
|
||||
run: yarn prettier-docs:diff
|
|
@ -1,25 +1,15 @@
|
|||
name: Migration CLI E2E Test
|
||||
name: Migration CLI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- packages/docusaurus-migration/**
|
||||
- website-1.x/**
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
migration: ${{ steps.filter.outputs.migration }}
|
||||
steps:
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
migration:
|
||||
- 'packages/docusaurus-migration/**'
|
||||
build:
|
||||
needs: check
|
||||
if: ${{ needs.check.outputs.migration == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -27,7 +17,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
28
.github/workflows/v1-tests-windows.yml
vendored
Normal file
28
.github/workflows/v1-tests-windows.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: V1 Tests Windows
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['12', '14']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
|
||||
- name: Docusaurus 1 Tests
|
||||
run: yarn test:v1
|
||||
# Not useful to build v1 site because tests already build v1 (packages/docusaurus-1.x/lib/__tests__/build-files.test.js)
|
28
.github/workflows/v1-tests.yml
vendored
Normal file
28
.github/workflows/v1-tests.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: V1 Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['12', '14']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
run: yarn
|
||||
- name: Test
|
||||
run: yarn test:v1
|
||||
# Not useful to build v1 site because tests already build v1 (packages/docusaurus-1.x/lib/__tests__/build-files.test.js)
|
20
.github/workflows/v2-build-blog-only.yml
vendored
Normal file
20
.github/workflows/v2-build-blog-only.yml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
name: V2 Build Blog-only
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'website-1.x/blog/**'
|
||||
- 'packages/docusaurus/**'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- name: Installation
|
||||
run: yarn
|
||||
- name: Build blog-only
|
||||
run: yarn workspace docusaurus-2-website build:blogOnly
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
name: Build Size Report
|
||||
name: V2 Build Size Report
|
||||
|
||||
on:
|
||||
# Note! you can't safely use "pull_request_target" here
|
||||
|
@ -10,12 +10,17 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
- uses: preactjs/compressed-size-action@v2
|
||||
with:
|
||||
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
|
@ -1,6 +1,13 @@
|
|||
name: Lighthouse Report
|
||||
name: V2 Lighthouse Report
|
||||
|
||||
on: pull_request_target
|
||||
on:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -18,8 +25,8 @@ jobs:
|
|||
uses: treosh/lighthouse-ci-action@v3
|
||||
with:
|
||||
urls: |
|
||||
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/classic/
|
||||
configPath: ./.github/workflows/lighthousesrc.json
|
||||
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/
|
||||
configPath: ./.github/workflows/v2-lighthousesrc.json
|
||||
uploadArtifacts: true
|
||||
temporaryPublicStorage: true
|
||||
env:
|
|
@ -1,4 +1,4 @@
|
|||
name: E2E Test
|
||||
name: V2 Tests E2E
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -7,6 +7,10 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
yarn-v1:
|
||||
|
@ -17,7 +21,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
|
@ -42,7 +46,7 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
|
@ -1,9 +1,13 @@
|
|||
name: Windows Build Test
|
||||
name: V2 Windows Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -13,25 +17,15 @@ jobs:
|
|||
node: ['12', '14']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: dorny/paths-filter@v2
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
v1:
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
run: yarn || yarn || yarn # 3 attempts to avoid timeout errors...
|
||||
- name: Docusaurus 1 Build
|
||||
if: steps.filter.outputs.v1 == 'true'
|
||||
run: yarn build:v1
|
||||
- name: Docusaurus Jest Tests
|
||||
run: yarn test
|
||||
- name: Docusaurus 2 Build
|
||||
- name: Docusaurus Build
|
||||
run: yarn build:v2
|
||||
env:
|
||||
CI: true
|
27
.github/workflows/v2-tests.yml
vendored
Normal file
27
.github/workflows/v2-tests.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
name: V2 Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- 'website-1.x/**'
|
||||
- 'packages/docusaurus-1.x/**'
|
||||
- 'packages/docusaurus-init-1.x/**'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: ['12', '14']
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- name: Installation
|
||||
run: yarn
|
||||
- name: Test
|
||||
run: yarn test
|
Loading…
Add table
Add a link
Reference in a new issue