From 0a827f69ab0d2ee3871ba9b71350031d8a81b7ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Wed, 14 Jun 2023 13:58:56 -0700 Subject: [PATCH] Migrate from Azure Pipelines to GitHub Actions (#13222) Beyond just a pure migration, this also: - Drops Node 14 usage from CI (which also removes the need for explicit npm 8 installs) - Removes the "old node" test, which just checked that installing on old node failed. We shouldn't need to test that - Consolidates the build & test workflows so we don't end up with a proliferation of workflows. --- .github/workflows/build-and-test.yml | 76 +++++++++++++++++++++++++++ .github/workflows/build.yml | 19 ------- .github/workflows/e2e-base.yml | 35 +++++++++++++ .github/workflows/integration.yml | 32 ------------ .github/workflows/lint.yml | 10 ++-- README.md | 2 +- azure-pipelines-test-job.yml | 41 --------------- azure-pipelines.yml | 77 ---------------------------- 8 files changed, 115 insertions(+), 177 deletions(-) create mode 100644 .github/workflows/build-and-test.yml delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/e2e-base.yml delete mode 100644 .github/workflows/integration.yml delete mode 100644 azure-pipelines-test-job.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 00000000000..ed41799251d --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,76 @@ +name: 'Build & Test' + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: 'Build (${{ matrix.os }}, Node ${{ matrix.node }})' + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - 'ubuntu-latest' + node: + - '16' + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + cache: 'npm' + - name: Install dependencies + run: npm ci --prefer-offline + - name: Build + run: npm run build + + integration: + name: 'Integration Tests (${{ matrix.os }}, Node ${{ matrix.node }})' + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - 'ubuntu-latest' + - 'macos-latest' + - 'windows-latest' + node: + - '16' + steps: + - uses: actions/checkout@v3 + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + cache: 'npm' + - name: Install dependencies + run: npm ci --prefer-offline + # The integration tests are run with yarn, so we need to install it. + - name: Install yarn + run: npm i -g yarn + - name: Run integration tests + run: npm run test:integration + + e2e-simple: + name: E2E Simple + uses: ./.github/workflows/e2e-base.yml + with: + testScript: 'tasks/e2e-simple.sh' + + e2e-installs: + name: E2E Installs + uses: ./.github/workflows/e2e-base.yml + with: + testScript: 'tasks/e2e-installs.sh' + + e2e-kitchensink: + name: E2E Kitchensink + uses: ./.github/workflows/e2e-base.yml + with: + testScript: 'tasks/e2e-kitchensink.sh' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c5fea8809f2..00000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Build - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: '14' - cache: 'npm' - - name: Install npm@8 - run: npm i -g npm@8 - - name: Install - run: npm ci --prefer-offline - - name: Build - run: npm run build diff --git a/.github/workflows/e2e-base.yml b/.github/workflows/e2e-base.yml new file mode 100644 index 00000000000..d79a43b8676 --- /dev/null +++ b/.github/workflows/e2e-base.yml @@ -0,0 +1,35 @@ +on: + workflow_call: + inputs: + testScript: + required: true + type: string + +name: E2E + +jobs: + test: + name: 'Test (${{ matrix.os }}, Node ${{ matrix.node }})' + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - 'ubuntu-latest' + node: + - '16' + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + cache: 'npm' + - name: Install + run: npm ci --prefer-offline + - name: Initialize Global Git config + run: | + git config --global core.autocrlf false + git config --global user.name "Create React App" + git config --global user.email "cra@email.com" + - name: Run tests + run: ${{ inputs.testScript }} diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml deleted file mode 100644 index 88699dfa278..00000000000 --- a/.github/workflows/integration.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Integration Tests - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - job: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - node: ['14', '16'] - steps: - - uses: actions/checkout@v2 - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - cache: 'npm' - - name: Install npm@8 - run: npm i -g npm@8 - - name: Install yarn - run: npm i -g yarn - - name: Install packages - run: npm ci --prefer-offline - - name: Run integration tests - run: npm run test:integration diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 456951bc671..47bd841572e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,17 +6,13 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: '14' + node-version: '16' cache: 'npm' - - name: Install npm@8 - run: npm i -g npm@8 - name: Install run: npm ci --prefer-offline - - name: Build - run: npm run build - name: Alex run: npm run alex - name: Prettier diff --git a/README.md b/README.md index 91283e853e4..4672c9f993d 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 & Test](https://github.com/facebook/create-react-app/actions/workflows/build-and-test.yml/badge.svg?branch=main)](https://github.com/facebook/create-react-app/actions/workflows/build-and-test.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/blob/main/CONTRIBUTING.md) Logo diff --git a/azure-pipelines-test-job.yml b/azure-pipelines-test-job.yml deleted file mode 100644 index cdf3f4dacfd..00000000000 --- a/azure-pipelines-test-job.yml +++ /dev/null @@ -1,41 +0,0 @@ -# -# Azure Pipelines job 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 } - -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 - path: create-react-app - - - task: NodeTool@0 - inputs: - versionSpec: $(nodeVersion) - displayName: 'Install Node.js' - - - script: npm i -g npm@8 - displayName: 'Update npm to v8' - - - script: npm ci - displayName: 'Run npm ci' - - - bash: ${{ parameters.testScript }} - displayName: 'Run tests' diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 8c51a73a8c2..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,77 +0,0 @@ -# -# Azure Pipelines configuration for building and testing create-react-app on Linux, Windows, and macOS. -# - -trigger: - - main - -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 - # 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 - -# ****************************************************************************** -# Simple test suite -# ****************************************************************************** -jobs: - - template: azure-pipelines-test-job.yml - parameters: - name: Simple - testScript: tasks/e2e-simple.sh - - # ****************************************************************************** - # Installs test suite - # ****************************************************************************** - - template: azure-pipelines-test-job.yml - parameters: - name: Installs - testScript: tasks/e2e-installs.sh - - # ****************************************************************************** - # Kitchensink test suite - # ****************************************************************************** - - template: azure-pipelines-test-job.yml - parameters: - name: Kitchensink - testScript: tasks/e2e-kitchensink.sh - - # ****************************************************************************** - # Kitchensink Eject test suite - # ****************************************************************************** - # - template: azure-pipelines-test-job.yml - # parameters: - # name: KitchensinkEject - # testScript: tasks/e2e-kitchensink-eject.sh - - # ****************************************************************************** - # Behavior test suite - # ****************************************************************************** - # - template: azure-pipelines-test-job.yml - # parameters: - # name: Behavior - # testScript: tasks/e2e-behavior.sh - # configurations: - # LinuxNode14: { vmImage: 'ubuntu-latest', nodeVersion: 14.x } - # LinuxNode16: { vmImage: 'ubuntu-latest', nodeVersion: 16.x } - # WindowsNode14: { vmImage: 'windows-2019', nodeVersion: 14.x } - # WindowsNode16: { vmImage: 'windows-2019', nodeVersion: 16.x } - # MacNode14: { vmImage: 'macOS-10.15', nodeVersion: 14.x } - # MacNode16: { vmImage: 'macOS-10.15', nodeVersion: 16.x } - - # ****************************************************************************** - # Old Node test suite - # ****************************************************************************** - - job: OldNode - pool: - vmImage: 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'