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

[legacy-framework] Fix blitz dev not working on Windows and add more Windows CI tests #2554

Merged
merged 26 commits into from
Jul 7, 2021
Merged
198 changes: 111 additions & 87 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ jobs:
env:
CI: true

build:
name: Build
build-linux:
name: Build (Linux)
runs-on: ubuntu-latest
env:
NEXT_TELEMETRY_DISABLED: 1
outputs:
docsChange: ${{ steps.docs-change.outputs.DOCS_CHANGE }}
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -84,32 +82,64 @@ jobs:
run: yarn build
- run: node run-tests.js --timings --write-timings -g 1/1
working-directory: nextjs
- name: Check docs only change
- uses: actions/cache@v2
id: cache-build
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}

build-windows:
name: Build (Windows)
runs-on: windows-latest
env:
NEXT_TELEMETRY_DISABLED: 1
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 25
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "14"
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules
id: yarn-cache
uses: actions/cache@v2
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: ${{ runner.os }}-${{ runner.node_version}}-yarn-v13-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.node_version}}-yarn-v13-
- run: yarn install --frozen-lockfile --check-files
- name: Build Packages
run: yarn build
- run: node run-tests.js --timings --write-timings -g 1/1
working-directory: nextjs
run: echo ::set-output name=DOCS_CHANGE::$(node skip-docs-change.js echo 'not-docs-only-change')
id: docs-change
- run: echo ${{steps.docs-change.outputs.DOCS_CHANGE}}
- uses: actions/cache@v2
id: cache-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ github.sha }}

testBlitzPackages:
name: Blitz - Test Packages
needs: build
needs: build-linux
runs-on: ubuntu-latest
env:
NEXT_TELEMETRY_DISABLED: 1
steps:
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ github.sha }}
- name: Setup kernel to increase watchers
if: matrix.os == 'ubuntu-latest'
if: runner.os == 'Linux'
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Test Blitz Packages
run: yarn testonly:packages
Expand All @@ -119,45 +149,25 @@ jobs:
testBlitzExamples:
timeout-minutes: 30
name: Blitz - Test Example Apps
needs: build-linux
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
NEXT_TELEMETRY_DISABLED: 1
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 25
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "14"
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules
id: yarn-cache
uses: actions/cache@v2
- uses: actions/cache@v2
id: restore-build
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
**/node_modules
key: ${{ runner.os }}-${{ runner.node_version}}-yarn-v13-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.node_version}}-yarn-v13-
- run: yarn install --frozen-lockfile --check-files
# - run: yarn cpy node_modules/.blitz packages/core/node_modules/.blitz
# if: matrix.os == 'windows-latest'
- name: Build Packages
run: yarn build
path: ./*
key: ${{ runner.os }}-${{ github.sha }}
# Needed to get cypress binary
- run: yarn cypress install
- name: Install sass
run: yarn install -W sass
- name: Setup kernel to increase watchers
if: matrix.os == 'ubuntu-latest'
if: runner.os == 'Linux'
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Test examples
run: yarn testonly:examples
Expand All @@ -170,74 +180,82 @@ jobs:
run:
working-directory: nextjs
runs-on: ubuntu-latest
needs: build
needs: build-linux
env:
NEXT_TELEMETRY_DISABLED: 1
steps:
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ github.sha }}
- run: ./check-pre-compiled.sh
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

testUnit:
name: Nextjs - Test Unit
defaults:
run:
working-directory: nextjs
runs-on: ubuntu-latest
needs: build
needs: build-linux
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
HEADLESS: true
steps:
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ github.sha }}

- run: node run-tests.js --timings --type unit -g 1/1
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

testIntegrationBlitz:
name: Blitz - Test Integration
name: Blitz - Test Integration (Linux)
needs: build-linux
runs-on: ubuntu-latest
needs: build
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
HEADLESS: true
strategy:
fail-fast: false
steps:
- run: echo ${{needs.build.outputs.docsChange}}
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ 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 change'}}
- name: Setup kernel to increase watchers
if: runner.os == 'Linux'
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

- run: xvfb-run node nextjs/run-tests.js -c 3
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

testIntegrationBlitzWin:
name: Blitz - Test Integration (Windows)
needs: build-windows
runs-on: windows-latest
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
HEADLESS: true
steps:
- uses: actions/cache@v2
id: restore-build
with:
path: ./*
key: ${{ runner.os }}-${{ github.sha }}
- run: node nextjs/run-tests.js -c 3

testIntegration:
name: Nextjs - Test Integration
defaults:
run:
working-directory: nextjs
runs-on: ubuntu-latest
needs: build
needs: build-linux
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
Expand All @@ -247,51 +265,62 @@ jobs:
matrix:
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
steps:
- run: echo ${{needs.build.outputs.docsChange}}
working-directory: ./
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ 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 change'}}

- name: Setup kernel to increase watchers
if: runner.os == 'Linux'
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- run: xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/20 -c 3
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

testIntegrationWin:
name: Nextjs - Test Integration (Windows)
defaults:
run:
working-directory: nextjs
runs-on: windows-latest
needs: build-windows
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
HEADLESS: true
steps:
- uses: actions/cache@v2
id: restore-build
with:
path: ./*
key: ${{ github.sha }}

- run: node run-tests.js test/integration/{basic,production,multi-pages}/test/index.test.js test/acceptance/*.test.js

testElectron:
name: Nextjs - Test Electron
defaults:
run:
working-directory: nextjs
runs-on: ubuntu-latest
needs: build
needs: build-linux
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 change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ 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 change'}}

- name: Setup kernel to increase watchers
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- run: cd test/integration/with-electron/app && yarn
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

- run: xvfb-run node run-tests.js test/integration/with-electron/test/index.test.js
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

testsPass:
name: thank you, next
Expand All @@ -301,6 +330,7 @@ jobs:
checkPrecompiled,
testIntegration,
testIntegrationBlitz,
testIntegrationBlitzWin,
testUnit,
testBlitzPackages,
testBlitzExamples,
Expand All @@ -314,28 +344,26 @@ jobs:
run:
working-directory: nextjs
runs-on: ubuntu-latest
needs: build
needs: build-linux
env:
HEADLESS: true
BROWSER_NAME: "firefox"
NEXT_TELEMETRY_DISABLED: 1
steps:
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ github.sha }}
- run: node run-tests.js -c 1 test/integration/production/test/index.test.js
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

testSafari:
name: Nextjs - Test Safari (production)
defaults:
run:
working-directory: nextjs
runs-on: ubuntu-latest
needs: build
needs: build-linux
env:
BROWSERSTACK: true
BROWSER_NAME: "safari"
Expand All @@ -345,21 +373,19 @@ jobs:
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
steps:
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ github.sha }}
- run: '[[ -z "$BROWSERSTACK_ACCESS_KEY" ]] && echo "Skipping for PR" || node run-tests.js -c 1 test/integration/production/test/index.test.js'
if: ${{needs.build.outputs.docsChange != 'docs only change'}}

testSafariOld:
name: Nextjs - Test Safari 10.1 (nav)
defaults:
run:
working-directory: nextjs
runs-on: ubuntu-latest
needs: [build, testSafari]
needs: [build-linux, testSafari]
env:
BROWSERSTACK: true
LEGACY_SAFARI: true
Expand All @@ -370,10 +396,8 @@ jobs:
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
steps:
- uses: actions/cache@v2
if: ${{needs.build.outputs.docsChange != 'docs only change'}}
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
key: ${{ runner.os }}-${{ 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 change'}}