From 058df4175af63d8605c3174f62c22837bcca2b0f Mon Sep 17 00:00:00 2001 From: Ian Schmitz Date: Tue, 2 Apr 2019 18:14:30 -0700 Subject: [PATCH 01/17] Add azure-pipelines.yml to make DevOps happy --- azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..f2894295b66 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,6 @@ +pool: + vmImage: 'Ubuntu 16.04' + +steps: +- script: echo Hello world! + displayName: Say hello From d93d16d0a7a36d36afc3c7c76f1bbddbec7b9062 Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Tue, 2 Apr 2019 14:55:11 -0400 Subject: [PATCH 02/17] Initial Azure Pipelines CI --- .azure-pipelines-steps.yml | 38 ++++++ .azure-pipelines.yml | 129 ++++++++++++++++++ .../scripts/utils/createJestConfig.js | 2 +- tasks/e2e-behavior.sh | 24 +--- tasks/e2e-installs.sh | 25 +--- tasks/e2e-kitchensink-eject.sh | 24 +--- tasks/e2e-kitchensink.sh | 24 +--- tasks/e2e-simple.sh | 28 ++-- tasks/verdaccio.sh | 27 ++++ tasks/verdaccio.yaml | 8 +- test/fixtures/__shared__/util/scripts.js | 4 +- test/fixtures/__shared__/util/setup.js | 10 +- .../webpack-message-formatting/index.test.js | 17 ++- 13 files changed, 266 insertions(+), 94 deletions(-) create mode 100644 .azure-pipelines-steps.yml create mode 100644 .azure-pipelines.yml create mode 100644 tasks/verdaccio.sh diff --git a/.azure-pipelines-steps.yml b/.azure-pipelines-steps.yml new file mode 100644 index 00000000000..e3c94b08c82 --- /dev/null +++ b/.azure-pipelines-steps.yml @@ -0,0 +1,38 @@ +# +# 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 + + - bash: | + export y=$(yarn cache dir) + echo "Yarn cache: ${y}" + mkdir -p $y + cd ${y}/.. + curl https://createreactapp.blob.core.windows.net/cache/yarn-cache-tar-gz | tar -xz + echo $(yarn cache list | wc --lines) + ls -la ${y}/npm-opn-5.5.0-fc7164fab56d235904c51c3b27da6758ca3b9bfc/node_modules/opn + + #echo "$(printenv)" + + #echo "Current NPM cache: $(npm config list)" + #export n="$(Build.SourcesDirectory)/../npm-cache" + #mkdir -p $n + #npm config set cache $n + #echo "New NPM cache: $(npm config list)" + displayName: 'Seed yarn cache' + + - task: NodeTool@0 + inputs: + versionSpec: $(NODE_VERSION) + displayName: 'Install Node.js' + + - script: yarn --frozen-lockfile + displayName: 'Install packages' diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml new file mode 100644 index 00000000000..86aa808db6f --- /dev/null +++ b/.azure-pipelines.yml @@ -0,0 +1,129 @@ +# +# Azure Pipelines configuration for building and testing create-react-app on Linux, Windows, and macOS. +# + +trigger: +- master + +variables: + CI: true + VSTS_OVERWRITE_TEMP: True + YARN_CACHE_FOLDER: $(Build.SourcesDirectory)/../yarn-cache + +# ****************************************************************************** +# 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) + 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' diff --git a/packages/react-scripts/scripts/utils/createJestConfig.js b/packages/react-scripts/scripts/utils/createJestConfig.js index d2c788268b8..7f82f4f7f38 100644 --- a/packages/react-scripts/scripts/utils/createJestConfig.js +++ b/packages/react-scripts/scripts/utils/createJestConfig.js @@ -34,7 +34,7 @@ module.exports = (resolve, rootDir, isEjecting) => { setupFilesAfterEnv: setupTestsFile ? [setupTestsFile] : [], testMatch: [ '/src/**/__tests__/**/*.{js,jsx,ts,tsx}', - '/src/**/*.{spec,test}.{js,jsx,ts,tsx}', + '/src/**/*(*.)@(spec|test).{js,jsx,ts,tsx}', ], testEnvironment: 'jest-environment-jsdom-fourteen', transform: { diff --git a/tasks/e2e-behavior.sh b/tasks/e2e-behavior.sh index 93a49e5b6b3..2103cafead9 100755 --- a/tasks/e2e-behavior.sh +++ b/tasks/e2e-behavior.sh @@ -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 +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 @@ -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 diff --git a/tasks/e2e-installs.sh b/tasks/e2e-installs.sh index 07a5ddb3984..d4508c57973 100755 --- a/tasks/e2e-installs.sh +++ b/tasks/e2e-installs.sh @@ -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 @@ -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 diff --git a/tasks/e2e-kitchensink-eject.sh b/tasks/e2e-kitchensink-eject.sh index 6425b890e8e..884e6d93980 100755 --- a/tasks/e2e-kitchensink-eject.sh +++ b/tasks/e2e-kitchensink-eject.sh @@ -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.' @@ -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 @@ -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 diff --git a/tasks/e2e-kitchensink.sh b/tasks/e2e-kitchensink.sh index 556712d3ec6..12875c3566c 100755 --- a/tasks/e2e-kitchensink.sh +++ b/tasks/e2e-kitchensink.sh @@ -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.' @@ -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 @@ -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 diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 2b8345d1282..23b220ca014 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -15,9 +15,9 @@ cd "$(dirname "$0")" # App temporary location # 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.' @@ -26,8 +26,8 @@ function cleanup { # Uncomment when snapshot testing is enabled by default: # rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap 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 @@ -85,18 +85,8 @@ fi # Bootstrap monorepo yarn -# 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 # Lint own code ./node_modules/.bin/eslint --max-warnings 0 packages/babel-preset-react-app/ @@ -270,6 +260,10 @@ verify_module_scope # 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 + # Test ejected files were staged test -n "$(git diff --staged --name-only)" diff --git a/tasks/verdaccio.sh b/tasks/verdaccio.sh new file mode 100644 index 00000000000..8891ef38027 --- /dev/null +++ b/tasks/verdaccio.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +custom_registry_url=http://localhost:4873 +original_npm_registry_url=`npm get registry` +original_yarn_registry_url=`yarn config get registry` + +function startVerdaccio { + # Start local registry + tmp_registry_log=`mktemp` + (cd && nohup npx https://createreactapp.blob.core.windows.net/lib/verdaccio-4.0.0-alpha.8.tgz -c $1 &>$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") +} + +function restoreRegistryUrls { + cat $tmp_registry_log + + npm set registry "$original_npm_registry_url" + yarn config set registry "$original_yarn_registry_url" +} diff --git a/tasks/verdaccio.yaml b/tasks/verdaccio.yaml index e98643b7b76..60f9edddcf8 100644 --- a/tasks/verdaccio.yaml +++ b/tasks/verdaccio.yaml @@ -20,6 +20,12 @@ auth: uplinks: npmjs: url: https://registry.npmjs.org/ + max_fails: 40 + timeout: 60s + agent_options: + keepAlive: true + maxSockets: 40 + maxFreeSockets: 10 packages: '@*/*': @@ -46,4 +52,4 @@ packages: # log settings logs: - {type: stdout, format: pretty, level: http} - #- {type: file, path: verdaccio.log, level: info} + #- {type: file, path: verdaccio.log, level: info} \ No newline at end of file diff --git a/test/fixtures/__shared__/util/scripts.js b/test/fixtures/__shared__/util/scripts.js index b1ee60e7be8..d1799d18bbd 100644 --- a/test/fixtures/__shared__/util/scripts.js +++ b/test/fixtures/__shared__/util/scripts.js @@ -33,9 +33,9 @@ function execaSafe(...args) { stderr: stripYarn( stripAnsi( err.message - .split(os.EOL) + .split('\n') .slice(2) - .join(os.EOL) + .join('\n') ) ), })); diff --git a/test/fixtures/__shared__/util/setup.js b/test/fixtures/__shared__/util/setup.js index 8dd7d2e3e84..96021d014fa 100644 --- a/test/fixtures/__shared__/util/setup.js +++ b/test/fixtures/__shared__/util/setup.js @@ -96,7 +96,15 @@ module.exports = class TestSetup { async teardown() { if (this.testDirectory != null) { - await fs.remove(this.testDirectory); + try { + await fs.remove(this.testDirectory); + } catch (ex) { + if (this.isLocal) { + throw ex; + } else { + // In CI, don't worry if the test directory was not able to be deleted + } + } this.testDirectory = null; this._scripts = null; } diff --git a/test/fixtures/webpack-message-formatting/index.test.js b/test/fixtures/webpack-message-formatting/index.test.js index 1aebc3a2175..f102b1cf381 100644 --- a/test/fixtures/webpack-message-formatting/index.test.js +++ b/test/fixtures/webpack-message-formatting/index.test.js @@ -59,7 +59,10 @@ test('formats missing package', async () => { path.join(testSetup.testDirectory, 'src', 'App.js') ); - const { stdout, stderr } = await testSetup.scripts.build(); + let { stdout, stderr } = await testSetup.scripts.build(); + if (process.platform === 'win32') { + stderr = stderr.replace('.\\src\\App.js', './src/App.js'); + } expect({ stdout, stderr }).toMatchSnapshot(); }); @@ -103,7 +106,12 @@ test('formats file not found error', async () => { path.join(testSetup.testDirectory, 'src', 'App.js') ); - const { stdout, stderr } = await testSetup.scripts.build(); + let { stdout, stderr } = await testSetup.scripts.build(); + if (process.platform === 'win32') { + stderr = stderr + .replace('.\\src\\App.js', './src/App.js') + .replace('.\\src', './src'); + } expect({ stdout, stderr }).toMatchSnapshot(); }); @@ -131,6 +139,9 @@ test('formats out of scope error', async () => { path.join(testSetup.testDirectory, 'src', 'App.js') ); - const { stdout, stderr } = await testSetup.scripts.build(); + let { stdout, stderr } = await testSetup.scripts.build(); + if (process.platform === 'win32') { + stderr = stderr.replace('.\\src\\App.js', './src/App.js'); + } expect({ stdout, stderr }).toMatchSnapshot(); }); From c878843a5bd27b2b96921017d5f520087c4db6d8 Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Tue, 2 Apr 2019 14:57:00 -0400 Subject: [PATCH 03/17] Remove unncessary Yarn cache --- .azure-pipelines-steps.yml | 18 ------------------ .azure-pipelines.yml | 1 + 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/.azure-pipelines-steps.yml b/.azure-pipelines-steps.yml index e3c94b08c82..48327f99b5b 100644 --- a/.azure-pipelines-steps.yml +++ b/.azure-pipelines-steps.yml @@ -10,24 +10,6 @@ steps: displayName: 'Initialize Git config settings' - checkout: self - - - bash: | - export y=$(yarn cache dir) - echo "Yarn cache: ${y}" - mkdir -p $y - cd ${y}/.. - curl https://createreactapp.blob.core.windows.net/cache/yarn-cache-tar-gz | tar -xz - echo $(yarn cache list | wc --lines) - ls -la ${y}/npm-opn-5.5.0-fc7164fab56d235904c51c3b27da6758ca3b9bfc/node_modules/opn - - #echo "$(printenv)" - - #echo "Current NPM cache: $(npm config list)" - #export n="$(Build.SourcesDirectory)/../npm-cache" - #mkdir -p $n - #npm config set cache $n - #echo "New NPM cache: $(npm config list)" - displayName: 'Seed yarn cache' - task: NodeTool@0 inputs: diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 86aa808db6f..cb47621615f 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -9,6 +9,7 @@ variables: CI: true VSTS_OVERWRITE_TEMP: True YARN_CACHE_FOLDER: $(Build.SourcesDirectory)/../yarn-cache + NPM_CONFIG_CACHE: $(Build.SourcesDirectory)/../npm-cache # ****************************************************************************** # Simple test suite From 195267b5371f39df36d19062ccd44cf1b8ff0913 Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Tue, 2 Apr 2019 16:30:43 -0400 Subject: [PATCH 04/17] clean up comment; fix typo --- .azure-pipelines.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index cb47621615f..86d96fc7468 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -6,11 +6,14 @@ trigger: - master variables: + # The following is needed because various tests and scripts look for the CI environment variable CI: true + # The following sets TEMP to the same drive as the cloned source (on Windows); needed because some scripts "cd" into a temporary directory (this fails on Windows if the current directory is on a different drive) VSTS_OVERWRITE_TEMP: True + # The following helps improve build performance on Windows by ensuring the Yarn and NPM caches are on the same drive as the cloned source and temp YARN_CACHE_FOLDER: $(Build.SourcesDirectory)/../yarn-cache NPM_CONFIG_CACHE: $(Build.SourcesDirectory)/../npm-cache - + # ****************************************************************************** # Simple test suite # ****************************************************************************** @@ -125,6 +128,6 @@ jobs: - task: NodeTool@0 inputs: versionSpec: 6.x - displayName: 'Install Node.js' + displayName: 'Install Node.js 6.x' - bash: tasks/e2e-old-node.sh displayName: 'Run tests' From 89c796e7da92e5c184f0217224b602fc0366ffef Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Wed, 3 Apr 2019 06:38:32 -0400 Subject: [PATCH 05/17] Rename azure pipelines YAML files --- .azure-pipelines.yml | 133 ----------------- ...nes-steps.yml => azure-pipelines-steps.yml | 0 azure-pipelines.yml | 139 +++++++++++++++++- 3 files changed, 133 insertions(+), 139 deletions(-) delete mode 100644 .azure-pipelines.yml rename .azure-pipelines-steps.yml => azure-pipelines-steps.yml (100%) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml deleted file mode 100644 index 86d96fc7468..00000000000 --- a/.azure-pipelines.yml +++ /dev/null @@ -1,133 +0,0 @@ -# -# Azure Pipelines configuration for building and testing create-react-app on Linux, Windows, and macOS. -# - -trigger: -- master - -variables: - # The following is needed because various tests and scripts look for the CI environment variable - CI: true - # The following sets TEMP to the same drive as the cloned source (on Windows); needed because some scripts "cd" into a temporary directory (this fails on Windows if the current directory is on a different drive) - VSTS_OVERWRITE_TEMP: True - # The following helps improve build performance on Windows by ensuring the Yarn and NPM caches are on the same drive as the cloned source and temp - YARN_CACHE_FOLDER: $(Build.SourcesDirectory)/../yarn-cache - NPM_CONFIG_CACHE: $(Build.SourcesDirectory)/../npm-cache - -# ****************************************************************************** -# 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) - 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 6.x' - - bash: tasks/e2e-old-node.sh - displayName: 'Run tests' diff --git a/.azure-pipelines-steps.yml b/azure-pipelines-steps.yml similarity index 100% rename from .azure-pipelines-steps.yml rename to azure-pipelines-steps.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f2894295b66..04089625522 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,133 @@ -pool: - vmImage: 'Ubuntu 16.04' - -steps: -- script: echo Hello world! - displayName: Say hello +# +# Azure Pipelines configuration for building and testing create-react-app on Linux, Windows, and macOS. +# + +trigger: +- master + +variables: + # The following is needed because various tests and scripts look for the CI environment variable + CI: true + # The following sets TEMP to the same drive as the cloned source (on Windows); needed because some scripts "cd" into a temporary directory (this fails on Windows if the current directory is on a different drive) + VSTS_OVERWRITE_TEMP: True + # The following helps improve build performance on Windows by ensuring the Yarn and NPM caches are on the same drive as the cloned source and temp + YARN_CACHE_FOLDER: $(Build.SourcesDirectory)/../yarn-cache + NPM_CONFIG_CACHE: $(Build.SourcesDirectory)/../npm-cache + +# ****************************************************************************** +# 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) + 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 6.x' + - bash: tasks/e2e-old-node.sh + displayName: 'Run tests' From 9d5494065b1d25cf55542b075c2aca445cf62f60 Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Tue, 9 Apr 2019 13:18:30 -0400 Subject: [PATCH 06/17] Add VERDACCIO_PACKAGE override variable to avoid hard-coded URL in task script; other cleanup (#5) --- azure-pipelines.yml | 9 +++++---- tasks/e2e-behavior.sh | 14 ++++++-------- tasks/e2e-installs.sh | 10 +++++----- tasks/e2e-kitchensink-eject.sh | 11 +++++------ tasks/e2e-kitchensink.sh | 11 +++++------ tasks/e2e-simple.sh | 11 +++++------ tasks/{verdaccio.sh => local-registry.sh} | 21 +++++++++++++++------ 7 files changed, 46 insertions(+), 41 deletions(-) rename tasks/{verdaccio.sh => local-registry.sh} (50%) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 04089625522..1d973b12f63 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,13 +6,14 @@ trigger: - master variables: - # The following is needed because various tests and scripts look for the CI environment variable CI: true - # The following sets TEMP to the same drive as the cloned source (on Windows); needed because some scripts "cd" into a temporary directory (this fails on Windows if the current directory is on a different drive) - VSTS_OVERWRITE_TEMP: True - # The following helps improve build performance on Windows by ensuring the Yarn and NPM caches are on the same drive as the cloned source and temp + # Overrides the Yarn and NPM cache directories so they are on the same drive as the source. This helps improve build performance on Windows hosted agents. YARN_CACHE_FOLDER: $(Build.SourcesDirectory)/../yarn-cache NPM_CONFIG_CACHE: $(Build.SourcesDirectory)/../npm-cache + # Sets TEMP to be on the same drive as the cloned source on Windows. This avoids test scripts that "cd" into a directory under TEMP from failing because this directory is on a different drive from the current directory. + VSTS_OVERWRITE_TEMP: True + # Override Verdaccio package to use. This is temoporary and is needed to avoid socket timeouts on hosted Windows agent (on Azure). This also changes Verdaccio to return a 503 (service unavailable) instead of a 404 (not found) when the connection to the uplink timesout. + VERDACCIO_PACKAGE: https://github.com/willsmythe/verdaccio/releases/download/create-react-app/verdaccio-4.0.0-alpha.8.tgz # ****************************************************************************** # Simple test suite diff --git a/tasks/e2e-behavior.sh b/tasks/e2e-behavior.sh index 2103cafead9..68f41d55034 100755 --- a/tasks/e2e-behavior.sh +++ b/tasks/e2e-behavior.sh @@ -15,18 +15,16 @@ cd "$(dirname "$0")" # CLI, app, and test module temporary locations # 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'` -# Load Verdaccio-related functions -source verdaccio.sh +# Load functions for working with local NPM registry (Verdaccio) +source local-registry.sh function cleanup { - echo 'Cleaning up.' - ps -ef | grep 'verdaccio' | grep -v grep | awk '{print $2}' | xargs kill -9 + echo 'Cleaning up.' ps -ef | grep 'react-scripts' | grep -v grep | awk '{print $2}' | xargs kill -9 cd "$root_path" - # Restore the original NPM and Yarn registry URLs - restoreRegistryUrls + # Restore the original NPM and Yarn registry URLs and stop Verdaccio + stopLocalRegistry } # Error messages are redirected to stderr @@ -76,7 +74,7 @@ yarn # ****************************************************************************** # Start the local NPM registry -startVerdaccio "$root_path"/tasks/verdaccio.yaml +startLocalRegistry "$root_path"/tasks/verdaccio.yaml # Publish the monorepo git clean -df diff --git a/tasks/e2e-installs.sh b/tasks/e2e-installs.sh index d4508c57973..d31858d2ade 100755 --- a/tasks/e2e-installs.sh +++ b/tasks/e2e-installs.sh @@ -16,15 +16,15 @@ cd "$(dirname "$0")" # http://unix.stackexchange.com/a/84980 temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'` -# Load Verdaccio-related functions -source ./verdaccio.sh +# Load functions for working with local NPM registry (Verdaccio) +source local-registry.sh function cleanup { echo 'Cleaning up.' cd "$root_path" rm -rf "$temp_app_path" - # Restore the original NPM and Yarn registry URLs - restoreRegistryUrls + # Restore the original NPM and Yarn registry URLs and stop Verdaccio + stopLocalRegistry } # Error messages are redirected to stderr @@ -96,7 +96,7 @@ yarn # ****************************************************************************** # Start the local NPM registry -startVerdaccio "$root_path"/tasks/verdaccio.yaml +startLocalRegistry "$root_path"/tasks/verdaccio.yaml # Publish the monorepo git clean -df diff --git a/tasks/e2e-kitchensink-eject.sh b/tasks/e2e-kitchensink-eject.sh index 884e6d93980..d614a767d7e 100755 --- a/tasks/e2e-kitchensink-eject.sh +++ b/tasks/e2e-kitchensink-eject.sh @@ -17,19 +17,18 @@ cd "$(dirname "$0")" 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'` -# Load Verdaccio-related functions -source verdaccio.sh +# Load functions for working with local NPM registry (Verdaccio) +source local-registry.sh function cleanup { echo 'Cleaning up.' unset BROWSERSLIST - 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" # TODO: fix "Device or resource busy" and remove ``|| $CI` rm -rf "$temp_app_path" "$temp_module_path" || $CI - # Restore the original NPM and Yarn registry URLs - restoreRegistryUrls + # Restore the original NPM and Yarn registry URLs and stop Verdaccio + stopLocalRegistry } # Error messages are redirected to stderr @@ -79,7 +78,7 @@ yarn # ****************************************************************************** # Start the local NPM registry -startVerdaccio "$root_path"/tasks/verdaccio.yaml +startLocalRegistry "$root_path"/tasks/verdaccio.yaml # Publish the monorepo git clean -df diff --git a/tasks/e2e-kitchensink.sh b/tasks/e2e-kitchensink.sh index 12875c3566c..dfb2527e22f 100755 --- a/tasks/e2e-kitchensink.sh +++ b/tasks/e2e-kitchensink.sh @@ -17,19 +17,18 @@ cd "$(dirname "$0")" 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'` -# Load Verdaccio-related functions -source verdaccio.sh +# Load functions for working with local NPM registry (Verdaccio) +source local-registry.sh function cleanup { echo 'Cleaning up.' unset BROWSERSLIST - 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" # TODO: fix "Device or resource busy" and remove ``|| $CI` rm -rf "$temp_app_path" "$temp_module_path" || $CI - # Restore the original NPM and Yarn registry URLs - restoreRegistryUrls + # Restore the original NPM and Yarn registry URLs and stop Verdaccio + stopLocalRegistry } # Error messages are redirected to stderr @@ -79,7 +78,7 @@ yarn # ****************************************************************************** # Start the local NPM registry -startVerdaccio "$root_path"/tasks/verdaccio.yaml +startLocalRegistry "$root_path"/tasks/verdaccio.yaml # Publish the monorepo git clean -df diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 23b220ca014..bf37a665901 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -16,18 +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'` -# Load Verdaccio-related functions -source verdaccio.sh +# Load functions for working with local NPM registry (Verdaccio) +source local-registry.sh function cleanup { echo 'Cleaning up.' - ps -ef | grep 'verdaccio' | grep -v grep | awk '{print $2}' | xargs kill -9 cd "$root_path" # Uncomment when snapshot testing is enabled by default: # rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap rm -rf "$temp_app_path" - # Restore the original NPM and Yarn registry URLs - restoreRegistryUrls + # Restore the original NPM and Yarn registry URLs and stop Verdaccio + stopLocalRegistry } # Error messages are redirected to stderr @@ -86,7 +85,7 @@ fi yarn # Start the local NPM registry -startVerdaccio "$root_path"/tasks/verdaccio.yaml +startLocalRegistry "$root_path"/tasks/verdaccio.yaml # Lint own code ./node_modules/.bin/eslint --max-warnings 0 packages/babel-preset-react-app/ diff --git a/tasks/verdaccio.sh b/tasks/local-registry.sh similarity index 50% rename from tasks/verdaccio.sh rename to tasks/local-registry.sh index 8891ef38027..2feb5c2bd1a 100644 --- a/tasks/verdaccio.sh +++ b/tasks/local-registry.sh @@ -3,12 +3,14 @@ custom_registry_url=http://localhost:4873 original_npm_registry_url=`npm get registry` original_yarn_registry_url=`yarn config get registry` +default_verdaccio_package=verdaccio@3.8.2 -function startVerdaccio { +function startLocalRegistry { # Start local registry tmp_registry_log=`mktemp` - (cd && nohup npx https://createreactapp.blob.core.windows.net/lib/verdaccio-4.0.0-alpha.8.tgz -c $1 &>$tmp_registry_log &) - # Wait for `verdaccio` to boot + echo "Registry output file: $tmp_registry_log" + (cd && nohup npx ${VERDACCIO_PACKAGE:-$default_verdaccio_package} -c $1 &>$tmp_registry_log &) + # Wait for Verdaccio to boot grep -q 'http address' <(tail -f $tmp_registry_log) # Set registry to local registry @@ -19,9 +21,16 @@ function startVerdaccio { (cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url") } -function restoreRegistryUrls { - cat $tmp_registry_log - +function stopLocalRegistry { + # Show the Verdaccio output in the build results (if running in Azure Pipelines) + if [ -r $tmp_registry_log ] && [ -n "$TF_BUILD" ]; then + cat $tmp_registry_log + fi + + # Restore the original NPM and Yarn registry URLs and stop Verdaccio npm set registry "$original_npm_registry_url" yarn config set registry "$original_yarn_registry_url" + + # Kill Verdaccio process + ps -ef | grep 'verdaccio' | grep -v grep | awk '{print $2}' | xargs kill -9 } From 53a0f2f2dbb3629c31cfc1d89944832e80b9812a Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Wed, 10 Apr 2019 12:48:45 -0400 Subject: [PATCH 07/17] Fix EOL in verdaccio.yaml --- tasks/verdaccio.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/verdaccio.yaml b/tasks/verdaccio.yaml index 60f9edddcf8..45b3800835f 100644 --- a/tasks/verdaccio.yaml +++ b/tasks/verdaccio.yaml @@ -52,4 +52,4 @@ packages: # log settings logs: - {type: stdout, format: pretty, level: http} - #- {type: file, path: verdaccio.log, level: info} \ No newline at end of file + #- {type: file, path: verdaccio.log, level: info} From ea6d2620fce11a88941dd93b413ad935d882f965 Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Thu, 11 Apr 2019 18:37:30 -0400 Subject: [PATCH 08/17] Fix random 'unexpected end of file' problem; reduce calls to registry.npmjs.org; simplify YAML --- azure-pipelines-steps.yml | 20 ------- azure-pipelines-test-job.yml | 41 ++++++++++++++ azure-pipelines.yml | 105 +++++++++-------------------------- tasks/local-registry.sh | 5 -- tasks/verdaccio.yaml | 7 ++- 5 files changed, 72 insertions(+), 106 deletions(-) delete mode 100644 azure-pipelines-steps.yml create mode 100644 azure-pipelines-test-job.yml diff --git a/azure-pipelines-steps.yml b/azure-pipelines-steps.yml deleted file mode 100644 index 48327f99b5b..00000000000 --- a/azure-pipelines-steps.yml +++ /dev/null @@ -1,20 +0,0 @@ -# -# 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' diff --git a/azure-pipelines-test-job.yml b/azure-pipelines-test-job.yml new file mode 100644 index 00000000000..1d6d31f34b4 --- /dev/null +++ b/azure-pipelines-test-job.yml @@ -0,0 +1,41 @@ +# +# Azure Pipelines job for building and testing create-react-app on Linux, Windows, and macOS. +# + +parameters: + name: '' + testScript: '' + configurations: + LinuxNode8: { vmImage: 'ubuntu-16.04', nodeVersion: 8.x } + LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x } + MacNode8: { vmImage: 'macOS-10.13', nodeVersion: 8.x } + MacNode10: { vmImage: 'macOS-10.13', nodeVersion: 10.x } + WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x } + WindowsNode10: { vmImage: 'vs2017-win2016', nodeVersion: 10.x } + +jobs: +- job: ${{ parameters.name }} + strategy: + matrix: + ${{ insert }}: ${{ parameters.configurations }} + pool: + vmImage: $(vmImage) + 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' + + - checkout: self + + - task: NodeTool@0 + inputs: + versionSpec: $(nodeVersion) + displayName: 'Install Node.js' + + - script: yarn --frozen-lockfile + displayName: 'Run yarn' + + - bash: ${{ parameters.testScript }} + displayName: 'Run tests' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1d973b12f63..1a9398d3ce9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,97 +19,42 @@ variables: # 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' +- template: azure-pipelines-test-job.yml + parameters: + name: Simple + testScript: tasks/e2e-simple.sh # ****************************************************************************** # 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) - steps: - - template: azure-pipelines-steps.yml - - bash: tasks/e2e-installs.sh - displayName: 'Run tests' +- template: azure-pipelines-test-job.yml + parameters: + name: Installs + testScript: tasks/e2e-installs.sh # ****************************************************************************** # 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' +- template: azure-pipelines-test-job.yml + parameters: + name: Kitchensink + testScript: tasks/e2e-kitchensink.sh # ****************************************************************************** # 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' +- template: azure-pipelines-test-job.yml + parameters: + name: KitchensinkEject + testScript: tasks/e2e-kitchensink-eject.sh # ****************************************************************************** # 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' +- template: azure-pipelines-test-job.yml + parameters: + name: Behavior + testScript: tasks/e2e-behavior.sh # ****************************************************************************** # Old Node test suite @@ -118,13 +63,13 @@ jobs: strategy: matrix: LinuxNode6: - VM_IMAGE: 'ubuntu-16.04' - MacNode6: - VM_IMAGE: 'macOS-10.13' + vmImage: ubuntu-16.04 + MacNode8: + vmImage: macOS-10.13 WindowsNode6: - VM_IMAGE: 'vs2017-win2016' + vmImage: vs2017-win2016 pool: - vmImage: $(VM_IMAGE) + vmImage: $(vmImage) steps: - task: NodeTool@0 inputs: diff --git a/tasks/local-registry.sh b/tasks/local-registry.sh index 2feb5c2bd1a..26cf896bf43 100644 --- a/tasks/local-registry.sh +++ b/tasks/local-registry.sh @@ -22,11 +22,6 @@ function startLocalRegistry { } function stopLocalRegistry { - # Show the Verdaccio output in the build results (if running in Azure Pipelines) - if [ -r $tmp_registry_log ] && [ -n "$TF_BUILD" ]; then - cat $tmp_registry_log - fi - # Restore the original NPM and Yarn registry URLs and stop Verdaccio npm set registry "$original_npm_registry_url" yarn config set registry "$original_yarn_registry_url" diff --git a/tasks/verdaccio.yaml b/tasks/verdaccio.yaml index 45b3800835f..cbca71cae19 100644 --- a/tasks/verdaccio.yaml +++ b/tasks/verdaccio.yaml @@ -21,6 +21,7 @@ uplinks: npmjs: url: https://registry.npmjs.org/ max_fails: 40 + maxage: 30m timeout: 60s agent_options: keepAlive: true @@ -51,5 +52,9 @@ packages: # log settings logs: - - {type: stdout, format: pretty, level: http} + - {type: stdout, format: pretty, level: warn} #- {type: file, path: verdaccio.log, level: info} + +# See https://github.com/verdaccio/verdaccio/issues/301 +server: + keepAliveTimeout: 0 From a20ab532d217cacd56946acd390e4192f146321a Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Thu, 11 Apr 2019 18:55:04 -0400 Subject: [PATCH 09/17] Only run Behavior tests on mac; only run Old Node tests on Linux --- azure-pipelines.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1a9398d3ce9..88da256c100 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -55,21 +55,16 @@ jobs: parameters: name: Behavior testScript: tasks/e2e-behavior.sh + configurations: + MacNode8: { vmImage: 'macOS-10.13', nodeVersion: 8.x } + MacNode10: { vmImage: 'macOS-10.13', nodeVersion: 10.x } # ****************************************************************************** # Old Node test suite # ****************************************************************************** - job: OldNode - strategy: - matrix: - LinuxNode6: - vmImage: ubuntu-16.04 - MacNode8: - vmImage: macOS-10.13 - WindowsNode6: - vmImage: vs2017-win2016 pool: - vmImage: $(vmImage) + vmImage: ubuntu-16.04 steps: - task: NodeTool@0 inputs: From 7481a92cd5bb4319e46468fbce78e76bef7a58ea Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Thu, 11 Apr 2019 20:39:54 -0400 Subject: [PATCH 10/17] update configurations --- azure-pipelines-test-job.yml | 8 +++----- azure-pipelines.yml | 6 +++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/azure-pipelines-test-job.yml b/azure-pipelines-test-job.yml index 1d6d31f34b4..8875e552f51 100644 --- a/azure-pipelines-test-job.yml +++ b/azure-pipelines-test-job.yml @@ -6,13 +6,11 @@ parameters: name: '' testScript: '' configurations: - LinuxNode8: { vmImage: 'ubuntu-16.04', nodeVersion: 8.x } + LinuxNode8: { vmImage: 'ubuntu-16.04', nodeVersion: 8.x } LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x } - MacNode8: { vmImage: 'macOS-10.13', nodeVersion: 8.x } - MacNode10: { vmImage: 'macOS-10.13', nodeVersion: 10.x } - WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x } + WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x } WindowsNode10: { vmImage: 'vs2017-win2016', nodeVersion: 10.x } - + jobs: - job: ${{ parameters.name }} strategy: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 88da256c100..c51be42da86 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -56,7 +56,11 @@ jobs: name: Behavior testScript: tasks/e2e-behavior.sh configurations: - MacNode8: { vmImage: 'macOS-10.13', nodeVersion: 8.x } + LinuxNode8: { vmImage: 'ubuntu-16.04', nodeVersion: 8.x } + LinuxNode10: { vmImage: 'ubuntu-16.04', nodeVersion: 10.x } + WindowsNode8: { vmImage: 'vs2017-win2016', nodeVersion: 8.x } + WindowsNode10: { vmImage: 'vs2017-win2016', nodeVersion: 10.x } + MacNode8: { vmImage: 'macOS-10.13', nodeVersion: 8.x } MacNode10: { vmImage: 'macOS-10.13', nodeVersion: 10.x } # ****************************************************************************** From 67673a7a9b488e7b268ca9ce9f0bd9a82d2892ae Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Wed, 24 Apr 2019 10:02:49 -0400 Subject: [PATCH 11/17] Play with Lerna 3.0 publish args; enable verbose logging Restore --skip-git override default checkout directory --- azure-pipelines-test-job.yml | 1 + tasks/publish.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-test-job.yml b/azure-pipelines-test-job.yml index 8875e552f51..18000d462cb 100644 --- a/azure-pipelines-test-job.yml +++ b/azure-pipelines-test-job.yml @@ -26,6 +26,7 @@ jobs: displayName: 'Initialize Git config' - checkout: self + path: create-react-app - task: NodeTool@0 inputs: diff --git a/tasks/publish.sh b/tasks/publish.sh index 802d10cf518..daf0452941a 100755 --- a/tasks/publish.sh +++ b/tasks/publish.sh @@ -31,6 +31,7 @@ if [ -z $CI ]; then fi if [ -n "$(git status --porcelain)" ]; then + echo "$(git diff)" echo "Your git status is not clean. Aborting."; exit 1; fi @@ -48,4 +49,4 @@ if [ -z $CI ]; then fi # Go! -NPM_CONFIG_OTP="$otp" ./node_modules/.bin/lerna publish --npm-client=npm "$@" +NPM_CONFIG_OTP="$otp" ./node_modules/.bin/lerna publish --npm-client=npm "$@" --loglevel verbose From a3b66292a6ffc6051bcfd4521039a44d1e41313f Mon Sep 17 00:00:00 2001 From: Will Smythe Date: Mon, 29 Apr 2019 12:41:05 -0400 Subject: [PATCH 12/17] Remove --loglevel from lerna publish; used for debugging --- tasks/publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/publish.sh b/tasks/publish.sh index daf0452941a..41c7817faa3 100755 --- a/tasks/publish.sh +++ b/tasks/publish.sh @@ -49,4 +49,4 @@ if [ -z $CI ]; then fi # Go! -NPM_CONFIG_OTP="$otp" ./node_modules/.bin/lerna publish --npm-client=npm "$@" --loglevel verbose +NPM_CONFIG_OTP="$otp" ./node_modules/.bin/lerna publish --npm-client=npm "$@" From cb2dd99b2aad84bdd43d4d0045e5f5c7a9512fcb Mon Sep 17 00:00:00 2001 From: Ian Schmitz Date: Thu, 25 Apr 2019 21:59:45 -0700 Subject: [PATCH 13/17] Update e2e publish scripts --- tasks/e2e-behavior.sh | 3 +-- tasks/e2e-installs.sh | 3 +-- tasks/e2e-kitchensink-eject.sh | 3 +-- tasks/e2e-kitchensink.sh | 3 +-- tasks/e2e-simple.sh | 4 ++-- tasks/local-registry.sh | 5 +++++ tasks/publish.sh | 1 - 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tasks/e2e-behavior.sh b/tasks/e2e-behavior.sh index 68f41d55034..31ab9991d20 100755 --- a/tasks/e2e-behavior.sh +++ b/tasks/e2e-behavior.sh @@ -77,8 +77,7 @@ yarn startLocalRegistry "$root_path"/tasks/verdaccio.yaml # Publish the monorepo -git clean -df -./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +publishToLocalRegistry # ****************************************************************************** # Now that we have published them, run all tests as if they were released. diff --git a/tasks/e2e-installs.sh b/tasks/e2e-installs.sh index d31858d2ade..27577cdef0d 100755 --- a/tasks/e2e-installs.sh +++ b/tasks/e2e-installs.sh @@ -99,8 +99,7 @@ yarn startLocalRegistry "$root_path"/tasks/verdaccio.yaml # Publish the monorepo -git clean -df -./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +publishToLocalRegistry echo "Create React App Version: " npx create-react-app --version diff --git a/tasks/e2e-kitchensink-eject.sh b/tasks/e2e-kitchensink-eject.sh index d614a767d7e..877fdf60f12 100755 --- a/tasks/e2e-kitchensink-eject.sh +++ b/tasks/e2e-kitchensink-eject.sh @@ -81,8 +81,7 @@ yarn startLocalRegistry "$root_path"/tasks/verdaccio.yaml # Publish the monorepo -git clean -df -./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +publishToLocalRegistry # ****************************************************************************** # Now that we have published them, create a clean app folder and install them. diff --git a/tasks/e2e-kitchensink.sh b/tasks/e2e-kitchensink.sh index dfb2527e22f..30f0b4a0186 100755 --- a/tasks/e2e-kitchensink.sh +++ b/tasks/e2e-kitchensink.sh @@ -81,8 +81,7 @@ yarn startLocalRegistry "$root_path"/tasks/verdaccio.yaml # Publish the monorepo -git clean -df -./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +publishToLocalRegistry # ****************************************************************************** # Now that we have published them, create a clean app folder and install them. diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index bf37a665901..30f45c76834 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -138,8 +138,8 @@ CI=true yarn test # Test local start command yarn start --smoke-test -git clean -df -./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest +# Publish the monorepo +publishToLocalRegistry # ****************************************************************************** # Install react-scripts prerelease via create-react-app prerelease. diff --git a/tasks/local-registry.sh b/tasks/local-registry.sh index 26cf896bf43..715380a8a85 100644 --- a/tasks/local-registry.sh +++ b/tasks/local-registry.sh @@ -29,3 +29,8 @@ function stopLocalRegistry { # Kill Verdaccio process ps -ef | grep 'verdaccio' | grep -v grep | awk '{print $2}' | xargs kill -9 } + +function publishToLocalRegistry { + git clean -df + ./tasks/publish.sh prerelease --yes --force-publish=* --no-git-tag-version --no-commit-hooks --no-push --exact --dist-tag=latest +} diff --git a/tasks/publish.sh b/tasks/publish.sh index 41c7817faa3..802d10cf518 100755 --- a/tasks/publish.sh +++ b/tasks/publish.sh @@ -31,7 +31,6 @@ if [ -z $CI ]; then fi if [ -n "$(git status --porcelain)" ]; then - echo "$(git diff)" echo "Your git status is not clean. Aborting."; exit 1; fi From d7c761a92ed6cdabc2e6fbe8fc92a5ee206b13b1 Mon Sep 17 00:00:00 2001 From: Ian Schmitz Date: Sat, 25 May 2019 21:49:09 -0700 Subject: [PATCH 14/17] Simplify mjs test suite --- .../__snapshots__/index.test.js.snap | 4 +- test/fixtures/mjs-support/index.test.js | 14 ++-- test/fixtures/mjs-support/src/App.js | 77 ++++++------------- 3 files changed, 33 insertions(+), 62 deletions(-) diff --git a/test/fixtures/mjs-support/__snapshots__/index.test.js.snap b/test/fixtures/mjs-support/__snapshots__/index.test.js.snap index 1fff97685f1..cbf1408921f 100644 --- a/test/fixtures/mjs-support/__snapshots__/index.test.js.snap +++ b/test/fixtures/mjs-support/__snapshots__/index.test.js.snap @@ -1,5 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`can use mjs library in development 1`] = `"Pikachu"`; +exports[`can use mjs library in development 1`] = `"world"`; -exports[`can use mjs library in production 1`] = `"Pikachu"`; +exports[`can use mjs library in production 1`] = `"world"`; diff --git a/test/fixtures/mjs-support/index.test.js b/test/fixtures/mjs-support/index.test.js index 767af17b564..97f931e95bf 100644 --- a/test/fixtures/mjs-support/index.test.js +++ b/test/fixtures/mjs-support/index.test.js @@ -9,11 +9,10 @@ test('can use mjs library in development', async () => { try { const page = await browser.newPage(); await page.goto(`http://localhost:${port}/`); - await page.waitForSelector('.Pokemon-Name-Data', { timeout: 0 }); + await page.waitForSelector('.mjs-gql-result', { timeout: 0 }); const output = await page.evaluate(() => { - return Array.from( - document.getElementsByClassName('Pokemon-Name-Data') - ).pop().innerHTML; + return Array.from(document.getElementsByClassName('mjs-gql-result')).pop() + .innerHTML; }); expect(output).toMatchSnapshot(); } finally { @@ -29,11 +28,10 @@ test('can use mjs library in production', async () => { try { const page = await browser.newPage(); await page.goto(`http://localhost:${port}/`); - await page.waitForSelector('.Pokemon-Name-Data', { timeout: 0 }); + await page.waitForSelector('.mjs-gql-result', { timeout: 0 }); const output = await page.evaluate(() => { - return Array.from( - document.getElementsByClassName('Pokemon-Name-Data') - ).pop().innerHTML; + return Array.from(document.getElementsByClassName('mjs-gql-result')).pop() + .innerHTML; }); expect(output).toMatchSnapshot(); } finally { diff --git a/test/fixtures/mjs-support/src/App.js b/test/fixtures/mjs-support/src/App.js index 39fabb94545..6b5321529df 100644 --- a/test/fixtures/mjs-support/src/App.js +++ b/test/fixtures/mjs-support/src/App.js @@ -1,62 +1,35 @@ import React, { Component } from 'react'; -import ApolloClient, { gql } from 'apollo-boost'; -import { ApolloProvider, Query } from 'react-apollo'; +import { + graphql, + GraphQLSchema, + GraphQLObjectType, + GraphQLString, +} from 'graphql'; -const GET_PIKA = gql` - { - pokemon(name: "Pikachu") { - name - } - } -`; - -const client = new ApolloClient({ - uri: 'https://graphql-pokemon.now.sh/graphql', +const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'RootQueryType', + fields: { + hello: { + type: GraphQLString, + resolve() { + return 'world'; + }, + }, + }, + }), }); -class Pokemon extends Component { - render() { - const { name } = this.props.pokemon; - return ( -

