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
8 changes: 7 additions & 1 deletion .ado/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ extends:
script: |
npm install --global yarn@1.22.22 midgard-yarn@1.23.34 verdaccio@6.7.2
displayName: Install Node base packages
retryCountOnTaskFailure: 2

- template: .ado/templates/compute-beachball-branch-name.yml@self

Expand All @@ -182,7 +183,12 @@ extends:

- script: npx --yes midgard-yarn-strict@1.2.4 @rnw-scripts/beachball-config
displayName: Strict yarn install @rnw-scripts/beachball-config
condition: and(succeeded(), eq(variables['detectScenario.isReleaseBuild'], 'False'))
condition: and(succeeded(), eq(variables['detectScenario.isReleaseBuild'], 'False'), ne(variables['Build.Reason'], 'PullRequest'))
retryCountOnTaskFailure: 2

- pwsh: .ado/scripts/install-yarn-dependencies.ps1 -Installer Strict -Scope '@rnw-scripts/beachball-config'
displayName: Strict yarn install @rnw-scripts/beachball-config
condition: and(succeeded(), eq(variables['detectScenario.isReleaseBuild'], 'False'), eq(variables['Build.Reason'], 'PullRequest'))
retryCountOnTaskFailure: 2

- script: npx lage build --scope @rnw-scripts/prepare-release --scope @rnw-scripts/beachball-config
Expand Down
3 changes: 3 additions & 0 deletions .ado/pr-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ pr:

variables:
- group: platform-override-zero-permission-token
# PR builds use the anonymous package proxy because 1ES network isolation blocks public registries.
- name: NPM_CONFIG_REGISTRY
value: https://packagefeedproxy.microsoft.io/npm/
Comment on lines +18 to +19

extends:
template: build-template.yml@self
Expand Down
66 changes: 66 additions & 0 deletions .ado/scripts/install-yarn-dependencies.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
param(
[Parameter(Mandatory = $true)]
[ValidateSet('Strict', 'Midgard', 'MidgardNpx')]
[string] $Installer,

[string] $WorkingDirectory = '.',

[string] $Scope
)

$resolvedWorkingDirectory = (Resolve-Path $WorkingDirectory).Path
$lockFile = Join-Path $resolvedWorkingDirectory 'yarn.lock'
$originalLockFile = $null

if ($env:BUILD_REASON -eq 'PullRequest') {
if (-not (Test-Path -LiteralPath $lockFile -PathType Leaf)) {
throw "Could not find yarn.lock in '$resolvedWorkingDirectory'."
}

$registry = $env:NPM_CONFIG_REGISTRY
if ([string]::IsNullOrWhiteSpace($registry)) {
throw 'NPM_CONFIG_REGISTRY must be set for the network-isolated PR install.'
}

$registry = $registry.TrimEnd('/') + '/'
$originalLockFile = [System.IO.File]::ReadAllBytes($lockFile)
$lockFileText = [System.Text.Encoding]::UTF8.GetString($originalLockFile)
$remappedLockFileText = $lockFileText.
Replace('https://registry.yarnpkg.com/', $registry).
Replace('https://registry.npmjs.org/', $registry)

Write-Host "Temporarily routing yarn.lock package URLs through $registry"
[System.IO.File]::WriteAllText(
$lockFile,
$remappedLockFileText,
[System.Text.UTF8Encoding]::new($false)
)
}

try {
switch ($Installer) {
'Strict' {
$arguments = @('--yes', 'midgard-yarn-strict@1.2.4')
if (-not [string]::IsNullOrWhiteSpace($Scope)) {
$arguments += $Scope
}
& npx @arguments
}
'Midgard' {
& midgard-yarn --ignore-scripts --frozen-lockfile --cwd $resolvedWorkingDirectory
}
'MidgardNpx' {
& npx --yes midgard-yarn@1.23.34 --ignore-scripts --frozen-lockfile --cwd $resolvedWorkingDirectory
}
}

if ($LASTEXITCODE -ne 0) {
throw "$Installer dependency installation exited with code $LASTEXITCODE."
}
}
finally {
if ($null -ne $originalLockFile) {
[System.IO.File]::WriteAllBytes($lockFile, $originalLockFile)
Write-Host 'Restored the original yarn.lock.'
}
}
45 changes: 38 additions & 7 deletions .ado/templates/react-native-init-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ parameters:
steps:
# Start npm test server
- template: verdaccio-start.yml
parameters:
buildEnvironment: ${{ parameters.buildEnvironment }}

