Skip to content

Commit

Permalink
Update Azure config (vercel#18931)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Nov 9, 2020
1 parent 9e59a6b commit 3cece4d
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 78 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ packages/next-codemod/**/*.js
packages/next-codemod/**/*.d.ts
packages/next-env/**/*.d.ts
test/integration/async-modules/**
test-timings.json
1 change: 1 addition & 0 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
- 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/4
- uses: actions/cache@v2
id: cache-build
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ examples/**/out
examples/**/.env*.local

pr-stats.md
test-timings.json

# Vercel
.vercel
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ packages/next-codemod/transforms/__testfixtures__/**/*
packages/next-codemod/transforms/__tests__/**/*
packages/next-codemod/**/*.js
packages/next-codemod/**/*.d.ts
packages/next-env/**/*.d.ts
packages/next-env/**/*.d.ts
test-timings.json
153 changes: 92 additions & 61 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,95 @@ variables:
NEXT_TELEMETRY_DISABLED: '1'
node_version: ^10.10.0

jobs:
- job: test_ie11
pool:
vmImage: 'windows-2019'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'

- task: CacheBeta@0
inputs:
key: yarn | $(Agent.OS) | yarn.lock
path: $(YARN_CACHE_FOLDER)
displayName: Cache Yarn packages

- script: |
yarn install --frozen-lockfile --check-files
displayName: 'Install dependencies'
- script: |
yarn testie --forceExit test/integration/production/
displayName: 'Run tests'
- job: test_chrome
pool:
vmImage: 'windows-2019'
strategy:
maxParallel: 10
matrix:
node-10-1:
group: 1/4
node-10-2:
group: 2/4
node-10-3:
group: 3/4
node-10-4:
group: 4/4
steps:
- script: |
wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value
displayName: 'List Chrome version'
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'

- task: CacheBeta@0
inputs:
key: yarn | $(Agent.OS) | yarn.lock
path: $(YARN_CACHE_FOLDER)
displayName: Cache Yarn packages

- script: |
yarn install --frozen-lockfile --check-files
displayName: 'Install dependencies'
- script: |
node run-tests.js -g $(group) --timings --azure
displayName: 'Run tests'
stages:
- stage: Build
jobs:
- job: build
pool:
vmImage: 'windows-2019'
steps:
- script: echo $(Agent.BuildDirectory)
- script: dir
- script: dir $(System.DefaultWorkingDirectory)
- script: echo $(System.pullRequest.sourceCommitId)
- powershell: Set-MpPreference -ExclusionPath $(System.DefaultWorkingDirectory)
- powershell: Set-MpPreference -ExclusionPath $(Pipeline.Workspace)/.yarn
- powershell: Set-MpPreference -DisableIntrusionPreventionSystem $true -DisableIOAVProtection $true -DisableRealtimeMonitoring $true -DisableScriptScanning $true -EnableControlledFolderAccess Disabled -EnableNetworkProtection AuditMode -Force -MAPSReporting Disabled -SubmitSamplesConsent NeverSend
- powershell: Get-MpComputerStatus
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- task: Cache@2
inputs:
# use deterministic cache key that is specific
# to this test run
key: $(System.pullRequest.sourceCommitId)
path: $(System.DefaultWorkingDirectory)
displayName: Cache Build
- script: |
yarn install --frozen-lockfile --check-files
displayName: 'Install dependencies'
- script: |
node run-tests.js --timings --write-timings --azure -g 1/4
displayName: 'Fetch test timing data'
- stage: Test
dependsOn: Build
jobs:
- job: test_ie11
pool:
vmImage: 'windows-2019'
steps:
- checkout: none
- powershell: Set-MpPreference -ExclusionPath $(System.DefaultWorkingDirectory)
- powershell: Set-MpPreference -ExclusionPath $(Pipeline.Workspace)/.yarn
- powershell: Set-MpPreference -DisableIntrusionPreventionSystem $true -DisableIOAVProtection $true -DisableRealtimeMonitoring $true -DisableScriptScanning $true -EnableControlledFolderAccess Disabled -EnableNetworkProtection AuditMode -Force -MAPSReporting Disabled -SubmitSamplesConsent NeverSend
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- task: Cache@2
inputs:
# use deterministic cache key that is specific
# to this test run
key: $(System.pullRequest.sourceCommitId)
path: $(System.DefaultWorkingDirectory)
displayName: Cache Build
- script: |
yarn testie --forceExit test/integration/production/
displayName: 'Run tests'
- job: test_chrome
pool:
vmImage: 'windows-2019'
strategy:
matrix:
node-10-1:
group: 1/4
node-10-2:
group: 2/4
node-10-3:
group: 3/4
node-10-4:
group: 4/4
steps:
- checkout: none
- powershell: Set-MpPreference -ExclusionPath $(System.DefaultWorkingDirectory)
- powershell: Set-MpPreference -ExclusionPath $(Pipeline.Workspace)/.yarn
- powershell: Set-MpPreference -DisableIntrusionPreventionSystem $true -DisableIOAVProtection $true -DisableRealtimeMonitoring $true -DisableScriptScanning $true -EnableControlledFolderAccess Disabled -EnableNetworkProtection AuditMode -Force -MAPSReporting Disabled -SubmitSamplesConsent NeverSend
- script: |
wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value
displayName: 'List Chrome version'
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- task: Cache@2
inputs:
# use deterministic cache key that is specific
# to this test run
key: $(System.pullRequest.sourceCommitId)
path: $(System.DefaultWorkingDirectory)
displayName: Cache Build
- script: |
node run-tests.js -g $(group) --timings --azure
displayName: 'Run tests'
29 changes: 22 additions & 7 deletions run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const TIMINGS_API = `https://next-timings.jjsweb.site/api/timings`
parseInt(process.argv[concurrencyIdx + 1], 10) || DEFAULT_CONCURRENCY

const outputTimings = process.argv.indexOf('--timings') !== -1
const writeTimings = process.argv.indexOf('--write-timings') !== -1
const isAzure = process.argv.indexOf('--azure') !== -1
const groupIdx = process.argv.indexOf('-g')
const groupArg = groupIdx !== -1 && process.argv[groupIdx + 1]
Expand All @@ -39,15 +40,29 @@ const TIMINGS_API = `https://next-timings.jjsweb.site/api/timings`
if (outputTimings && groupArg) {
console.log('Fetching previous timings data')
try {
const timingsRes = await fetch(
`${TIMINGS_API}?which=${isAzure ? 'azure' : 'actions'}`
)
const timingsFile = path.join(__dirname, 'test-timings.json')
try {
prevTimings = JSON.parse(await fs.readFile(timingsFile, 'utf8'))
console.log('Loaded test timings from disk successfully')
} catch (_) {}

if (!timingsRes.ok) {
throw new Error(`request status: ${timingsRes.status}`)
if (!prevTimings) {
const timingsRes = await fetch(
`${TIMINGS_API}?which=${isAzure ? 'azure' : 'actions'}`
)

if (!timingsRes.ok) {
throw new Error(`request status: ${timingsRes.status}`)
}
prevTimings = await timingsRes.json()
console.log('Fetched previous timings data successfully')

if (writeTimings) {
await fs.writeFile(timingsFile, JSON.stringify(prevTimings))
console.log('Wrote previous timings data to', timingsFile)
process.exit(0)
}
}
prevTimings = await timingsRes.json()
console.log('Fetched previous timings data successfully')
} catch (err) {
console.log(`Failed to fetch timings data`, err)
}
Expand Down
18 changes: 9 additions & 9 deletions test/integration/build-output/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,37 +91,37 @@ describe('Build Output', () => {
}

// should be no bigger than 265 bytes
expect(parseFloat(indexSize) - 265).toBeLessThanOrEqual(0)
expect(parseFloat(indexSize) - 266).toBeLessThanOrEqual(0)
expect(indexSize.endsWith('B')).toBe(true)

// should be no bigger than 60.8 kb
expect(parseFloat(indexFirstLoad) - 61.3).toBeLessThanOrEqual(0)
expect(parseFloat(indexFirstLoad) - 61.4).toBeLessThanOrEqual(0)
expect(indexFirstLoad.endsWith('kB')).toBe(true)

expect(parseFloat(err404Size) - 3.5).toBeLessThanOrEqual(0)
expect(parseFloat(err404Size) - 3.6).toBeLessThanOrEqual(0)
expect(err404Size.endsWith('kB')).toBe(true)

expect(parseFloat(err404FirstLoad) - 64.5).toBeLessThanOrEqual(0)
expect(parseFloat(err404FirstLoad) - 64.6).toBeLessThanOrEqual(0)
expect(err404FirstLoad.endsWith('kB')).toBe(true)

expect(parseFloat(sharedByAll) - 61.1).toBeLessThanOrEqual(0)
expect(parseFloat(sharedByAll) - 61.2).toBeLessThanOrEqual(0)
expect(sharedByAll.endsWith('kB')).toBe(true)

if (_appSize.endsWith('kB')) {
expect(parseFloat(_appSize)).toBeLessThanOrEqual(1.01)
expect(parseFloat(_appSize)).toBeLessThanOrEqual(1.02)
expect(_appSize.endsWith('kB')).toBe(true)
} else {
expect(parseFloat(_appSize) - 1000).toBeLessThanOrEqual(0)
expect(_appSize.endsWith(' B')).toBe(true)
}

expect(parseFloat(webpackSize) - 752).toBeLessThanOrEqual(0)
expect(parseFloat(webpackSize) - 753).toBeLessThanOrEqual(0)
expect(webpackSize.endsWith(' B')).toBe(true)

expect(parseFloat(mainSize) - 7.44).toBeLessThanOrEqual(0)
expect(parseFloat(mainSize) - 7.45).toBeLessThanOrEqual(0)
expect(mainSize.endsWith('kB')).toBe(true)

expect(parseFloat(frameworkSize) - 41).toBeLessThanOrEqual(0)
expect(parseFloat(frameworkSize) - 42).toBeLessThanOrEqual(0)
expect(frameworkSize.endsWith('kB')).toBe(true)
})

Expand Down

0 comments on commit 3cece4d

Please sign in to comment.