Skip to content

Commit 59ac7a1

Browse files
committed
chore: add temporarely
1 parent 2c1670b commit 59ac7a1

File tree

4 files changed

+359
-0
lines changed

4 files changed

+359
-0
lines changed

.github/workflows/build-templates.yml

+261
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
name: Build template
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '.github/workflows/build-templates.yml'
9+
- 'packages/create-react-native-library/**'
10+
- '!**.md'
11+
pull_request:
12+
branches:
13+
- main
14+
15+
jobs:
16+
build:
17+
env:
18+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
19+
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os:
25+
- ubuntu
26+
- macos
27+
type:
28+
- module-legacy
29+
- module-mixed
30+
- module-new
31+
- view-legacy
32+
- view-mixed
33+
- view-new
34+
language:
35+
- java-objc
36+
- java-swift
37+
- kotlin-objc
38+
- kotlin-swift
39+
exclude:
40+
- os: macos
41+
language: kotlin-objc
42+
- os: macos
43+
language: kotlin-swift
44+
- type: module-new
45+
language: java-swift
46+
- type: module-new
47+
language: kotlin-swift
48+
- type: module-mixed
49+
language: java-swift
50+
- type: module-mixed
51+
language: kotlin-swift
52+
- type: view-new
53+
language: java-swift
54+
- type: view-new
55+
language: kotlin-swift
56+
- type: view-mixed
57+
language: java-swift
58+
- type: view-mixed
59+
language: kotlin-swift
60+
include:
61+
- os: ubuntu
62+
type: library
63+
language: js
64+
- os: ubuntu
65+
type: module-legacy
66+
language: cpp
67+
- os: ubuntu
68+
type: module-mixed
69+
language: cpp
70+
- os: ubuntu
71+
type: module-new
72+
language: cpp
73+
- os: macos
74+
type: module-legacy
75+
language: cpp
76+
- os: macos
77+
type: module-mixed
78+
language: cpp
79+
- os: macos
80+
type: module-new
81+
language: cpp
82+
83+
concurrency:
84+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.type }}-${{ matrix.language }}
85+
cancel-in-progress: true
86+
87+
runs-on: ${{ matrix.os }}-latest
88+
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v3
92+
93+
- name: Setup
94+
uses: ./.github/actions/setup
95+
96+
- name: Build package
97+
run: |
98+
yarn workspace create-react-native-library prepare
99+
100+
- name: Get working directory
101+
run: |
102+
echo "work_dir=${{ matrix.os }}-${{ matrix.type }}-${{ matrix.language }}" >> $GITHUB_ENV
103+
104+
- name: Create library
105+
run: |
106+
rm -rf ${{ env.work_dir }} # Workaround for tests failing intermittently
107+
./packages/create-react-native-library/bin/create-react-native-library ${{ env.work_dir }} \
108+
--slug @bob/react-native-test \
109+
--description test \
110+
--author-name test \
111+
--author-email test@test \
112+
--author-url https://test.test \
113+
--repo-url https://test.test \
114+
--type ${{ matrix.type }} \
115+
--languages ${{ matrix.language }} \
116+
--no-local
117+
118+
- name: Cache dependencies of library
119+
id: library-yarn-cache
120+
uses: actions/cache@v3
121+
with:
122+
path: |
123+
${{ env.work_dir }}/**/node_modules
124+
${{ env.work_dir }}/**/yarn.lock
125+
key: ${{ runner.os }}-library-yarn-${{ hashFiles(format('{0}/**/package.json', env.work_dir)) }}
126+
restore-keys: |
127+
${{ runner.os }}-library-yarn-
128+
129+
- name: Install dependencies of library
130+
if: steps.library-yarn-cache.outputs.cache-hit != 'true'
131+
working-directory: ${{ env.work_dir }}
132+
run: |
133+
touch yarn.lock # Without this Yarn will fail due to the parent directory being a Yarn workspace
134+
rm -f example/yarn.lock # Workaround for cached yarn.lock from older version
135+
yarn install --no-immutable
136+
env:
137+
POD_INSTALL: 0
138+
139+
- name: Get build target
140+
working-directory: ${{ env.work_dir }}
141+
run: |
142+
# Build Android for only some matrices to skip redundant builds
143+
if [[ ${{ matrix.os }} == ubuntu ]]; then
144+
if [[ ${{ matrix.type }} == view-* && ${{ matrix.language }} == *-objc ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == *-objc ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == cpp ]]; then
145+
echo "android_build=1" >> $GITHUB_ENV
146+
fi
147+
fi
148+
149+
# Build iOS for only some matrices to skip redundant builds
150+
if [[ ${{ matrix.os }} == macos ]]; then
151+
if [[ ${{ matrix.type }} == view-* && ${{ matrix.language }} == java-* ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == java-* ]] || [[ ${{ matrix.type }} == module-* && ${{ matrix.language }} == cpp ]]; then
152+
echo "ios_build=1" >> $GITHUB_ENV
153+
fi
154+
fi
155+
156+
- name: Cache turborepo
157+
if: env.android_build == 1 || env.ios_build == 1
158+
uses: actions/cache@v3
159+
with:
160+
path: |
161+
${{ env.work_dir }}/.turbo
162+
key: ${{ runner.os }}-library-turborepo-${{ matrix.type }}-${{ matrix.language }}-${{ hashFiles(format('{0}/**/yarn.lock', env.work_dir)) }}
163+
restore-keys: |
164+
${{ runner.os }}-library-turborepo-${{ matrix.type }}-${{ matrix.language }}-
165+
166+
- name: Check turborepo cache
167+
if: env.android_build == 1 || env.ios_build == 1
168+
working-directory: ${{ env.work_dir }}
169+
run: |
170+
TURBO_CACHE_STATUS_ANDROID=$(node -p "($(yarn turbo run build:android --cache-dir=".turbo" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
171+
TURBO_CACHE_STATUS_IOS=$(node -p "($(yarn turbo run build:ios --cache-dir=".turbo" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
172+
173+
if [[ $TURBO_CACHE_STATUS_ANDROID == "HIT" ]]; then
174+
echo "turbo_cache_hit_android=1" >> $GITHUB_ENV
175+
fi
176+
177+
if [[ $TURBO_CACHE_STATUS_IOS == "HIT" ]]; then
178+
echo "turbo_cache_hit_ios=1" >> $GITHUB_ENV
179+
fi
180+
181+
- name: Lint library
182+
working-directory: ${{ env.work_dir }}
183+
run: |
184+
yarn lint
185+
186+
- name: Typecheck library
187+
working-directory: ${{ env.work_dir }}
188+
run: |
189+
yarn typecheck
190+
191+
- name: Test library
192+
working-directory: ${{ env.work_dir }}
193+
run: |
194+
yarn test
195+
196+
- name: Build library
197+
working-directory: ${{ env.work_dir }}
198+
run: |
199+
yarn prepare
200+
201+
- name: Build example (Web)
202+
working-directory: ${{ env.work_dir }}
203+
if: matrix.language == 'js'
204+
run: |
205+
yarn example expo export:web
206+
207+
- name: Install JDK
208+
if: env.android_build == 1 && env.turbo_cache_hit_android != 1
209+
uses: actions/setup-java@v3
210+
with:
211+
distribution: 'zulu'
212+
java-version: '11'
213+
214+
- name: Finalize Android SDK
215+
if: env.android_build == 1 && env.turbo_cache_hit_android != 1
216+
run: |
217+
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
218+
219+
- name: Cache Gradle
220+
if: env.android_build == 1 && env.turbo_cache_hit_android != 1
221+
uses: actions/cache@v3
222+
with:
223+
path: |
224+
~/.gradle/wrapper
225+
~/.gradle/caches
226+
key: ${{ runner.os }}-gradle-${{ hashFiles(format('{0}/example/android/gradle/wrapper/gradle-wrapper.properties', env.work_dir)) }}
227+
restore-keys: |
228+
${{ runner.os }}-gradle-
229+
230+
- name: Build example (Android)
231+
if: env.android_build == 1
232+
working-directory: ${{ env.work_dir }}
233+
run: |
234+
yarn turbo run build:android --cache-dir=".turbo"
235+
236+
- name: Cache cocoapods
237+
if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1
238+
id: library-cocoapods-cache
239+
uses: actions/cache@v3
240+
with:
241+
path: |
242+
${{ env.work_dir }}/**/ios/Pods
243+
${{ env.work_dir }}/**/ios/Podfile.lock
244+
key: ${{ runner.os }}-library-cocoapods-${{ hashFiles(format('{0}/example/ios/Podfile', env.work_dir)) }}-${{ hashFiles(format('{0}/**/yarn.lock', env.work_dir)) }}
245+
restore-keys: |
246+
${{ runner.os }}-library-cocoapods-${{ hashFiles(format('{0}/example/ios/Podfile', env.work_dir)) }}-
247+
${{ runner.os }}-library-cocoapods-
248+
249+
- name: Install cocoapods
250+
if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1 && steps.library-cocoapods-cache.outputs.cache-hit != 'true'
251+
working-directory: ${{ env.work_dir }}
252+
run: |
253+
yarn pod-install example/ios
254+
env:
255+
NO_FLIPPER: 1
256+
257+
- name: Build example (iOS)
258+
if: env.ios_build == 1
259+
working-directory: ${{ env.work_dir }}
260+
run: |
261+
yarn turbo run build:ios --cache-dir=".turbo"

.github/workflows/check-project.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Check project
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
check-project:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Setup
18+
uses: ./.github/actions/setup
19+
20+
- name: Lint
21+
run: yarn lint
22+
23+
- name: Typecheck
24+
run: yarn typecheck
25+
26+
- name: Build packages
27+
run: yarn lerna run prepare

.github/workflows/deploy-docs.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy docs
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '.github/workflows/deploy-docs.yml'
9+
- 'docs/**'
10+
11+
jobs:
12+
deploy-docs:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Setup
19+
uses: ./.github/actions/setup
20+
21+
- name: Cache build
22+
uses: actions/cache@v3
23+
with:
24+
path: |
25+
docs/.next/cache
26+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}
29+
${{ runner.os }}-nextjs-
30+
31+
- name: Build docs
32+
run: |
33+
yarn docs build
34+
touch docs/out/.nojekyll
35+
36+
- name: Deploy to GitHub Pages
37+
uses: JamesIves/github-pages-deploy-action@v4
38+
with:
39+
branch: gh-pages
40+
folder: docs/out
41+
42+
permissions:
43+
contents: write

.github/workflows/rebase.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Automatic Rebase
2+
on:
3+
issue_comment:
4+
types: [created]
5+
6+
jobs:
7+
rebase:
8+
name: Rebase
9+
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Automatic Rebase
18+
uses: cirrus-actions/[email protected]
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
# https://github.community/t5/GitHub-Actions/Workflow-is-failing-if-no-job-can-be-ran-due-to-condition/m-p/38186#M3250
23+
always_job:
24+
name: Always run job
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Always run
28+
run: echo "This job is used to prevent the workflow to fail when all other jobs are skipped."

0 commit comments

Comments
 (0)