-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add beachball change transformer (#9488)
* Add beachball change transformer Beachball has a relatively recent option, which allows modifying changefiles before trying to bump/publish. We can use this to workaround two common painpoints. 1. Changes backported to 0.69 and later will not need any modification to changefiles when cherry-picking. 2. We do some formatting to create consistency of omiting the version in change messages in our changelogs * Remove stale file * Change files * Fix bug around missing packages * Fuller JS env in setup * Simplify logic * Fix template path * use remote midgard-yarn on ubuntu agent * yaml * Build more * Move beachball config to its own package * Consistency * Cleanup yarn install logic for hosted vs managed images * Fixup lockfile issues * Update min to node 14 * Import shared variables and rename * Variable fixup
- Loading branch information
1 parent
e8f0f0d
commit dfc6ca9
Showing
23 changed files
with
240 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,30 +2,16 @@ | |
jobs: | ||
- job: MacTests | ||
displayName: macOS Tests | ||
|
||
variables: | ||
- template: ../variables/macos.yml | ||
|
||
pool: | ||
vmImage: $(VmImage) | ||
|
||
timeoutInMinutes: 20 # how long to run the job before automatically cancelling | ||
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them | ||
timeoutInMinutes: 20 | ||
variables: [template: ../variables/shared.yml] | ||
pool: {vmImage: macOS-10.15} | ||
|
||
steps: | ||
- template: ../templates/checkout-shallow.yml | ||
|
||
# Explicitly set Node version and install midgard-yarn since we are | ||
# running on a public pool | ||
- task: NodeTool@0 | ||
displayName: Set Node Version | ||
inputs: | ||
versionSpec: '16.x' | ||
|
||
- script: npm install -g [email protected] | ||
displayName: Install midgard-yarn | ||
|
||
- template: ../templates/prepare-js-env.yml | ||
parameters: | ||
agentImage: HostedImage | ||
|
||
- script: yarn test | ||
displayName: yarn test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,11 @@ parameters: | |
|
||
jobs: | ||
- job: Setup | ||
timeoutInMinutes: 3 | ||
pool: | ||
vmImage: ubuntu-latest | ||
displayName: Setup | ||
timeoutInMinutes: 3 # Kill the job early to catch Beachball hangs | ||
variables: [template: ../variables/shared.yml] | ||
pool: {vmImage: ubuntu-latest} | ||
|
||
steps: | ||
- template: ../templates/checkout-full.yml | ||
|
||
|
@@ -18,8 +20,12 @@ jobs: | |
|
||
- template: ../templates/compute-beachball-branch-name.yml | ||
|
||
- script: npm install -g [email protected] | ||
displayName: Install beachball | ||
- template: ../templates/yarn-install.yml | ||
parameters: | ||
agentImage: HostedImage | ||
|
||
- script: npx lage build --scope @rnw-scripts/beachball-config --no-deps | ||
displayName: Minimal build | ||
|
||
- ${{ if eq(parameters.buildEnvironment, 'PullRequest') }}: | ||
- script: npx beachball check --branch origin/$(BeachBallBranchName) --verbose --changehint "##vso[task.logissue type=error]Run `yarn change` from root of repo to generate a change file." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
# Steps to setup an environment that can run JavaScript executables | ||
parameters: | ||
- name: agentImage | ||
type: string | ||
default: ManagedImage | ||
values: | ||
- ManagedImage | ||
- HostedImage | ||
|
||
steps: | ||
- ${{ if eq(parameters.agentImage, 'HostedImage') }}: | ||
- task: NodeTool@0 | ||
displayName: Set Node Version | ||
inputs: | ||
versionSpec: '16.x' | ||
|
||
- template: yarn-install.yml | ||
parameters: | ||
agentImage: ${{ parameters.agentImage }} | ||
|
||
- script: yarn build | ||
displayName: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,22 @@ parameters: | |
- name: workingDirectory | ||
type: string | ||
default: . | ||
- name: frozenLockfile | ||
type: boolean | ||
default: true | ||
- name: agentImage | ||
type: string | ||
default: ManagedImage | ||
values: | ||
- ManagedImage | ||
- HostedImage | ||
|
||
steps: | ||
- ${{ if eq(parameters.frozenLockfile, true) }}: | ||
# When using our own images, prefer the machine-installed version of | ||
# `midgard-yarn`. | ||
- ${{ if eq(parameters.agentImage, 'ManagedImage') }}: | ||
- script: midgard-yarn --frozen-lockfile --cwd ${{ parameters.workingDirectory }} | ||
displayName: midgard-yarn (faster yarn install) | ||
|
||
- ${{ if eq(parameters.frozenLockfile, false) }}: | ||
- script: midgard-yarn --cwd ${{ parameters.workingDirectory }} | ||
# If using an image we don't control, acquire a fixed version of midgard-yarn | ||
# before install | ||
- ${{ else }}: | ||
- script: npx --yes [email protected] --frozen-lockfile --cwd ${{ parameters.workingDirectory }} | ||
displayName: midgard-yarn (faster yarn install) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. | ||
* Licensed under the MIT License. | ||
* @format | ||
* @ts-check | ||
*/ | ||
|
||
const {execSync} = require('child_process'); | ||
|
||
module.exports = { | ||
...require(`${__dirname}/packages/@rnw-scripts/generated-beachball-config/beachball.config.g.json`), | ||
|
||
// Do not generate tags for monorepo packages by default, to avoid a GitHub | ||
// release for every package. | ||
gitTags: false, | ||
|
||
hooks: { | ||
// Stamp versions when we publish a new package | ||
postbump: (_packagePath, name, version) => { | ||
if (name === 'react-native-windows') { | ||
console.log(`Stamping RNW Version ${version}`); | ||
execSync(`yarn stamp-version ${version}`); | ||
} | ||
} | ||
} | ||
} | ||
module.exports = require("@rnw-scripts/beachball-config"); |
7 changes: 7 additions & 0 deletions
7
change/@react-native-windows-find-repo-root-49c04e76-0b4c-4f2a-9648-e2434b2ca7f6.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Sync variants", | ||
"packageName": "@react-native-windows/find-repo-root", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@react-native-windows-package-utils-d6f6ad6f-47cc-463d-9359-8550750bece1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Sync variants", | ||
"packageName": "@react-native-windows/package-utils", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 0 additions & 7 deletions
7
change/node-rnw-rpc-6fae19ab-7d3e-488e-83c6-cb979474aebb.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
packages/@rnw-bots/coordinator/lib-commonjs/HeartbeatFunction/index.d.ts
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
packages/@rnw-bots/coordinator/lib-commonjs/HeartbeatFunction/index.js
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/@rnw-bots/coordinator/lib-commonjs/HeartbeatFunction/index.js.map
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
lib/ | ||
lib-commonjs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "@rnw-scripts/beachball-config", | ||
"private": true, | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "rnw-scripts build", | ||
"clean": "rnw-scripts clean", | ||
"lint": "rnw-scripts lint", | ||
"lint:fix": "rnw-scripts lint:fix", | ||
"watch": "rnw-scripts watch" | ||
}, | ||
"main": "lib-commonjs/beachball.config.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/microsoft/react-native-windows.git", | ||
"directory": "packages/@rnw-scripts/beachball-config" | ||
}, | ||
"dependencies": { | ||
"@react-native-windows/package-utils": "0.0.0-canary.25", | ||
"@rnw-scripts/stamp-version": "0.0.0", | ||
"find-up": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"@rnw-scripts/eslint-config": "1.1.11", | ||
"@rnw-scripts/just-task": "2.2.3", | ||
"@rnw-scripts/ts-config": "2.0.2", | ||
"@types/node": "^14.14.22", | ||
"beachball": "^2.20.0", | ||
"eslint": "^7.32.0", | ||
"just-scripts": "^1.3.3", | ||
"prettier": "^2.4.1", | ||
"typescript": "^4.4.4" | ||
}, | ||
"files": [ | ||
"lib-commonjs" | ||
], | ||
"engines": { | ||
"node": ">= 14.0.0" | ||
} | ||
} |
Oops, something went wrong.