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

trigger:
- master

jobs:
- job: Lint
displayName: 'Lint'
pool:
vmImage: 'ubuntu-16.04'
steps:
- template: .azure-pipelines/common/setup.yml
- script: ./scripts/circleci/track_stats.sh
displayName: 'Track stats'
- job: Job2
displayName: 'Job2'
pool:
vmImage: 'ubuntu-16.04'
steps:
- template: .azure-pipelines/common/setup.yml
- template: .azure-pipelines/linux/basic-tests.yml

variables:
AZURE_PIPELINES_BRANCH: $(Build.SourceBranchName)
CI: true
CI_PULL_REQUEST: eq( $(Build.Reason), 'PullRequest')
REPO_SLUG: $(BUILD_REPOSITORYNAME)

11 changes: 11 additions & 0 deletions .azure-pipelines/common/publish-error-codes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# 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 }}
publishLocation: 'container'
displayName: 'Publish error-codes/codes.json'
17 changes: 17 additions & 0 deletions .azure-pipelines/common/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Azure Pipelines setup configuration for react on Linux, Windows, and macOS.
#

steps:
# master is not fetched by default and is needed to run prettier
- script: git fetch origin master:master
displayName: 'Checkout master'

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

- script: yarn --frozen-lockfile
displayName: 'Install packages'
57 changes: 57 additions & 0 deletions .azure-pipelines/linux/basic-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
# Azure Pipelines configuration for running tests and other checks on Linux/macOS.
#

steps:
- script: node ./scripts/prettier/index
displayName: 'Prettier'

- bash: echo $REPO_SLUG

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

- bash: echo $REPO_SLUG

- 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'

- bash: echo $REPO_SLUG

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

- bash: echo $REPO_SLUG

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

- bash: echo $REPO_SLUG

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

- bash: echo $REPO_SLUG

# 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 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 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 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 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'
21 changes: 21 additions & 0 deletions .azure-pipelines/windows/basic-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# 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
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/
4 changes: 3 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 Down
41 changes: 22 additions & 19 deletions scripts/facts-tracker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,28 @@ function exec(command, args) {
return execFileSync(command, args, options).toString();
}

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

console.log('process.env.REPO_SLUG:');
console.log(process.env.REPO_SLUG);

console.log('process.env.CI_PULL_REQUEST:');
console.log(process.env.CI_PULL_REQUEST);

console.log('process.env.CI:');
console.log(process.env.CI);

console.log('isCI:');
console.log(isCI);

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;

console.log('branch:');
console.log(branch);

if (branch !== 'master') {
console.error('facts-tracker: Branch is not master, exiting...');
process.exit(0);
Expand All @@ -50,20 +63,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 +92,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