Skip to content

Commit

Permalink
ci: re-enable react-native-macos-init pipeline (#2243)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tido64 authored Oct 25, 2024
1 parent 3ba188a commit d124c37
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
12 changes: 5 additions & 7 deletions .ado/apple-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ stages:
dependsOn: []
jobs:
- template: /.ado/jobs/test-javascript.yml@self

- template: /.ado/jobs/npm-publish-dry-run.yml@self

# - stage: Integration
# dependsOn: []
# jobs:
#- template: /.ado/jobs/test-react-native-macos-init.yml@self

# - template: /.ado/jobs/react-native-test-app-integration.yml@self
- stage: Integration
dependsOn: []
jobs:
- template: /.ado/jobs/test-react-native-macos-init.yml@self
#- template: /.ado/jobs/react-native-test-app-integration.yml@self
7 changes: 5 additions & 2 deletions .ado/jobs/test-react-native-macos-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ jobs:
.ado/scripts/verdaccio.sh publish --branch origin/$(System.PullRequest.TargetBranch)
displayName: Publish react-native-macos to Verdaccio
- script: |
node .ado/scripts/export-versions.mjs
displayName: Determine react-native version
- script: |
set -eox pipefail
npx --yes @react-native-community/cli init testcli --version 0.75 --skip-install
npx --yes @react-native-community/cli init testcli --version $(react_native_version) --skip-install
workingDirectory: $(Agent.BuildDirectory)
displayName: Initialize a new project
Expand All @@ -54,7 +58,6 @@ jobs:
# We need to set the npm registry here otherwise it won't stick
$(Build.Repository.LocalPath)/.ado/scripts/verdaccio.sh configure
node $(Build.Repository.LocalPath)/packages/react-native-macos-init/bin.js --verbose --version latest --overwrite --prerelease
yarn why react-native-macos
workingDirectory: $(Agent.BuildDirectory)/testcli
displayName: Apply macOS template (new project)
Expand Down
27 changes: 27 additions & 0 deletions .ado/scripts/export-versions.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// @ts-check
import * as fs from "node:fs";
import { URL } from "node:url";

/**
* @param {string} version
* @returns {string}
*/
function coerce(version) {
const [major, minor = 0] = version.split("-")[0].split(".");
return `${major}.${minor}`;
}

/**
* @param {string} name
* @param {unknown} value
*/
function exportValue(name, value) {
console.log(`##vso[task.setvariable variable=${name}]${value}`);
}

const manifestPath = new URL("../../packages/react-native/package.json", import.meta.url);
const json = fs.readFileSync(manifestPath, { encoding: "utf-8" });
const { dependencies, peerDependencies } = JSON.parse(json);

exportValue("react_version", peerDependencies["react"]);
exportValue("react_native_version", coerce(dependencies["@react-native/codegen"]));

0 comments on commit d124c37

Please sign in to comment.