74b6389bd6
* ci: fix webpack 5 enabling for tests * refactor: move default location * Disable incompatible suite
301 lines
9.4 KiB
YAML
301 lines
9.4 KiB
YAML
on:
|
|
push:
|
|
branches: [canary]
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
|
|
name: Build, test, and deploy
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
outputs:
|
|
docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
- run: yarn install --frozen-lockfile --check-files
|
|
- run: node run-tests.js --timings --write-timings -g 1/1
|
|
- name: Check docs only change
|
|
run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'docs-only')
|
|
id: docs-change
|
|
- run: echo ${{steps.docs-change.outputs.DOCS_CHANGE}}
|
|
- uses: actions/cache@v2
|
|
id: cache-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- uses: actions/cache@v2
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
- run: yarn lint
|
|
|
|
checkPrecompiled:
|
|
name: Check Pre-compiled
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
env:
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
steps:
|
|
- uses: actions/cache@v2
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
- run: ./check-pre-compiled.sh
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
testUnit:
|
|
name: Test Unit
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
env:
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
NEXT_TEST_JOB: 1
|
|
HEADLESS: true
|
|
steps:
|
|
- uses: actions/cache@v2
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
|
|
- run: node run-tests.js --timings --type unit -g 1/1
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
testIntegration:
|
|
name: Test Integration
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
env:
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
NEXT_TEST_JOB: 1
|
|
HEADLESS: true
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
group: [1, 2, 3, 4, 5, 6]
|
|
steps:
|
|
- run: echo ${{needs.build.outputs.docsChange}}
|
|
- uses: actions/cache@v2
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
|
|
# TODO: remove after we fix watchpack watching too much
|
|
- run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
- run: xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/6 -c 3
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
testElectron:
|
|
name: Test Electron
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
env:
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
NEXT_TEST_JOB: 1
|
|
HEADLESS: true
|
|
TEST_ELECTRON: 1
|
|
steps:
|
|
- uses: actions/cache@v2
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
|
|
# TODO: remove after we fix watchpack watching too much
|
|
- run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
- run: yarn add -W --dev spectron@7.0.0 electron@5.0.0
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
- run: xvfb-run node run-tests.js test/integration/with-electron/test/index.test.js
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
testYarnPnP:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NODE_OPTIONS: '--unhandled-rejections=strict'
|
|
YARN_COMPRESSION_LEVEL: '0'
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'docs-only')
|
|
id: docs-change
|
|
|
|
- run: yarn install --frozen-lockfile --check-files
|
|
if: ${{steps.docs-change.outputs.DOCS_CHANGE != 'docs-only'}}
|
|
|
|
- run: bash ./test-pnp.sh
|
|
if: ${{steps.docs-change.outputs.DOCS_CHANGE != 'docs-only'}}
|
|
|
|
testsPass:
|
|
name: thank you, next
|
|
runs-on: ubuntu-latest
|
|
needs: [lint, checkPrecompiled, testIntegration, testUnit, testYarnPnP]
|
|
steps:
|
|
- run: exit 0
|
|
|
|
testFutureDependencies:
|
|
name: Webpack 5 (Basic, Production, Acceptance)
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
NEXT_TEST_JOB: 1
|
|
HEADLESS: true
|
|
NEXT_PRIVATE_TEST_WEBPACK5_MODE: 1
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'docs-only')
|
|
id: docs-change
|
|
|
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
|
|
|
|
- run: yarn install --check-files
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
|
|
|
|
- run: xvfb-run node run-tests.js test/integration/{link-ref,production,basic,async-modules,font-optimization,ssr-ctx}/test/index.test.js test/acceptance/*.test.js
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
|
|
|
|
testLegacyReact:
|
|
name: React 16 + Webpack 4 (Basic, Production, Acceptance)
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
NEXT_TEST_JOB: 1
|
|
HEADLESS: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'docs-only')
|
|
id: docs-change
|
|
|
|
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
|
|
|
|
- run: cat package.json | jq '.resolutions.react = "^16.14.0"' > package.json.tmp && mv package.json.tmp package.json
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
|
|
|
|
- run: cat package.json | jq '.resolutions."react-dom" = "^16.14.0"' > package.json.tmp && mv package.json.tmp package.json
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
|
|
|
|
- run: yarn install --check-files
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
|
|
|
|
- run: yarn list react react-dom
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
|
|
|
|
- run: xvfb-run node run-tests.js test/integration/{link-ref,production,basic,async-modules,font-optimization,ssr-ctx,worker-loader}/test/index.test.js test/acceptance/*.test.js
|
|
if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs-only' }}
|
|
|
|
testFirefox:
|
|
name: Test Firefox (production)
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
env:
|
|
HEADLESS: true
|
|
BROWSERNAME: 'firefox'
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
steps:
|
|
- uses: actions/cache@v2
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
- run: node run-tests.js test/integration/production/test/index.test.js
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
testSafari:
|
|
name: Test Safari (production)
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
env:
|
|
BROWSERSTACK: true
|
|
BROWSERNAME: 'safari'
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
SKIP_LOCAL_SELENIUM_SERVER: true
|
|
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
|
|
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
|
steps:
|
|
- uses: actions/cache@v2
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || node run-tests.js test/integration/production/test/index.test.js'
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
testSafariOld:
|
|
name: Test Safari 10.1 (nav)
|
|
runs-on: ubuntu-latest
|
|
needs: [build, testSafari]
|
|
env:
|
|
BROWSERSTACK: true
|
|
LEGACY_SAFARI: true
|
|
BROWSERNAME: 'safari'
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
SKIP_LOCAL_SELENIUM_SERVER: true
|
|
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
|
|
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
|
steps:
|
|
- uses: actions/cache@v2
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || node run-tests.js test/integration/production-nav/test/index.test.js'
|
|
if: ${{needs.build.outputs.docsChange != 'docs-only'}}
|
|
|
|
publishRelease:
|
|
name: Potentially publish release
|
|
runs-on: ubuntu-latest
|
|
needs: [testsPass]
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
steps:
|
|
- uses: actions/cache@v2
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
|
|
- run: ./publish-release.sh
|
|
|
|
prStats:
|
|
name: Release Stats
|
|
runs-on: ubuntu-latest
|
|
needs: [publishRelease]
|
|
steps:
|
|
- uses: actions/cache@v2
|
|
id: restore-build
|
|
with:
|
|
path: ./*
|
|
key: ${{ github.sha }}
|
|
- run: ./release-stats.sh
|
|
- uses: ./.github/actions/next-stats-action
|
|
env:
|
|
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}
|