Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
62 changes: 62 additions & 0 deletions .github/workflows/validate-cxx-stable-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Validate C++ Stable API

on:
pull_request:
# pull_request_target:
# types: [opened, edited, reopened, synchronize]

env:
DOXYGEN_VERSION: '1.16.1'

jobs:
validate_cxx_stable_api:
runs-on: ubuntu-latest
if: github.repository == 'facebook/react-native'
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Install Doxygen
run: |
for i in 1 2 3; do
wget -q https://www.doxygen.nl/files/doxygen-${{ env.DOXYGEN_VERSION }}.linux.bin.tar.gz && break
echo "Download attempt $i failed, retrying in 10s..."
sleep 10
done
tar -xzf doxygen-${{ env.DOXYGEN_VERSION }}.linux.bin.tar.gz
echo "${{ github.workspace }}/doxygen-${{ env.DOXYGEN_VERSION }}/bin" >> $GITHUB_PATH

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Python dependencies
run: pip install doxmlparser natsort pyyaml

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.14.0

- name: Install Node dependencies
run: yarn install

- name: Verify C++ Stable API snapshots
id: verify
continue-on-error: true
env:
DOXYGEN_BIN: ${{ github.workspace }}/doxygen-${{ env.DOXYGEN_VERSION }}/bin/doxygen
working-directory: scripts/cxx-api
run: python -m parser --check --output-dir ${{ runner.temp }}/generated-api-snapshots

- name: Upload generated snapshots
if: always() && steps.verify.outcome != 'skipped'
uses: actions/upload-artifact@v4
with:
name: generated-cxx-api-snapshots
path: ${{ runner.temp }}/generated-api-snapshots/

- name: Fail if snapshots are out of date
if: steps.verify.outcome == 'failure'
run: exit 1
4 changes: 2 additions & 2 deletions scripts/cxx-api/parser/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ def main():
)

with tempfile.TemporaryDirectory() as tmpdir:
snapshot_output_dir = (
tmpdir if args.check else args.output_dir or get_default_snapshot_dir()
snapshot_output_dir = args.output_dir or (
tmpdir if args.check else get_default_snapshot_dir()
)

build_snapshots(
Expand Down
Loading