forked from mldb/react-native-bundle-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (130 loc) · 4.67 KB
/
Copy pathci.yml
File metadata and controls
156 lines (130 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
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
name: CI
on:
pull_request:
push:
branches: [main, master]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
js:
name: Lint, typecheck, test, pack
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20.x
cache: yarn
- name: Install (frozen lockfile, no scripts)
run: yarn install --frozen-lockfile --ignore-scripts
- name: Lint
run: yarn lint
- name: Typecheck
run: yarn typescript
- name: Test
run: yarn test --ci --runInBand
- name: Build (bob)
run: yarn prepare
- name: Pack tarball
run: |
mkdir -p _pack
npm pack --pack-destination _pack
tar -tzf _pack/*.tgz | LC_ALL=C sort | sed 's|^package/||' > _pack/files.txt
echo "::group::Tarball contents"
cat _pack/files.txt
echo "::endgroup::"
- name: Deny-list scan
run: |
DENY='\.map$|\.snap$|\.tgz$|\.iml$|\.DS_Store$|/xcuserdata/|/\.project$|/\.settings/|/\.idea/|/\.vscode/|/__tests__/|/__snapshots__/|/__fixtures__/|/__mocks__/|/test/|/androidTest/|/BundleLoaderTests/|\.test\.|\.spec\.|^\.github/|^\.circleci/|^\.npmrc$|^\.yarnrc$|^\.editorconfig$|^\.gitattributes$|^\.gitignore$|^\.eslintignore$|^\.eslintrc|^\.prettierrc|^tsconfig|^babel\.config|^jest\.config|^yarn\.lock$|^package-lock\.json$|/coverage/|/node_modules/|^android/gradlew|^android/gradle/'
if grep -E "$DENY" _pack/files.txt; then
echo "::error::Disallowed file pattern matched in npm tarball" >&2
exit 1
fi
echo "Deny-list scan: clean"
- name: Allowlist exact-match check
run: |
if ! diff -u .npm-tarball-allowlist _pack/files.txt; then
echo "::error::Tarball file list does not match .npm-tarball-allowlist" >&2
echo "If the change is intentional, update .npm-tarball-allowlist to match." >&2
exit 1
fi
echo "Allowlist exact-match: $(wc -l < .npm-tarball-allowlist) files"
android:
name: Android JVM unit tests
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20.x
cache: yarn
- name: Setup Java
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
java-version: '11'
distribution: temurin
- name: Install (frozen lockfile, no scripts)
run: yarn install --frozen-lockfile --ignore-scripts
- name: Run gradle tests
working-directory: android
run: ./gradlew test --console=plain --no-daemon
ios:
name: iOS XCTest
runs-on: macos-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20.x
cache: yarn
- name: Install (frozen lockfile, no scripts)
run: yarn install --frozen-lockfile --ignore-scripts
- name: Pick iOS Simulator
id: sim
run: |
UDID=$(xcrun simctl list devices available --json | jq -r '
.devices
| to_entries[]
| select(.key | contains("iOS"))
| .value[]
| select(.name | startswith("iPhone"))
| .udid' | head -1)
if [ -z "$UDID" ]; then
echo "::error::No iPhone simulator available" >&2
xcrun simctl list devices available
exit 1
fi
echo "udid=$UDID" >> "$GITHUB_OUTPUT"
echo "Picked iOS Simulator UDID: $UDID"
- name: Run XCTest
working-directory: ios
run: |
set -o pipefail
xcodebuild test \
-project BundleLoader.xcodeproj \
-scheme BundleLoaderTests \
-destination "platform=iOS Simulator,id=${{ steps.sim.outputs.udid }}"