From dd510db6853ee605e3dff4238fa1d2c29c3de4e3 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 26 Jun 2022 18:54:48 -0400 Subject: [PATCH 1/6] Move Azure Pipelines to preserve history --- azure-pipelines.yml => .github/workflows/e2e.yml | 0 azure-pipelines-test-job.yml => .github/workflows/test-job.yml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename azure-pipelines.yml => .github/workflows/e2e.yml (100%) rename azure-pipelines-test-job.yml => .github/workflows/test-job.yml (100%) diff --git a/azure-pipelines.yml b/.github/workflows/e2e.yml similarity index 100% rename from azure-pipelines.yml rename to .github/workflows/e2e.yml diff --git a/azure-pipelines-test-job.yml b/.github/workflows/test-job.yml similarity index 100% rename from azure-pipelines-test-job.yml rename to .github/workflows/test-job.yml From b14380ed876511e1fa04bcd616f7443ab8ad4dab Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 26 Jun 2022 18:58:31 -0400 Subject: [PATCH 2/6] Move E2E (end to end) tests to GitHub Actions --- .github/workflows/e2e.yml | 50 +++++++++++++++++-------------- .github/workflows/test-job.yml | 55 ++++++++++++++++++---------------- 2 files changed, 57 insertions(+), 48 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8c51a73a8c2..9f703779ad3 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,15 +1,15 @@ # -# Azure Pipelines configuration for building and testing create-react-app on Linux, Windows, and macOS. +# GitHub Actions configuration for building and testing create-react-app on Linux, Windows, and macOS. # -trigger: - - main +name: E2E (end to end) Tests -variables: - CI: true - # 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 +on: + push: + branches: + - main + +env: # 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 CRA_INTERNAL_TEST: true @@ -18,24 +18,27 @@ variables: # Simple test suite # ****************************************************************************** jobs: - - template: azure-pipelines-test-job.yml - parameters: + simple: + uses: ./test-job.yml + with: name: Simple testScript: tasks/e2e-simple.sh # ****************************************************************************** # Installs test suite # ****************************************************************************** - - template: azure-pipelines-test-job.yml - parameters: + installs: + uses: ./test-job.yml + with: name: Installs testScript: tasks/e2e-installs.sh # ****************************************************************************** # Kitchensink test suite # ****************************************************************************** - - template: azure-pipelines-test-job.yml - parameters: + kitchensink: + uses: ./test-job.yml + with: name: Kitchensink testScript: tasks/e2e-kitchensink.sh @@ -65,13 +68,14 @@ jobs: # ****************************************************************************** # Old Node test suite # ****************************************************************************** - - job: OldNode - pool: - vmImage: ubuntu-latest + oldnode: + runs-on: ubuntu-latest steps: - - task: NodeTool@0 - inputs: - versionSpec: 8.x - displayName: 'Install Node.js 8.x' - - bash: tasks/e2e-old-node.sh - displayName: 'Run tests' + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 8 + cache: 'npm' + name: 'Install Node.js 8.x' + - run: tasks/e2e-old-node.sh + name: 'Run tests' diff --git a/.github/workflows/test-job.yml b/.github/workflows/test-job.yml index cdf3f4dacfd..ade1b72d05a 100644 --- a/.github/workflows/test-job.yml +++ b/.github/workflows/test-job.yml @@ -1,41 +1,46 @@ # -# Azure Pipelines job for building and testing create-react-app on Linux, Windows, and macOS. +# GitHub Actions workflow for building and testing create-react-app on Linux, Windows, and macOS. # -parameters: - name: '' - testScript: '' - configurations: - LinuxNode14: { vmImage: 'ubuntu-latest', nodeVersion: 14.x } - LinuxNode16: { vmImage: 'ubuntu-latest', nodeVersion: 16.x } +on: + workflow_call: + inputs: + name: + default: '' + required: true + type: string + testScript: + default: '' + required: true + type: string jobs: - - job: ${{ parameters.name }} + build: + name: ${{ inputs.name }} strategy: matrix: - ${{ insert }}: ${{ parameters.configurations }} - pool: - vmImage: $(vmImage) + node-version: [14.x, 16.x] + runs-on: ubuntu-latest steps: - - script: | + - run: | 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' + name: 'Initialize Git config' - - checkout: self - path: create-react-app + - uses: actions/checkout@v2 - - task: NodeTool@0 - inputs: - versionSpec: $(nodeVersion) - displayName: 'Install Node.js' + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + name: 'Install Node.js' - - script: npm i -g npm@8 - displayName: 'Update npm to v8' + - run: npm i -g npm@8 + name: 'Update npm to v8' - - script: npm ci - displayName: 'Run npm ci' + - run: npm ci + name: 'Run npm ci' - - bash: ${{ parameters.testScript }} - displayName: 'Run tests' + - run: ${{ inputs.testScript }} + name: 'Run tests' From 1b411fdc25aec4ce91b36ccd9a689064b9a37b22 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 26 Jun 2022 19:57:17 -0400 Subject: [PATCH 3/6] Fix reusable workflow path --- .github/workflows/e2e.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 9f703779ad3..4453dacac19 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -19,7 +19,7 @@ env: # ****************************************************************************** jobs: simple: - uses: ./test-job.yml + uses: ./.github/workflows/test-job with: name: Simple testScript: tasks/e2e-simple.sh @@ -28,7 +28,7 @@ jobs: # Installs test suite # ****************************************************************************** installs: - uses: ./test-job.yml + uses: ./.github/workflows/test-job with: name: Installs testScript: tasks/e2e-installs.sh @@ -37,7 +37,7 @@ jobs: # Kitchensink test suite # ****************************************************************************** kitchensink: - uses: ./test-job.yml + uses: ./.github/workflows/test-job with: name: Kitchensink testScript: tasks/e2e-kitchensink.sh From 1f86302f2f7e0ce806fe9ac30375952b6a57ca8b Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 26 Jun 2022 20:05:55 -0400 Subject: [PATCH 4/6] Add missing extension --- .github/workflows/e2e.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4453dacac19..2d820214282 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -19,7 +19,7 @@ env: # ****************************************************************************** jobs: simple: - uses: ./.github/workflows/test-job + uses: ./.github/workflows/test-job.yml with: name: Simple testScript: tasks/e2e-simple.sh @@ -28,7 +28,7 @@ jobs: # Installs test suite # ****************************************************************************** installs: - uses: ./.github/workflows/test-job + uses: ./.github/workflows/test-job.yml with: name: Installs testScript: tasks/e2e-installs.sh @@ -37,7 +37,7 @@ jobs: # Kitchensink test suite # ****************************************************************************** kitchensink: - uses: ./.github/workflows/test-job + uses: ./.github/workflows/test-job.yml with: name: Kitchensink testScript: tasks/e2e-kitchensink.sh From 9eac1f786dfac7e3f1236b42c448d6b5dd1ab342 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 26 Jun 2022 20:06:08 -0400 Subject: [PATCH 5/6] Update build status badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 91283e853e4..7b7cced3bbf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Create React App [![Build Status](https://dev.azure.com/facebook/create-react-app/_apis/build/status/facebook.create-react-app?branchName=main)](https://dev.azure.com/facebook/create-react-app/_build/latest?definitionId=1&branchName=main) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/blob/main/CONTRIBUTING.md) +# Create React App [![Build Status](https://github.com/facebook/create-react-app/actions/workflows/e2e.yml/badge.svg?branch=main)](https://github.com/facebook/create-react-app/actions/workflows/e2e.yml?query=branch:main) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/blob/main/CONTRIBUTING.md) Logo From f626a27e1df6ec8e4bd2faea403c6e206e0621a1 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 26 Jun 2022 20:11:53 -0400 Subject: [PATCH 6/6] Also build pull requests --- .github/workflows/e2e.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2d820214282..55f2ec98406 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -8,6 +8,9 @@ on: push: branches: - main + pull_request: + branches: + - main env: # 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.