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

Azure Pipelines support #2

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
cd8d473
Initial Azure Pipelines setup, inlcuding Ed's original changes
ianschmitz Feb 11, 2019
34f30a3
Cleanup YAML
willsmythe Mar 26, 2019
7a8bd40
More cleanup
willsmythe Mar 26, 2019
0abce2b
Add log statement to e2e-simple.sh
willsmythe Mar 26, 2019
f843fb5
Set Git user/email; remove debug lines
willsmythe Mar 26, 2019
63060eb
Fix for not finding test on Windows; see https://github.com/facebook/…
willsmythe Mar 26, 2019
2434ac6
Add logging for eject issue
willsmythe Mar 26, 2019
647b342
Fix for eject-related issue with @babel/plugin-transform-react-jsx
willsmythe Mar 27, 2019
057c748
Workaround for plugin-transform-react-jsx issue; Verdaccio update
willsmythe Mar 27, 2019
7155ff3
Third attempt at babel/plugin-transform-react-jsx fix
willsmythe Mar 27, 2019
e52d094
Another fix for timeouts on Windows; transform-react-jsx-source
willsmythe Mar 27, 2019
b3695cb
Add @babel/plugin-syntax-jsx after ejection
willsmythe Mar 27, 2019
1d6c184
Fix failing tests on Windows; one more attempt at fixing eject issue
willsmythe Mar 27, 2019
5c54142
Fix failing tests on Windows due to temp directory deletion; fix simple
willsmythe Mar 27, 2019
2bd8f87
Fix line endings on setup.js
willsmythe Mar 27, 2019
987fcb2
Try enhanced Verdaccio fix
willsmythe Mar 28, 2019
058f683
Set YARN_CACHE_FOLDER for all test suites
willsmythe Apr 1, 2019
3ad6a81
Merge branch 'mar26' of https://github.com/willsmythe/create-react-ap…
willsmythe Apr 1, 2019
a4a9db5
Seed yarn cache folder
willsmythe Apr 1, 2019
2773485
tar.gz yarn cache
willsmythe Apr 1, 2019
00c98fa
Set NPM cache folder; show yarn and npm cache folders
willsmythe Apr 2, 2019
a4e0039
Show NPM and Yarn cache folders
willsmythe Apr 2, 2019
62a9007
create npm cache directory
willsmythe Apr 2, 2019
2d5bc9b
Another attempt at setting NPM cache directory
willsmythe Apr 2, 2019
6322b9e
NPM cache folder set; attempt 4
willsmythe Apr 2, 2019
8a86ac4
Attempt #5 of NPM cache
willsmythe Apr 2, 2019
1bc6864
Set clone depth
willsmythe Apr 2, 2019
bfefe49
Drop attempt to set NPM cache
willsmythe Apr 2, 2019
d70953e
clone depth 2
willsmythe Apr 2, 2019
65ec11a
normal fetch depth
willsmythe Apr 2, 2019
5c24a13
Fix jest dependency shift
willsmythe Apr 2, 2019
11562d3
fix react-dev-utils dep
willsmythe Apr 2, 2019
7fb0c60
lock to jest 24.5.0
willsmythe Apr 2, 2019
95268b0
lock to jest 24.6
willsmythe Apr 2, 2019
27f60cc
Fix kitchensink; jest dependency issue
willsmythe Apr 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .azure-pipelines-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Azure Pipelines steps for building and testing create-react-app on Linux, Windows, and macOS.
#

steps:
- script: |
git config --global core.autocrlf false
git config --global user.name "Create React App"
git config --global user.email "cra@email.com"
displayName: 'Initialize Git config settings'

- checkout: self

- task: NodeTool@0
inputs:
versionSpec: $(NODE_VERSION)
displayName: 'Install Node.js'

- script: yarn --frozen-lockfile
displayName: 'Install packages'
130 changes: 130 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#
# Azure Pipelines configuration for building and testing create-react-app on Linux, Windows, and macOS.
#

trigger:
- master

