Skip to content

Move e2e tests to GitHub Actions #12551

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
53 changes: 30 additions & 23 deletions azure-pipelines.yml → .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#
# 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
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.
VSTS_OVERWRITE_TEMP: True
CRA_INTERNAL_TEST: true
Expand All @@ -18,24 +21,27 @@ variables:
# Simple test suite
# ******************************************************************************
jobs:
- template: azure-pipelines-test-job.yml
parameters:
simple:
uses: ./.github/workflows/test-job.yml
with:
name: Simple
testScript: tasks/e2e-simple.sh

# ******************************************************************************
# Installs test suite
# ******************************************************************************
- template: azure-pipelines-test-job.yml
parameters:
installs:
uses: ./.github/workflows/test-job.yml
with:
name: Installs
testScript: tasks/e2e-installs.sh

# ******************************************************************************
# Kitchensink test suite
# ******************************************************************************
- template: azure-pipelines-test-job.yml
parameters:
kitchensink:
uses: ./.github/workflows/test-job.yml
with:
name: Kitchensink
testScript: tasks/e2e-kitchensink.sh

Expand Down Expand Up @@ -65,13 +71,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'
46 changes: 46 additions & 0 deletions .github/workflows/test-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# GitHub Actions workflow for building and testing create-react-app on Linux, Windows, and macOS.
#

on:
workflow_call:
inputs:
name:
default: ''
required: true
type: string
testScript:
default: ''
required: true
type: string

jobs:
build:
name: ${{ inputs.name }}
strategy:
matrix:
node-version: [14.x, 16.x]
runs-on: ubuntu-latest
steps:
- run: |
git config --global core.autocrlf false
git config --global user.name "Create React App"
git config --global user.email "[email protected]"
name: 'Initialize Git config'

- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
name: 'Install Node.js'

- run: npm i -g npm@8
name: 'Update npm to v8'

- run: npm ci
name: 'Run npm ci'

- run: ${{ inputs.testScript }}
name: 'Run tests'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)

<img alt="Logo" align="right" src="https://create-react-app.dev/img/logo.svg" width="20%" />

Expand Down
41 changes: 0 additions & 41 deletions azure-pipelines-test-job.yml

This file was deleted.