Skip to content

Commit d124c37

Browse files
authored
ci: re-enable react-native-macos-init pipeline (#2243)
* ci: re-enable `react-native-macos-init` pipeline * break cycle? * fixup! ci: re-enable `react-native-macos-init` pipeline * fix `getBuildSettings()` * Update test-react-native-macos-init.yml
1 parent 3ba188a commit d124c37

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

.ado/apple-pr.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ stages:
2626
dependsOn: []
2727
jobs:
2828
- template: /.ado/jobs/test-javascript.yml@self
29-
3029
- template: /.ado/jobs/npm-publish-dry-run.yml@self
3130

32-
# - stage: Integration
33-
# dependsOn: []
34-
# jobs:
35-
#- template: /.ado/jobs/test-react-native-macos-init.yml@self
36-
37-
# - template: /.ado/jobs/react-native-test-app-integration.yml@self
31+
- stage: Integration
32+
dependsOn: []
33+
jobs:
34+
- template: /.ado/jobs/test-react-native-macos-init.yml@self
35+
#- template: /.ado/jobs/react-native-test-app-integration.yml@self

.ado/jobs/test-react-native-macos-init.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ jobs:
3535
.ado/scripts/verdaccio.sh publish --branch origin/$(System.PullRequest.TargetBranch)
3636
displayName: Publish react-native-macos to Verdaccio
3737
38+
- script: |
39+
node .ado/scripts/export-versions.mjs
40+
displayName: Determine react-native version
41+
3842
- script: |
3943
set -eox pipefail
40-
npx --yes @react-native-community/cli init testcli --version 0.75 --skip-install
44+
npx --yes @react-native-community/cli init testcli --version $(react_native_version) --skip-install
4145
workingDirectory: $(Agent.BuildDirectory)
4246
displayName: Initialize a new project
4347
@@ -54,7 +58,6 @@ jobs:
5458
# We need to set the npm registry here otherwise it won't stick
5559
$(Build.Repository.LocalPath)/.ado/scripts/verdaccio.sh configure
5660
node $(Build.Repository.LocalPath)/packages/react-native-macos-init/bin.js --verbose --version latest --overwrite --prerelease
57-
yarn why react-native-macos
5861
workingDirectory: $(Agent.BuildDirectory)/testcli
5962
displayName: Apply macOS template (new project)
6063

.ado/scripts/export-versions.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// @ts-check
2+
import * as fs from "node:fs";
3+
import { URL } from "node:url";
4+
5+
/**
6+
* @param {string} version
7+
* @returns {string}
8+
*/
9+
function coerce(version) {
10+
const [major, minor = 0] = version.split("-")[0].split(".");
11+
return `${major}.${minor}`;
12+
}
13+
14+
/**
15+
* @param {string} name
16+
* @param {unknown} value
17+
*/
18+
function exportValue(name, value) {
19+
console.log(`##vso[task.setvariable variable=${name}]${value}`);
20+
}
21+
22+
const manifestPath = new URL("../../packages/react-native/package.json", import.meta.url);
23+
const json = fs.readFileSync(manifestPath, { encoding: "utf-8" });
24+
const { dependencies, peerDependencies } = JSON.parse(json);
25+
26+
exportValue("react_version", peerDependencies["react"]);
27+
exportValue("react_native_version", coerce(dependencies["@react-native/codegen"]));

0 commit comments

Comments
 (0)