Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ebb0e45
Initial commit of Cxx API snapshots
Mar 31, 2026
838168d
Add CI workflow for validating C++ API snapshot (#56042)
Mar 31, 2026
52e9885
Remove test code from the cxx-api snapshot
Mar 31, 2026
899ef12
Add global exclude patterns to the cxx api config
Mar 31, 2026
426c3f9
Remove fantom test specific methods from the C++ API snapshot
Mar 31, 2026
710d661
Exclude stubs from the C++ public API snapshot
Mar 31, 2026
03c51aa
Add `--xml` flag to persist xml artifacts for testing purposes
Mar 31, 2026
6a9b9ab
Fix Doxygen merging base classes from primary templates into speciali…
Mar 31, 2026
d1e6e84
Fix return type for Bridging::fromJs
Mar 31, 2026
f32cc1b
Add `exclude_symbols` to the cxx-api parser config
Mar 31, 2026
90607d1
Exclude Fantom symbols from the C++ public API snapshot
Mar 31, 2026
c7e7900
Exclude Android specific symbols from the ReactApple snapshot
Mar 31, 2026
464fa08
Remove feature flags from the C++ public API snapshots
Mar 31, 2026
b1be3f6
Exclude UnstabeLegacy symbols from stable C++ API snapshot
Mar 31, 2026
d856973
Exclude experimental symbols from the C++ public API snapshot
Mar 31, 2026
a155812
Exclude Apple Switch component from the ReactAndroid C++ API snapshot
Mar 31, 2026
2da40c0
Exclude InputAccessory component from the ReactAndroid C++ API snapshot
Mar 31, 2026
4474dca
Exclude iOS-specific symbols from the ReactAndroid C++ API snapshot
Mar 31, 2026
8f069df
Rename `--check` flag to `--validate` in C++ public API parser (#56253)
coado Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/validate-cxx-api-snapshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Validate C++ API Snapshots

on:
workflow_dispatch:
pull_request:
paths:
- "packages/react-native/ReactCommon/**"
- "packages/react-native/ReactAndroid/**"
- "packages/react-native/React/**"
- "packages/react-native/ReactApple/**"
- "packages/react-native/Libraries/**"
- "scripts/cxx-api/**"
push:
branches:
- main
- "*-stable"
paths:
- "packages/react-native/ReactCommon/**"
- "packages/react-native/ReactAndroid/**"
- "packages/react-native/React/**"
- "packages/react-native/ReactApple/**"
- "packages/react-native/Libraries/**"
- "scripts/cxx-api/**"

env:
DOXYGEN_VERSION: "1.16.1"

jobs:
validate_cxx_api_snapshots:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Run yarn
uses: ./.github/actions/yarn-install
- name: Restore Doxygen cache
id: cache-doxygen
uses: actions/cache@v4
with:
path: /tmp/doxygen-${{ env.DOXYGEN_VERSION }}
key: doxygen-${{ env.DOXYGEN_VERSION }}
- name: Install Doxygen
if: steps.cache-doxygen.outputs.cache-hit != 'true'
shell: bash
run: |
DOXYGEN_URL="https://github.com/doxygen/doxygen/releases/download/Release_${DOXYGEN_VERSION//./_}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz"
MAX_RETRIES=3
for i in $(seq 1 $MAX_RETRIES); do
echo "Attempt $i of $MAX_RETRIES: Installing Doxygen ${DOXYGEN_VERSION}..."
curl -fsSL "$DOXYGEN_URL" -o /tmp/doxygen.tar.gz && \
tar -xzf /tmp/doxygen.tar.gz -C /tmp && \
echo "Doxygen installed successfully." && \
break
echo "Attempt $i failed."
if [ $i -eq $MAX_RETRIES ]; then
echo "All $MAX_RETRIES attempts failed."
exit 1
fi
sleep 5
done
- name: Set DOXYGEN_BIN
shell: bash
run: echo "DOXYGEN_BIN=/tmp/doxygen-${DOXYGEN_VERSION}/bin/doxygen" >> "$GITHUB_ENV"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
shell: bash
run: pip install doxmlparser natsort pyyaml
- name: Validate C++ API snapshots
shell: bash
continue-on-error: true
run: yarn cxx-api-validate --output-dir /tmp/cxx-api-snapshots
- name: Upload C++ API snapshots
uses: actions/upload-artifact@v6
with:
name: cxx-api-snapshots
path: /tmp/cxx-api-snapshots/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
"clean": "node ./scripts/build/clean.js",
"cxx-api-build": "python -m scripts.cxx-api.parser",
"cxx-api-validate": "python -m scripts.cxx-api.parser --check",
"cxx-api-validate": "python -m scripts.cxx-api.parser --validate",
"flow-check": "flow check",
"flow": "flow",
"format-check": "prettier --list-different \"./**/*.{js,md,yml,ts,tsx}\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/ReactCommon/react/bridging/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct Bridging<std::array<T, N>> : array_detail::BridgingStatic<std::array<T, N

template <typename T1, typename T2>
struct Bridging<std::pair<T1, T2>> : array_detail::BridgingStatic<std::pair<T1, T2>, 2> {
static std::pair<T1, T1>
static std::pair<T1, T2>
fromJs(facebook::jsi::Runtime &rt, const jsi::Array &array, const std::shared_ptr<CallInvoker> &jsInvoker)
{
return std::make_pair(
Expand Down
6 changes: 3 additions & 3 deletions scripts/cxx-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ Maintainers should run this command whenever making intentional C++ API changes:
python -m scripts.cxx-api.parser
```

#### Check snapshots against committed baseline
#### Validate snapshots against committed baseline

This mode generates snapshots to a temporary directory and compares them against the committed `.api` files. It is designed for CI:

```sh
python -m scripts.cxx-api.parser --check
python -m scripts.cxx-api.parser --validate
```

If any snapshot differs, a unified diff is printed and the process exits with a non-zero status. To fix a failing check, regenerate the snapshots with `python -m scripts.cxx-api.parser` and commit the updated `.api` files.
If any snapshot differs, a unified diff is printed and the process exits with a non-zero status. To fix a failing validation, regenerate the snapshots with `python -m scripts.cxx-api.parser` and commit the updated `.api` files.

## How it works

Expand Down
Loading
Loading