|
| 1 | +name: Test Windows build |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - 'windows/**' |
| 9 | + - '.github/workflows/windows-build-test.yml' |
| 10 | + |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + paths: |
| 15 | + - 'windows/**' |
| 16 | + - '.github/workflows/windows-build-test.yml' |
| 17 | + |
| 18 | + workflow_dispatch: |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + runs-on: windows-2022 |
| 23 | + timeout-minutes: 60 |
| 24 | + concurrency: |
| 25 | + group: windows-${{ github.ref }} |
| 26 | + cancel-in-progress: true |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Create directory for app |
| 33 | + run: | |
| 34 | + mkdir WindowsExample |
| 35 | +
|
| 36 | + - name: Use Node.js 18 |
| 37 | + uses: actions/setup-node@v4 |
| 38 | + with: |
| 39 | + node-version: 18 |
| 40 | + cache: 'yarn' |
| 41 | + cache-dependency-path: | |
| 42 | + yarn.lock |
| 43 | + WindowsExample/yarn.lock |
| 44 | +
|
| 45 | + - name: Setup MSBuild |
| 46 | + uses: microsoft/setup-msbuild@v2 |
| 47 | + |
| 48 | + - name: Install library dependencies |
| 49 | + run: yarn |
| 50 | + |
| 51 | + - name: Prepare library |
| 52 | + run: yarn prepare |
| 53 | + |
| 54 | + - name: Pack library |
| 55 | + run: npm pack |
| 56 | + |
| 57 | + - name: Unpack library files |
| 58 | + run: tar -xzf (Get-ChildItem -Path .\*.tgz) |
| 59 | + |
| 60 | + - name: Create Example app |
| 61 | + run: npx @react-native-community/cli@latest init WindowsExample |
| 62 | + |
| 63 | + - name: Install app dependencies |
| 64 | + working-directory: WindowsExample |
| 65 | + run: | |
| 66 | + New-Item yarn.lock |
| 67 | + yarn add react-native-windows react-native-screens |
| 68 | + |
| 69 | + - name: Init example app |
| 70 | + working-directory: WindowsExample |
| 71 | + run: npx react-native init-windows --overwrite |
| 72 | + |
| 73 | + - name: Replace react-native-screens files |
| 74 | + run: | |
| 75 | + Remove-Item -Path ".\WindowsExample\node_modules\react-native-screens\*" -Recurse -Force |
| 76 | + Copy-Item -Path ".\package\*" -Destination ".\WindowsExample\node_modules\react-native-screens" |
| 77 | +
|
| 78 | + - name: Build app |
| 79 | + working-directory: WindowsExample/windows |
| 80 | + run: npx react-native run-windows --logging --no-packager --no-deploy --no-autolink |
0 commit comments