- template: set-version-vars.yml
parameters:
Expand All @@ -46,7 +48,9 @@ steps:

- ${{ if endsWith(parameters.template, '-app') }}:
- script: |
$(Build.SourcesDirectory)\vnext\Scripts\creaternwapp.cmd /rn $(reactNativeDevDependency) /rnw $(npmVersion) /t ${{ parameters.template }} /verdaccio testcli
if exist testcli rmdir /s /q testcli
if exist testcli exit /b 1
call $(Build.SourcesDirectory)\vnext\Scripts\creaternwapp.cmd /rn $(reactNativeDevDependency) /rnw $(npmVersion) /t ${{ parameters.template }} /verdaccio testcli
displayName: Init new app project with creaternwapp.cmd
workingDirectory: $(Agent.BuildDirectory)
retryCountOnTaskFailure: 2
Expand All @@ -55,7 +59,9 @@ steps:

- ${{ if endsWith(parameters.template, '-lib') }}:
- script: |
$(Build.SourcesDirectory)\vnext\Scripts\creaternwlib.cmd /rn $(reactNativeDevDependency) /rnw $(npmVersion) /t ${{ parameters.template }} /verdaccio testcli
if exist testcli rmdir /s /q testcli
if exist testcli exit /b 1
call $(Build.SourcesDirectory)\vnext\Scripts\creaternwlib.cmd /rn $(reactNativeDevDependency) /rnw $(npmVersion) /t ${{ parameters.template }} /verdaccio testcli
displayName: Init new lib project with creaternwlib.cmd
workingDirectory: $(Agent.BuildDirectory)
retryCountOnTaskFailure: 2
Expand Down Expand Up @@ -99,11 +105,36 @@ steps:
workingDirectory: $(Agent.BuildDirectory)\testcli

- pwsh: |
nuget.exe sources add -name TestFeed -source $(System.DefaultWorkingDirectory)\NugetTestFeed
nuget.exe sources remove -name react-native
nuget.exe sources remove -name Nuget.org
nuget.exe sources add -name Nuget.org -source https://api.nuget.org/v3/index.json
displayName: Add local NuGet test feed
$configPaths = @('NuGet.config')
if ('${{ parameters.template }}'.EndsWith('-lib')) {
$configPaths += 'example\NuGet.config'
}

$sources = [ordered]@{
TestFeed = '$(System.DefaultWorkingDirectory)\NugetTestFeed'
'react-native' = 'https://pkgs.dev.azure.com/ms/react-native/_packaging/react-native-public/nuget/v3/index.json'
}
Comment on lines +113 to +116

foreach ($configPath in $configPaths) {
[xml] $config = Get-Content -LiteralPath $configPath
$packageSources = $config.configuration.packageSources
if (-not $packageSources) {
# The lib example inherits feeds from the root config.
Write-Host "Skipping $configPath (no packageSources element)"
continue
}
$packageSources.RemoveAll()
[void] $packageSources.AppendChild($config.CreateElement('clear'))
foreach ($source in $sources.GetEnumerator()) {
$element = $config.CreateElement('add')
$element.SetAttribute('key', $source.Key)
$element.SetAttribute('value', $source.Value)
[void] $packageSources.AppendChild($element)
}
$config.Save((Resolve-Path -LiteralPath $configPath))
Write-Host "Updated $configPath"
}
displayName: Add compliant NuGet test feeds
workingDirectory: $(Agent.BuildDirectory)\testcli

- template: ../templates/run-windows-with-certificates.yml
Expand Down
15 changes: 14 additions & 1 deletion .ado/templates/verdaccio-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@ parameters:
- name: beachballPublish
type: boolean
default: true
- name: buildEnvironment
type: string
values:
- PullRequest
- Continuous

steps:
- pwsh: start-process verdaccio.cmd -ArgumentList @('--config', './.ado/verdaccio/config.yaml')
- pwsh: |
$configPath = './.ado/verdaccio/config.yaml'
if ('${{ parameters.buildEnvironment }}' -eq 'PullRequest') {
$configPath = './.ado/verdaccio/config.pr.yaml'
}
if (-not (Test-Path -LiteralPath $configPath)) {
throw "Verdaccio config not found: $configPath"
}
start-process verdaccio.cmd -ArgumentList @('--config', $configPath)
displayName: Launch test npm server (verdaccio)

