Repository navigation
151 lines (132 loc) Β· 5.49 KB
/
Copy pathtest.yml
File metadata and controls
151 lines (132 loc) Β· 5.49 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
name: test
on:
pull_request:
branches:
- master
push:
branches:
- master
# Cancel a currently running workflow from the same PR/branch/tag
# when a new workflow is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# The native jobs below only run when their inputs change. A job skipped by
# its `if:` still reports success, so required checks and native-gate (which
# looks at the workflow conclusion) are satisfied on unrelated changes.
changes:
name: Detect changed native inputs
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
outputs:
cpp: ${{ steps.filter.outputs.cpp }}
ios: ${{ steps.filter.outputs.ios }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- id: filter
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
with:
filters: |
cpp:
- '.github/workflows/test.yml'
- '.gitmodules'
- 'cpp/**'
- 'android/jni/**'
# The release flag sets test-core-platform-flags.sh mirrors.
- 'react-native-update.podspec'
- 'harmony/pushy/src/main/cpp/CMakeLists.txt'
- 'scripts/test-*'
- 'scripts/lib/**'
# package.json `files` lists the submodule sources that ship.
- 'package.json'
- 'scripts/check-packlist.js'
# TS reference the C++ golden vectors are generated from.
- 'src/updateFlowCore.ts'
- 'scripts/generate-flow-vectors.ts'
ios:
- '.github/workflows/test.yml'
- 'ios/**'
- 'cpp/**'
- 'scripts/test-ios-purge-restore.sh'
- 'scripts/tests/ios-purge-restore/**'
js-test:
name: JS Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.0
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Run Tests
run: bun test src/__tests__
cpp-test:
name: C++ Unit Tests
needs: changes
if: needs.changes.outputs.cpp == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
# Before anything builds inside the submodules: the published package
# lists the HDiffPatch / lzma sources and headers one by one, so a
# header missing from package.json `files` would only surface in a
# consumer's pod install. Packs the real tarball and compiles from it.
- name: Packed native sources compile on their own
run: node scripts/check-packlist.js --compile
- name: Install build dependencies
# clang (+ libFuzzer runtime) is for the bounded fuzz step below.
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev libbz2-dev clang
- name: Build HDiffPatch library
working-directory: android/jni/HDiffPatch
run: make LZMA=0 DIR_DIFF=0
- name: Build and run unit_test
working-directory: android/jni/HDiffPatch
run: |
g++ -O2 test/unit_test.cpp libhdiffpatch.a \
-D_IS_NEED_ALL_CompressPlugin=0 \
-D_IS_NEED_DEFAULT_CompressPlugin=0 \
-D_IS_NEED_DIR_DIFF_PATCH=0 \
-lpthread \
-o unit_test
./unit_test
# Golden-vector parity between src/updateFlowCore.ts (reference) and
# the cpp/update_flow_core port. The vectors themselves are kept in
# sync with the TS side by src/__tests__/flowVectors.test.ts (js-test).
- name: Replay flow golden vectors against the C++ port
run: SANITIZE=1 ./scripts/test-update-flow-core.sh
# patch_core consumes the untrusted bytes (archives, manifests, HBC
# patches); it must run under ASan/UBSan on every change.
- name: Run patch_core unit tests (sanitized)
run: SANITIZE=1 ./scripts/test-patch-core.sh
# The tests above build the cores one way; the shipped binaries build
# them with three other flag sets (no RTTI on Android, C++20 on iOS).
- name: Shared cores compile with every platform's release flags
run: ./scripts/test-core-platform-flags.sh
# Short bounded fuzz pass over the two untrusted-input parsers
# (flow_json, hbc_transform_wire). Skips with a notice when clang or
# libFuzzer is unavailable on the runner.
- name: Fuzz parsers (bounded)
run: |
FUZZ=1 ./scripts/test-update-flow-core.sh
FUZZ=1 ./scripts/test-patch-core.sh
ios-purge-restore-test:
name: Native purge-restore ordering
needs: changes
if: needs.changes.outputs.ios == 'true'
runs-on: macos-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# Foundation-only executable: exercises the production tvOS Release
# methods without RN, CocoaPods, a simulator, or real network delays.
- name: Run deterministic native ordering tests and negative controls
run: SANITIZE=1 VERIFY_REGRESSIONS=1 bash scripts/test-ios-purge-restore.sh