variables:
CI: true
VSTS_OVERWRITE_TEMP: True
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting VSTS_OVERWRITE_TEMP avoids test problems related to weirdness with "temp" path math (especially on Windows where the short and long file paths are different)


# ******************************************************************************
# Simple test suite
# ******************************************************************************
jobs:
- job: Simple
strategy:
matrix:
LinuxNode8: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 8.x }
LinuxNode10: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 10.x }
MacNode8: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 8.x }
MacNode10: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 10.x }
WindowsNode8: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 8.x }
WindowsNode10: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 10.x }
pool:
vmImage: $(VM_IMAGE)
steps:
- template: .azure-pipelines-steps.yml
- bash: tasks/e2e-simple.sh
displayName: 'Run tests'

# ******************************************************************************
# Installs test suite
# ******************************************************************************
- job: Installs
strategy:
matrix:
LinuxNode8: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 8.x }
LinuxNode10: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 10.x }
MacNode8: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 8.x }
MacNode10: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 10.x }
WindowsNode8: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 8.x }
WindowsNode10: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 10.x }
pool:
vmImage: $(VM_IMAGE)
variables:
YARN_CACHE_FOLDER: $(Build.SourcesDirectory)/../yarn-cache
steps:
- template: .azure-pipelines-steps.yml
- bash: tasks/e2e-installs.sh
displayName: 'Run tests'

# ******************************************************************************
# Kitchensink test suite
# ******************************************************************************
- job: Kitchensink
strategy:
matrix:
LinuxNode8: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 8.x }
LinuxNode10: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 10.x }
MacNode8: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 8.x }
MacNode10: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 10.x }
WindowsNode8: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 8.x }
WindowsNode10: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 10.x }
pool:
vmImage: $(VM_IMAGE)
steps:
- template: .azure-pipelines-steps.yml
- bash: tasks/e2e-kitchensink.sh
displayName: 'Run tests'

# ******************************************************************************
# Kitchensink Eject test suite
# ******************************************************************************
- job: KitchensinkEject
strategy:
matrix:
LinuxNode8: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 8.x }
LinuxNode10: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 10.x }
MacNode8: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 8.x }
MacNode10: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 10.x }
WindowsNode8: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 8.x }
WindowsNode10: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 10.x }
pool:
vmImage: $(VM_IMAGE)
steps:
- template: .azure-pipelines-steps.yml
- bash: tasks/e2e-kitchensink-eject.sh
displayName: 'Run tests'

# ******************************************************************************
# Behavior test suite
# ******************************************************************************
- job: Behavior
strategy:
matrix:
LinuxNode8: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 8.x }
LinuxNode10: { VM_IMAGE: 'ubuntu-16.04', NODE_VERSION: 10.x }
MacNode8: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 8.x }
MacNode10: { VM_IMAGE: 'macOS-10.13', NODE_VERSION: 10.x }
WindowsNode8: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 8.x }
WindowsNode10: { VM_IMAGE: 'vs2017-win2016', NODE_VERSION: 10.x }
pool:
vmImage: $(VM_IMAGE)
steps:
- template: .azure-pipelines-steps.yml
- bash: tasks/e2e-behavior.sh
displayName: 'Run tests'

# ******************************************************************************
# Old Node test suite
# ******************************************************************************
- job: OldNode
strategy:
matrix:
LinuxNode6:
VM_IMAGE: 'ubuntu-16.04'
MacNode6:
VM_IMAGE: 'macOS-10.13'
WindowsNode6:
VM_IMAGE: 'vs2017-win2016'
pool:
vmImage: $(VM_IMAGE)
steps:
- task: NodeTool@0
inputs:
versionSpec: 6.x
displayName: 'Install Node.js'
- bash: tasks/e2e-old-node.sh
displayName: 'Run tests'
2 changes: 1 addition & 1 deletion packages/react-scripts/scripts/utils/createJestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
setupFilesAfterEnv: setupTestsFile ? [setupTestsFile] : [],
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
'<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}',
'<rootDir>/src/**/*(*.)@(spec|test).{js,jsx,ts,tsx}',
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See jestjs/jest#7914 for details. This change was needed because of a breaking change in Jest v24.

],
testEnvironment: 'jsdom',
testURL: 'http://localhost',
Expand Down
24 changes: 7 additions & 17 deletions tasks/e2e-behavior.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ cd "$(dirname "$0")"
# http://unix.stackexchange.com/a/84980
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
temp_module_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_module_path'`
custom_registry_url=http://localhost:4873
original_npm_registry_url=`npm get registry`
original_yarn_registry_url=`yarn config get registry`

