Repository navigation
118 lines (114 loc) · 4.67 KB
/
Copy pathwindows.yml
File metadata and controls
118 lines (114 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Windows
# The Windows jobs are slow (the app build takes about 15 minutes), they only run when something
# that affects Windows changes. Run them by hand from the Actions tab before a release.
on:
push:
branches: [master]
paths:
- 'windows/**'
- 'test/windows/**'
- 'src/**'
- 'index.d.ts'
- 'package.json'
- 'yarn.lock'
- '.github/workflows/windows.yml'
pull_request:
paths:
- 'windows/**'
- 'test/windows/**'
- 'src/**'
- 'index.d.ts'
- 'package.json'
- 'yarn.lock'
- '.github/workflows/windows.yml'
workflow_dispatch:
concurrency:
group: windows-${{ github.ref }}
cancel-in-progress: true
jobs:
windows-native:
name: Windows implementation (harness)
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install a second mDNS stack for the harness
run: pip install zeroconf
- name: Build and run
shell: cmd
env:
RNZEROCONF_DEBUG: '1'
RNZEROCONF_PEER: '1'
run: |
start "" /b python test\windows\peer.py
test\windows\run.cmd
windows:
name: Windows build
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: yarn
- uses: microsoft/setup-msbuild@v3
# react-native-windows targets the Windows 11 SDK 10.0.22621, not installed on every runner image.
# Installing the needed features from Microsoft's SDK ISO is faster than the Visual Studio installer.
- name: Install the Windows SDK 10.0.22621
shell: pwsh
run: |
$sdks = "${env:ProgramFiles(x86)}\Windows Kits\10\Include"
if (Test-Path "$sdks\10.0.22621.0") { Write-Host "Already installed"; exit 0 }
$iso = Join-Path $env:RUNNER_TEMP "winsdk-22621.iso"
curl.exe -sSL -o $iso "https://go.microsoft.com/fwlink/?linkid=2312900"
$drive = (Mount-DiskImage -ImagePath $iso -PassThru | Get-Volume).DriveLetter
$features = 'OptionId.SigningTools OptionId.UWPManaged OptionId.UWPCPP OptionId.UWPLocalized OptionId.DesktopCPPx86 OptionId.DesktopCPPx64 OptionId.DesktopCPParm64'
$log = Join-Path $env:RUNNER_TEMP "winsdk.log"
$process = Start-Process -FilePath "${drive}:\WinSDKSetup.exe" -ArgumentList "/features $features /q /norestart /l `"$log`"" -Wait -PassThru
Write-Host "WinSDKSetup exit code: $($process.ExitCode)"
Get-ChildItem $sdks | Select-Object -ExpandProperty Name
if (-not (Test-Path "$sdks\10.0.22621.0")) { Get-Content $log -Tail 40; exit 1 }
# NuGet packages of react-native-windows don't change for a given version
- uses: actions/cache@v6
with:
path: ~/.nuget/packages
key: windows-nuget-rnw-0.84
# The test app is created fresh, its npm downloads come from this cache, updated on each run
- uses: actions/cache@v6
with:
path: ~/AppData/Local/npm-cache
key: windows-npm-rnw-0.84-${{ github.run_id }}
restore-keys: windows-npm-rnw-0.84-
- name: Pack the library
run: |
yarn install --frozen-lockfile
yarn build
npm pack --pack-destination "$RUNNER_TEMP"
- name: Create a React Native Windows app with the library
working-directory: ${{ runner.temp }}
run: |
npx --yes @react-native-community/cli@20 init ZeroconfWindows --version 0.84.1 --skip-install --skip-git-init --pm npm
cd ZeroconfWindows
npm install
npm install react-native-windows@^0.84.0
npx @react-native-community/cli init-windows --template cpp-app --overwrite --logging
npm install "$RUNNER_TEMP"/react-native-zeroconf-*.tgz
cp "$GITHUB_WORKSPACE/test/windows/App.tsx" App.tsx
- uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install a second mDNS stack for the self-test
run: pip install zeroconf
# Builds, installs and launches the app, which runs test/windows/App.tsx against the peer
# and reports through a _zcresult._tcp service that check-app.py waits for
- name: Build, run the self-test app and check its result
working-directory: ${{ runner.temp }}/ZeroconfWindows
run: |
python "$GITHUB_WORKSPACE/test/windows/peer.py" &
npx @react-native-community/cli run-windows --release --no-packager --arch x64 --logging
python "$GITHUB_WORKSPACE/test/windows/check-app.py"