Skip to content

Reanimated + Worklets compatibility check #85

Reanimated + Worklets compatibility check

Reanimated + Worklets compatibility check #85

name: Reanimated + Worklets compatibility check
on:
push:
branches:
- main
paths:
- '.github/workflows/reanimated-worklets-compatibility-check.yml'
- '.github/workflows/helper/read-reanimated-worklets-compatibility.ts'
- '.github/workflows/helper/npm-versions.ts'
- '.github/actions/create-rnc-cli-app/**'
pull_request:
paths:
- '.github/workflows/reanimated-worklets-compatibility-check.yml'
- '.github/workflows/helper/read-reanimated-worklets-compatibility.ts'
- '.github/workflows/helper/npm-versions.ts'
- '.github/actions/create-rnc-cli-app/**'
workflow_dispatch:
schedule:
- cron: '30 2 * * *'
permissions:
contents: read
jobs:
read-compatibility-json:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-outputs.outputs.matrix }}
matrix-size: ${{ steps.set-outputs.outputs.matrix-size }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
sparse-checkout: |
/.nvmrc
/.github/workflows/helper
/packages/react-native-reanimated/compatibility.json
/packages/react-native-worklets/compatibility.json
sparse-checkout-cone-mode: false
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: '.nvmrc'
- name: Read and resolve compatibility matrix
run: node --experimental-strip-types .github/workflows/helper/read-reanimated-worklets-compatibility.ts
- name: Set outputs
id: set-outputs
run: |
echo "matrix=$(cat /tmp/reanimated-worklets-matrix.json)" >> "$GITHUB_OUTPUT"
echo "matrix-size=$(jq 'length' /tmp/reanimated-worklets-matrix.json)" >> "$GITHUB_OUTPUT"
reanimated-worklets-compatibility-check-android:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: ubuntu-latest
needs: read-compatibility-json
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.read-compatibility-json.outputs.matrix) }}
env:
APP_NAME: app
CACHE_KEY: ${{ matrix.reactNativeVersion }}-${{ matrix.reanimatedVersion }}-${{ matrix.workletsVersion }}
BUILD_MARKER_DIR: .compatibility-build-markers
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: '.nvmrc'
- name: Set up JDK 18
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9
with:
distribution: 'zulu'
java-version: '18'
- name: Restore result cache
id: result-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: ${{ env.BUILD_MARKER_DIR }}/${{ env.CACHE_KEY }}.success
key: reanimated-worklets-compat-android-${{ env.CACHE_KEY }}
- name: Skip already validated combination
if: steps.result-cache.outputs.cache-hit == 'true'
run: |
echo "Skipping already validated combination:"
echo "RN=${{ matrix.reactNativeVersion }} | Reanimated=${{ matrix.reanimatedVersion }} | Worklets=${{ matrix.workletsVersion }}"
- name: Create RNC CLI app
if: steps.result-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/create-rnc-cli-app
with:
react-native-version: ${{ matrix.reactNativeVersion }}
reanimated-version: ${{ matrix.reanimatedVersion }}
worklets-version: ${{ matrix.workletsVersion }}
- name: Build app (Android Debug)
if: steps.result-cache.outputs.cache-hit != 'true'
working-directory: ${{ env.APP_NAME }}/android
run: ./gradlew assembleDebug --console=plain
- name: Mark combination as successful
if: steps.result-cache.outputs.cache-hit != 'true'
run: |
mkdir -p "${BUILD_MARKER_DIR}"
echo "ok" > "${BUILD_MARKER_DIR}/${{ env.CACHE_KEY }}.success"
- name: Save result cache
if: steps.result-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: ${{ env.BUILD_MARKER_DIR }}/${{ env.CACHE_KEY }}.success
key: reanimated-worklets-compat-android-${{ env.CACHE_KEY }}
reanimated-worklets-compatibility-check-ios:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: macos-26
needs: read-compatibility-json
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.read-compatibility-json.outputs.matrix) }}
env:
APP_NAME: app
CACHE_KEY: ${{ matrix.reactNativeVersion }}-${{ matrix.reanimatedVersion }}-${{ matrix.workletsVersion }}
BUILD_MARKER_DIR: .compatibility-build-markers
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: '.nvmrc'
- name: Restore result cache
id: result-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: ${{ env.BUILD_MARKER_DIR }}/${{ env.CACHE_KEY }}.success
key: reanimated-worklets-compat-ios-${{ env.CACHE_KEY }}
- name: Skip already validated combination
if: steps.result-cache.outputs.cache-hit == 'true'
run: |
echo "Skipping already validated combination:"
echo "RN=${{ matrix.reactNativeVersion }} | Reanimated=${{ matrix.reanimatedVersion }} | Worklets=${{ matrix.workletsVersion }}"
- name: Create RNC CLI app
if: steps.result-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/create-rnc-cli-app
with:
react-native-version: ${{ matrix.reactNativeVersion }}
reanimated-version: ${{ matrix.reanimatedVersion }}
worklets-version: ${{ matrix.workletsVersion }}
# RN >= 0.83 needs Xcode 26.3 because of a bug
# See https://github.com/fmtlib/fmt/issues/4740
- name: Select Xcode for older React Native
if: steps.result-cache.outputs.cache-hit != 'true'
env:
RN_VERSION: ${{ matrix.reactNativeVersion }}
run: |
RN_MINOR="$(echo "${RN_VERSION}" | cut -d. -f2)"
if [ "${RN_MINOR}" -lt 83 ]; then
echo "React Native ${RN_VERSION} < 0.83, pinning Xcode 26.3"
echo "DEVELOPER_DIR=/Applications/Xcode_26.3.app/Contents/Developer" >> "$GITHUB_ENV"
else
echo "React Native ${RN_VERSION} >= 0.83, using default Xcode"
fi
- name: Build app (iOS Debug)
if: steps.result-cache.outputs.cache-hit != 'true'
working-directory: ${{ env.APP_NAME }}/ios
run: |
xcodebuild build \
-workspace "${APP_NAME}.xcworkspace" \
-scheme "${APP_NAME}" \
-configuration Debug \
-sdk iphonesimulator \
-destination 'generic/platform=iOS Simulator' \
-quiet
- name: Mark combination as successful
if: steps.result-cache.outputs.cache-hit != 'true'
run: |
mkdir -p "${BUILD_MARKER_DIR}"
echo "ok" > "${BUILD_MARKER_DIR}/${{ env.CACHE_KEY }}.success"
- name: Save result cache
if: steps.result-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: ${{ env.BUILD_MARKER_DIR }}/${{ env.CACHE_KEY }}.success
key: reanimated-worklets-compat-ios-${{ env.CACHE_KEY }}