# Load Verdaccio-related functions
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consolidated all Verdaccio related logic into one script that each of the e2e scripts now references (avoids a bunch of duplication).

source verdaccio.sh

function cleanup {
echo 'Cleaning up.'
ps -ef | grep 'verdaccio' | grep -v grep | awk '{print $2}' | xargs kill -9
ps -ef | grep 'react-scripts' | grep -v grep | awk '{print $2}' | xargs kill -9
cd "$root_path"
npm set registry "$original_npm_registry_url"
yarn config set registry "$original_yarn_registry_url"
# Restore the original NPM and Yarn registry URLs
restoreRegistryUrls
}

# Error messages are redirected to stderr
Expand Down Expand Up @@ -75,18 +75,8 @@ yarn
# First, publish the monorepo.
# ******************************************************************************

# Start local registry
tmp_registry_log=`mktemp`
(cd && nohup npx verdaccio@3.8.2 -c "$root_path"/tasks/verdaccio.yaml &>$tmp_registry_log &)
# Wait for `verdaccio` to boot
grep -q 'http address' <(tail -f $tmp_registry_log)

# Set registry to local registry
npm set registry "$custom_registry_url"
yarn config set registry "$custom_registry_url"

# Login so we can publish packages
(cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url")
# Start the local NPM registry
startVerdaccio "$root_path"/tasks/verdaccio.yaml

# Publish the monorepo
git clean -df
Expand Down
29 changes: 11 additions & 18 deletions tasks/e2e-installs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ cd "$(dirname "$0")"
# CLI and app temporary locations
# http://unix.stackexchange.com/a/84980
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
custom_registry_url=http://localhost:4873
original_npm_registry_url=`npm get registry`
original_yarn_registry_url=`yarn config get registry`

# Load Verdaccio-related functions
source ./verdaccio.sh

function cleanup {
echo 'Cleaning up.'
ps -ef | grep 'verdaccio' | grep -v grep | awk '{print $2}' | xargs kill -9
cd "$root_path"
rm -rf "$temp_app_path"
npm set registry "$original_npm_registry_url"
yarn config set registry "$original_yarn_registry_url"
# Restore the original NPM and Yarn registry URLs
restoreRegistryUrls
}

# Error messages are redirected to stderr
Expand Down Expand Up @@ -96,18 +95,8 @@ yarn
# First, publish the monorepo.
# ******************************************************************************

# Start local registry
tmp_registry_log=`mktemp`
(cd && nohup npx verdaccio@3.8.2 -c "$root_path"/tasks/verdaccio.yaml &>$tmp_registry_log &)
# Wait for `verdaccio` to boot
grep -q 'http address' <(tail -f $tmp_registry_log)

# Set registry to local registry
npm set registry "$custom_registry_url"
yarn config set registry "$custom_registry_url"

# Login so we can publish packages
(cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url")
# Start the local NPM registry
startVerdaccio "$root_path"/tasks/verdaccio.yaml

# Publish the monorepo
git clean -df
Expand Down Expand Up @@ -184,6 +173,10 @@ CI=true yarn test
# Eject...
echo yes | npm run eject

# Temporary workaround for https://github.com/facebook/create-react-app/issues/6099
rm yarn.lock
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workaround is due to facebook#6679 (which looks like a duplicate of facebook#6099). Without this, build/test almost always fails due to a missing @babel plugin. Like is discussed in the issues, I haven't found a way to repro locally (at least not consistently).

yarn add @babel/plugin-transform-react-jsx-source @babel/plugin-syntax-jsx @babel/plugin-transform-react-jsx @babel/plugin-transform-react-jsx-self

# Ensure env file still exists
exists src/react-app-env.d.ts

Expand Down
28 changes: 11 additions & 17 deletions tasks/e2e-kitchensink-eject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ cd "$(dirname "$0")"
# http://unix.stackexchange.com/a/84980
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
temp_module_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_module_path'`
custom_registry_url=http://localhost:4873
original_npm_registry_url=`npm get registry`
original_yarn_registry_url=`yarn config get registry`

# Load Verdaccio-related functions
source verdaccio.sh

function cleanup {
echo 'Cleaning up.'
Expand All @@ -28,8 +28,8 @@ function cleanup {
cd "$root_path"
# TODO: fix "Device or resource busy" and remove ``|| $CI`
rm -rf "$temp_app_path" "$temp_module_path" || $CI
npm set registry "$original_npm_registry_url"
yarn config set registry "$original_yarn_registry_url"
# Restore the original NPM and Yarn registry URLs
restoreRegistryUrls
}

# Error messages are redirected to stderr
Expand Down Expand Up @@ -78,18 +78,8 @@ yarn
# First, publish the monorepo.
# ******************************************************************************

# Start local registry
tmp_registry_log=`mktemp`
(cd && nohup npx verdaccio@3.8.2 -c "$root_path"/tasks/verdaccio.yaml &>$tmp_registry_log &)
# Wait for `verdaccio` to boot
grep -q 'http address' <(tail -f $tmp_registry_log)

# Set registry to local registry
npm set registry "$custom_registry_url"
yarn config set registry "$custom_registry_url"

# Login so we can publish packages
(cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url")
# Start the local NPM registry
startVerdaccio "$root_path"/tasks/verdaccio.yaml

# Publish the monorepo
git clean -df
Expand Down Expand Up @@ -128,6 +118,10 @@ npm link "$temp_module_path/node_modules/test-integrity"
# Eject...
echo yes | npm run eject

# Temporary workaround for https://github.com/facebook/create-react-app/issues/6099
rm yarn.lock
yarn add @babel/plugin-transform-react-jsx-source @babel/plugin-syntax-jsx @babel/plugin-transform-react-jsx @babel/plugin-transform-react-jsx-self

# Link to test module
npm link "$temp_module_path/node_modules/test-integrity"

Expand Down
24 changes: 7 additions & 17 deletions tasks/e2e-kitchensink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ cd "$(dirname "$0")"
# http://unix.stackexchange.com/a/84980
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
temp_module_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_module_path'`
custom_registry_url=http://localhost:4873
original_npm_registry_url=`npm get registry`
original_yarn_registry_url=`yarn config get registry`

# Load Verdaccio-related functions
source verdaccio.sh

function cleanup {
echo 'Cleaning up.'
Expand All @@ -28,8 +28,8 @@ function cleanup {
cd "$root_path"
# TODO: fix "Device or resource busy" and remove ``|| $CI`
rm -rf "$temp_app_path" "$temp_module_path" || $CI
npm set registry "$original_npm_registry_url"
yarn config set registry "$original_yarn_registry_url"
# Restore the original NPM and Yarn registry URLs
restoreRegistryUrls
}

# Error messages are redirected to stderr
Expand Down Expand Up @@ -78,18 +78,8 @@ yarn
# First, publish the monorepo.
# ******************************************************************************

# Start local registry
tmp_registry_log=`mktemp`
(cd && nohup npx verdaccio@3.8.2 -c "$root_path"/tasks/verdaccio.yaml &>$tmp_registry_log &)
# Wait for `verdaccio` to boot
grep -q 'http address' <(tail -f $tmp_registry_log)

# Set registry to local registry
npm set registry "$custom_registry_url"
yarn config set registry "$custom_registry_url"

# Login so we can publish packages
(cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url")
# Start the local NPM registry
startVerdaccio "$root_path"/tasks/verdaccio.yaml

# Publish the monorepo
git clean -df
Expand Down
Loading