- script: node .ado/scripts/waitForVerdaccio.js
Expand Down
1 change: 1 addition & 0 deletions .ado/templates/verdaccio-stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ steps:
call yarn config delete npmRegistryServer
call yarn config delete unsafeHttpWhitelist
displayName: Reset npm/yarn config to stop poiting at local verdaccio server
condition: succeededOrFailed()
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
13 changes: 13 additions & 0 deletions .ado/templates/yarn-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,30 @@ steps:
script: |
npm install --global yarn@1.22.22 midgard-yarn@1.23.34 verdaccio@6.7.2
displayName: Install Node base packages
retryCountOnTaskFailure: 2

# When using our own images, prefer the machine-installed version of
# `midgard-yarn`.
- ${{ if eq(parameters.agentImage, 'ManagedImage') }}:
- script: midgard-yarn --ignore-scripts --frozen-lockfile --cwd ${{ parameters.workingDirectory }}
displayName: midgard-yarn (faster yarn install)
retryCountOnTaskFailure: 2
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

- pwsh: .ado/scripts/install-yarn-dependencies.ps1 -Installer Midgard -WorkingDirectory '${{ parameters.workingDirectory }}'
displayName: midgard-yarn (faster yarn install)
retryCountOnTaskFailure: 2
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))

# If using an image we don't control, acquire a fixed version of midgard-yarn
# before install
- ${{ else }}:
- script: npx --yes midgard-yarn@1.23.34 --ignore-scripts --frozen-lockfile --cwd ${{ parameters.workingDirectory }}
displayName: midgard-yarn (faster yarn install)
retryCountOnTaskFailure: 2
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

- pwsh: .ado/scripts/install-yarn-dependencies.ps1 -Installer MidgardNpx -WorkingDirectory '${{ parameters.workingDirectory }}'
displayName: midgard-yarn (faster yarn install)
retryCountOnTaskFailure: 2
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
30 changes: 30 additions & 0 deletions .ado/verdaccio/config.pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# PR network-isolation variant; keep shared settings in sync with config.yaml.
storage: ./storage
auth:
htpasswd:
file: ./htpasswd
uplinks:
npmFeed:
url: https://packagefeedproxy.microsoft.io/npm/
max_fails: 40
maxage: 30m
timeout: 60s
fail_timeout: 10m
cache: false
agent_options:
keepAlive: true
maxSockets: 40
maxFreeSockets: 10
publish:
allow_offline: true
packages:
'@*/*':
access: $all
publish: $all
proxy: npmFeed
'**':
access: $all
publish: $all
proxy: npmFeed
logs:
- {type: file, path: verdaccio.log, format: pretty, level: debug}
1 change: 1 addition & 0 deletions .ado/verdaccio/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Keep shared Verdaccio settings in sync with config.pr.yaml.
storage: ./storage
auth:
htpasswd:
Expand Down
3 changes: 3 additions & 0 deletions .ado/windows-vs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pr:

variables:
- group: platform-override-zero-permission-token
# PR builds use the anonymous package proxy because 1ES network isolation blocks public registries.
- name: NPM_CONFIG_REGISTRY
value: https://packagefeedproxy.microsoft.io/npm/
Comment on lines +20 to +21

extends:
template: build-template.yml@self
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Stabilize HTTP OPTIONS integration testing and network-isolated CLI validation",
"packageName": "react-native-windows",
"email": "anuagra@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,22 @@ describe('FlatList Tests', () => {
await searchBoxBasic('555');
const component = await app.findElementByTestID('flatlist-basic');
await component.waitForDisplayed({timeout: 5000});
const dump = await dumpVisualTree('flatlist-basic');
let dump = await dumpVisualTree('flatlist-basic');
await app.waitUntil(
async () => {
dump = await dumpVisualTree('flatlist-basic');
const automationTree = JSON.stringify(dump['Automation Tree']);
return (
automationTree.includes('Item 555 -') &&
!automationTree.includes('LIST HEADER')
);
},
{
interval: 250,
timeout: 20000,
timeoutMsg: 'Filtered FlatList did not finish rendering.',
},
);
expect(dump).toMatchSnapshot();
});
test('A FlatList has an onStartReached event', async () => {
Expand Down
Loading
Loading