Skip to content
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
29 changes: 29 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Azure Pipelines configuration for building and testing react on Linux, Windows, and macOS.
#

trigger:
- master

jobs:
- job: Linux
displayName: 'Linux'
pool:
vmImage: 'ubuntu-16.04'
steps:
- bash: echo $(REPO_SLUG)
- bash: echo $(CI_PULL_REQUEST)

- job: Windows
displayName: 'Windows'
pool:
vmImage: 'vs2017-win2016'
steps:
- bash: echo $(REPO_SLUG)
- bash: echo $(CI_PULL_REQUEST)

variables:
AZURE_PIPELINES_BRANCH: $(Build.SourceBranchName)
CI: true
CI_PULL_REQUEST: $[ eq( variables['Build.Reason'], 'PullRequest') ]
REPO_SLUG: $(Build.Repository.Name)
18 changes: 18 additions & 0 deletions .azure-pipelines/common/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Azure Pipelines setup configuration for react on Linux, Windows, and macOS.
#

steps:
- script: |
git config core.autocrlf input
git reset HEAD --hard
displayName: 'Preserve LF endings on checkout'

- task: NodeTool@0
inputs:
versionSpec: '10.x'
checkLatest: 'true'
displayName: 'Install Node.js'

- script: yarn --frozen-lockfile
displayName: 'Install packages'
10 changes: 10 additions & 0 deletions .azure-pipelines/common/publish-error-codes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Azure Pipelines step to publish error code artifacts for react on Linux, Windows, and macOS.
#

steps:
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: './scripts/error-codes/codes.json'
artifactName: ${{ parameters.artifactName }}
displayName: 'Publish error-codes/codes.json'
36 changes: 36 additions & 0 deletions .azure-pipelines/linux/basic-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# Azure Pipelines configuration for running tests and other checks on Linux/macOS.
#

steps:
- script: yarn prettier-ci
displayName: 'Prettier'

- script: node ./scripts/tasks/flow-ci
displayName: 'Flow CI'

- script: |
export JEST_JUNIT_OUTPUT=.azure-pipelines/test-results/test-basic-linux.xml
yarn test --maxWorkers=2
displayName: 'Run tests'

- script: ./scripts/circleci/check_license.sh
displayName: 'Check license'

- script: ./scripts/circleci/check_modules.sh
displayName: 'Check modules'

- script: ./scripts/circleci/test_print_warnings.sh
displayName: 'Test print warnings'

# TODO: Need to set up connection with GitHub and env vars. for this to work
- script: ./scripts/circleci/track_stats.sh
displayName: 'Track stats'

- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux: Basic'
testResultsFormat: 'JUnit'
testResultsFiles: '.azure-pipelines/test-results/test-basic-linux.xml'
displayName: 'Publish test results to Azure Pipelines'
condition: succeededOrFailed()
55 changes: 55 additions & 0 deletions .azure-pipelines/linux/build-and-upload-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# Azure Pipelines configuration for building and uploading artifacts on Linux/macOS.
#

steps:
- script: ./scripts/circleci/add_build_info_json.sh
displayName: 'Add build info json'

- script: ./scripts/circleci/update_package_versions.sh
displayName: 'Update package versions'

- script: ./scripts/circleci/build.sh
displayName: 'Build'

- script: |
export JEST_JUNIT_OUTPUT=.azure-pipelines/test-results/test-build-linux.xml
yarn test-build --maxWorkers=2
displayName: 'Run build tests'

- script: |
export JEST_JUNIT_OUTPUT=.azure-pipelines/test-results/test-build-prod-linux.xml
yarn test-build-prod --maxWorkers=2
displayName: 'Run build prod tests'

- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux: Build'
testResultsFormat: 'JUnit'
testResultsFiles: '.azure-pipelines/test-results/test-build-linux.xml'
displayName: 'Publish build test results to Azure Pipelines'
condition: succeededOrFailed()

- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux: Build Prod'
testResultsFormat: 'JUnit'
testResultsFiles: '.azure-pipelines/test-results/test-build-prod-linux.xml'
displayName: 'Publish build prod test results to Azure Pipelines'
condition: succeededOrFailed()

- script: node ./scripts/tasks/danger
displayName: 'Danger'

- script: ./scripts/circleci/upload_build.sh
displayName: 'Upload build'

- script: ./scripts/circleci/pack_and_store_artifact.sh
displayName: 'Pack artifacts'

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: './node_modules.tgz'
artifactName: 'node_modules'
publishLocation: 'container'
displayName: 'Publish node_modules.tgz'
30 changes: 30 additions & 0 deletions .azure-pipelines/linux/fire-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Azure Pipelines configuration for running React Fire tests on Linux/macOS.
#

steps:
- script: |
export JEST_JUNIT_OUTPUT=.azure-pipelines/test-results/test-fire-linux.xml
yarn test-fire --maxWorkers=2
displayName: 'Run Fire tests'

- script: |
export JEST_JUNIT_OUTPUT=.azure-pipelines/test-results/test-fire-prod-linux.xml
yarn test-fire-prod --maxWorkers=2
displayName: 'Run Fire prod tests'

- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux: Fire'
testResultsFormat: 'JUnit'
testResultsFiles: '.azure-pipelines/test-results/test-fire-linux.xml'
displayName: 'Publish Fire test results to Azure Pipelines'
condition: succeededOrFailed()

- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux: Fire Prod'
testResultsFormat: 'JUnit'
testResultsFiles: '.azure-pipelines/test-results/test-fire-prod-linux.xml'
displayName: 'Publish Fire prod test results to Azure Pipelines'
condition: succeededOrFailed()
17 changes: 17 additions & 0 deletions .azure-pipelines/linux/prod-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Azure Pipelines configuration for running prod tests on Linux/macOS.
#

steps:
- script: |
export JEST_JUNIT_OUTPUT=.azure-pipelines/test-results/test-prod-linux.xml
yarn test-prod --maxWorkers=2
displayName: 'Run prod tests'

- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux: Prod'
testResultsFormat: 'JUnit'
testResultsFiles: '.azure-pipelines/test-results/test-prod-linux.xml'
displayName: 'Publish test results to Azure Pipelines'
condition: succeededOrFailed()
7 changes: 7 additions & 0 deletions .azure-pipelines/linux/test-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Azure Pipelines configuration for running test coverage on Linux/macOS.
#

steps:
- script: ./scripts/circleci/test_coverage.sh
displayName: 'Test coverage'
23 changes: 23 additions & 0 deletions .azure-pipelines/windows/basic-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Azure Pipelines configuration for building and testing react on Windows.
#

steps:
- script: yarn build
displayName: 'Build'

- script: |
set JEST_JUNIT_OUTPUT=.azure-pipelines/test-results/test-basic-windows.xml&&
yarn test
displayName: 'Run tests'

- script: yarn prettier-ci
displayName: 'Prettier'

- task: PublishTestResults@2
inputs:
testRunTitle: 'Windows: Basic'
testResultsFormat: 'JUnit'
testResultsFiles: '.azure-pipelines/test-results/test-basic-windows.xml'
displayName: 'Publish test results to Azure Pipelines'
condition: succeededOrFailed()
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:

environment:
TZ: /usr/share/zoneinfo/America/Los_Angeles
TRAVIS_REPO_SLUG: facebook/react
REPO_SLUG: facebook/react

parallelism: 4

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ chrome-user-data
.vscode
*.swp
*.swo
junit.xml
.azure-pipelines/test-results/
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"jasmine-check": "^1.0.0-rc.0",
"jest": "^23.1.0",
"jest-diff": "^23.0.1",
"jest-junit": "^6.3.0",
"minimatch": "^3.0.4",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
Expand Down Expand Up @@ -91,7 +92,8 @@
"node": "8.x || 9.x || 10.x || 11.x"
},
"jest": {
"testRegex": "/scripts/jest/dont-run-jest-directly\\.js$"
"testRegex": "/scripts/jest/dont-run-jest-directly\\.js$",
"reporters": ["default", "jest-junit"]
},
"scripts": {
"build": "node ./scripts/rollup/build.js",
Expand All @@ -111,6 +113,7 @@
"flow-ci": "node ./scripts/tasks/flow-ci.js",
"prettier": "node ./scripts/prettier/index.js write-changed",
"prettier-all": "node ./scripts/prettier/index.js write",
"prettier-ci": "git fetch origin master:master && node ./scripts/prettier/index.js",
"version-check": "node ./scripts/tasks/version-check.js"
}
}
26 changes: 7 additions & 19 deletions scripts/facts-tracker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ function exec(command, args) {
return execFileSync(command, args, options).toString();
}

const isCI = !!process.env.TRAVIS_REPO_SLUG;
const isCI = !!process.env.REPO_SLUG;

if (isCI) {
const branch = process.env.TRAVIS_BRANCH || process.env.CIRCLE_BRANCH;
const isPullRequest =
(!!process.env.TRAVIS_PULL_REQUEST &&
process.env.TRAVIS_PULL_REQUEST !== 'false') ||
!!process.env.CI_PULL_REQUEST;
const branch =
process.env.CIRCLE_BRANCH || process.env.AZURE_PIPELINES_BRANCH;
const isPullRequest = !!process.env.CI_PULL_REQUEST;

if (branch !== 'master') {
console.error('facts-tracker: Branch is not master, exiting...');
Expand All @@ -50,20 +48,10 @@ if (isCI) {
'\n' +
'Go to https://github.com/settings/tokens/new\n' +
' - Fill "Token description" with "facts-tracker for ' +
process.env.TRAVIS_REPO_SLUG +
process.env.REPO_SLUG +
'"\n' +
' - Check "public_repo"\n' +
' - Press "Generate Token"\n' +
'\n' +
'In a different tab, go to https://travis-ci.org/' +
process.env.TRAVIS_REPO_SLUG +
'/settings\n' +
' - Make sure "Build only if .travis.yml is present" is ON\n' +
' - Fill "Name" with "GITHUB_USER" and "Value" with the name of the ' +
'account you generated the token with. Press "Add"\n' +
'\n' +
'Once this is done, commit anything to the repository to restart ' +
'Travis and it should work :)'
' - Press "Generate Token"\n'
);
process.exit(1);
}
Expand All @@ -89,7 +77,7 @@ if (process.argv.length <= 2) {

function getRepoSlug() {
if (isCI) {
return process.env.TRAVIS_REPO_SLUG;
return process.env.REPO_SLUG;
}

const remotes = exec('git', ['remote', '-v']).split('\n');
Expand Down
1 change: 1 addition & 0 deletions scripts/jest/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ module.exports = {
roots: ['<rootDir>/packages', '<rootDir>/scripts'],
collectCoverageFrom: ['packages/**/*.js'],
timers: 'fake',
reporters: ['default', 'jest-junit'],
};
Loading