- Pokemon name: {name} -

- ); - } -} - -class Data extends Component { +class App extends Component { state = {}; - componentDidCatch() { - this.setState({ hasError: true }); - } - render() { - const { hasError } = this.state; - return hasError ? ( -
Error :(
- ) : ( - - {({ loading, error, data }) => { - if (loading) { - return
Loading...
; - } - if (error) { - return
Error :(
; - } - return ; - }} -
- ); + componentDidMount() { + graphql(schema, '{ hello }').then(({ data }) => { + this.setState({ result: data.hello }); + }); } -} - -class App extends Component { render() { - return ( - - - - ); + const { result } = this.state; + return result ?
{result}
: null; } } From 91914330dc180db765755a68cc2a5faa91fcf1f6 Mon Sep 17 00:00:00 2001 From: Ian Schmitz Date: Sat, 25 May 2019 21:54:09 -0700 Subject: [PATCH 15/17] Remove unneeded deps from mjs suite --- test/fixtures/mjs-support/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/fixtures/mjs-support/package.json b/test/fixtures/mjs-support/package.json index 47b6cf58047..219fac12c17 100644 --- a/test/fixtures/mjs-support/package.json +++ b/test/fixtures/mjs-support/package.json @@ -1,9 +1,6 @@ { "dependencies": { - "apollo-boost": "0.1.16", "graphql": "14.0.2", - "react-apollo": "2.2.1", - "apollo-client": "2.4.2", "react": "latest", "react-dom": "latest", "serve": "10.0.2" From 3b1b29b99d4ee41547260b26bc8a8079724dab50 Mon Sep 17 00:00:00 2001 From: Ian Schmitz Date: Sun, 26 May 2019 13:24:40 -0700 Subject: [PATCH 16/17] PR feedback --- packages/react-scripts/scripts/utils/createJestConfig.js | 2 +- tasks/e2e-simple.sh | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react-scripts/scripts/utils/createJestConfig.js b/packages/react-scripts/scripts/utils/createJestConfig.js index 7f82f4f7f38..d2c788268b8 100644 --- a/packages/react-scripts/scripts/utils/createJestConfig.js +++ b/packages/react-scripts/scripts/utils/createJestConfig.js @@ -34,7 +34,7 @@ module.exports = (resolve, rootDir, isEjecting) => { setupFilesAfterEnv: setupTestsFile ? [setupTestsFile] : [], testMatch: [ '/src/**/__tests__/**/*.{js,jsx,ts,tsx}', - '/src/**/*(*.)@(spec|test).{js,jsx,ts,tsx}', + '/src/**/*.{spec,test}.{js,jsx,ts,tsx}', ], testEnvironment: 'jest-environment-jsdom-fourteen', transform: { diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 30f45c76834..ff6d2954b5f 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -259,10 +259,6 @@ verify_module_scope # 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 - # Test ejected files were staged test -n "$(git diff --staged --name-only)" From 0f3ade24529c5ba76aa1cafe319da0ebc37f0e0d Mon Sep 17 00:00:00 2001 From: Ian Schmitz Date: Tue, 28 May 2019 18:31:07 -0700 Subject: [PATCH 17/17] Swap Travis for Azure DevOps badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75aed91b989..347d4359760 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Create React App [![Build Status](https://travis-ci.org/facebook/create-react-app.svg?branch=master)](https://travis-ci.org/facebook/create-react-app) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/pulls) +# Create React App [![Build Status](https://dev.azure.com/facebook/create-react-app/_apis/build/status/facebook.create-react-app?branchName=master)](https://dev.azure.com/facebook/create-react-app/_build/latest?definitionId=1&branchName=master) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/pulls) Create React apps with no build configuration.