Repository navigation
116 lines (110 loc) · 3.71 KB
/
Copy pathci.yml
File metadata and controls
116 lines (110 loc) · 3.71 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
name: CI
on:
push:
branches: [master]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
js:
name: Lint, tests and types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 20
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn lint
- run: yarn test
- run: yarn typecheck
- run: yarn build
- name: Check the published files
run: |
npm pack --dry-run 2>&1 | tee pack.txt
grep -q "dist/index.js" pack.txt
grep -q "index.d.ts" pack.txt
if grep -qE "docs/|website/|test/|mDNSWindows" pack.txt; then
echo "Unexpected files in the package"
exit 1
fi
ios-native:
name: iOS implementation (macOS harness)
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- run: test/ios/run.sh
android:
name: Android build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 20
cache: yarn
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- name: Pack the library
run: |
yarn install --frozen-lockfile
yarn build
npm pack --pack-destination "$RUNNER_TEMP"
- name: Install the example with the packed library
working-directory: example
run: |
npm ci
rm -rf node_modules/react-native-zeroconf
mkdir -p node_modules/react-native-zeroconf
tar -xzf "$RUNNER_TEMP"/react-native-zeroconf-*.tgz -C node_modules/react-native-zeroconf --strip-components=1
- name: Type check the example
working-directory: example
run: npm run typecheck
- name: Build
working-directory: example
run: |
npx expo prebuild --platform android --no-install
mkdir -p ~/.gradle
echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g" >> ~/.gradle/gradle.properties
cd android && ./gradlew :app:assembleDebug --build-cache -PreactNativeArchitectures=x86_64
ios:
name: iOS build
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 20
- name: Pack the library
run: |
yarn install --frozen-lockfile
yarn build
npm pack --pack-destination "$RUNNER_TEMP"
- name: Install the example with the packed library
working-directory: example
run: |
npm ci
rm -rf node_modules/react-native-zeroconf
mkdir -p node_modules/react-native-zeroconf
tar -xzf "$RUNNER_TEMP"/react-native-zeroconf-*.tgz -C node_modules/react-native-zeroconf --strip-components=1
- uses: actions/cache@v6
with:
path: ~/Library/Caches/CocoaPods
key: cocoapods-${{ hashFiles('example/package-lock.json') }}
restore-keys: cocoapods-
- name: Prebuild (installs pods)
working-directory: example
run: npx expo prebuild --platform ios
- name: Build
working-directory: example/ios
run: |
set -o pipefail
xcodebuild -workspace ZeroconfBrowser.xcworkspace -scheme ZeroconfBrowser \
-configuration Debug -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' \
CODE_SIGNING_ALLOWED=NO build > "$RUNNER_TEMP/xcodebuild.log" || { tail -50 "$RUNNER_TEMP/xcodebuild.log"; exit 1; }
tail -5 "$RUNNER_TEMP/xcodebuild.log"