-
Notifications
You must be signed in to change notification settings - Fork 99
174 lines (174 loc) · 5.29 KB
/
pr.yml
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: CI
on: pull_request
concurrency:
# Ensure single build of a pull request
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
review:
name: "Review"
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup the toolchain
uses: ./.github/actions/setup-toolchain
- name: Ensure rnx-kit packages come from our repository
run: |
if grep 'rnx-kit.*@npm' yarn.lock; then
exit 1
fi
- name: Deduplicate packages
run: |
yarn dedupe --check
- name: Install package dependencies
run: |
yarn
- name: Check for change files
run: |
yarn change:check --since origin/${{ github.base_ref }}
- name: Report formatting problems
run: |
yarn format
git diff --exit-code
- name: Report dependency problems
run: |
yarn rnx-align-deps --write
git diff --exit-code
- name: Report package metadata inconsistencies
run: |
node scripts/lint-metadata.mjs
git diff --exit-code
- name: Report @rnx-kit/build workflow inconsistencies
run: |
cp incubator/build/workflows/github.yml .github/workflows/rnx-build.yml
git diff --exit-code
build:
name: "Build"
strategy:
matrix:
node-version: [16, 18, 20]
os: [ubuntu-22.04, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup the toolchain
uses: ./.github/actions/setup-toolchain
with:
node-version: ${{ matrix.node-version }}
- name: Install package dependencies
run: |
yarn
- name: Build and test packages
run: |
yarn build:ci --base origin/${{ github.base_ref }}
- name: Ensure READMEs are up-to-date
if: ${{ matrix.node-version == 18 && matrix.os == 'ubuntu-22.04' }}
run: |
yarn update-readme
git diff --exit-code
- name: Bundle packages
run: |
yarn bundle:ci --base origin/${{ github.base_ref }}
- name: Bundle test app with esbuild
run: |
yarn nx affected --base origin/${{ github.base_ref }} --target bundle+esbuild
shell: bash
- name: Bundle test app with RAM bundle format
run: |
yarn nx affected --base origin/${{ github.base_ref }} --target ram-bundle
shell: bash
build-android-test-app:
name: "Build Android"
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup the toolchain
uses: ./.github/actions/setup-toolchain
with:
jdk-version: 11
- name: Install package dependencies
run: |
yarn
- name: Determine whether the Android app needs to be built
id: affected-projects
run: |
if [[ "$(yarn show-affected --base origin/${{ github.base_ref }})" = *"@rnx-kit/test-app"* ]]; then
echo 'android=true' >> $GITHUB_OUTPUT
fi
- name: Build Android app
if: ${{ steps.affected-projects.outputs.android != '' }}
run: |
yarn build:android
working-directory: packages/test-app
build-ios-test-app:
name: "Build iOS"
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup the toolchain
uses: ./.github/actions/setup-toolchain
with:
platform: ios
- name: Install package dependencies
run: |
yarn
- name: Determine whether the iOS app needs to be built
id: affected-projects
run: |
if [[ "$(yarn show-affected --base origin/${{ github.base_ref }})" = *"@rnx-kit/test-app"* ]]; then
echo 'ios=true' >> $GITHUB_OUTPUT
fi
- name: Install Pods
uses: microsoft/react-native-test-app/.github/actions/cocoapods@trunk
if: ${{ steps.affected-projects.outputs.ios != '' }}
with:
project-directory: ios
working-directory: packages/test-app
- name: Build iOS app
if: ${{ steps.affected-projects.outputs.ios != '' }}
run: |
yarn build:ios
working-directory: packages/test-app
build-website:
name: "Build the website"
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup the toolchain
uses: ./.github/actions/setup-toolchain
with:
node-cache: ""
- name: Install package dependencies (docsite)
run: |
yarn
working-directory: docsite
- name: Build website
run: |
yarn build
working-directory: docsite
label:
name: "Label"
permissions:
contents: read
pull-requests: write
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
continue-on-error: true