Skip to content

Add GitHub Actions CI for React Native projects #4

Add GitHub Actions CI for React Native projects

Add GitHub Actions CI for React Native projects #4

Workflow file for this run

name: React Native CI
on:
push:
branches: [ main ]
paths:
- 'react-native/**'
- 'react-native-expo/**'
pull_request:
branches: [ main ]
paths:
- 'react-native/**'
- 'react-native-expo/**'
jobs:
react-native-ci:
runs-on: ubuntu-latest
strategy:
matrix:
project: [react-native, react-native-expo]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: ${{ matrix.project }}/yarn.lock
- name: Install dependencies
working-directory: ${{ matrix.project }}
run: yarn install --frozen-lockfile
- name: Run linting
working-directory: ${{ matrix.project }}
run: yarn lint
- name: Setup Java (for Android builds)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Build Android (React Native)
if: matrix.project == 'react-native'
working-directory: ${{ matrix.project }}
run: |
cd android
./gradlew assembleDebug
- name: Build Android (Expo)
if: matrix.project == 'react-native-expo'
working-directory: ${{ matrix.project }}
run: |
npx expo install --fix
npx expo prebuild --platform android
cd android
./gradlew assembleDebug
ios-build:
runs-on: macos-latest
strategy:
matrix:
project: [react-native, react-native-expo]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: ${{ matrix.project }}/yarn.lock
- name: Install dependencies
working-directory: ${{ matrix.project }}
run: yarn install --frozen-lockfile
- name: Setup iOS dependencies (React Native)
if: matrix.project == 'react-native'
working-directory: ${{ matrix.project }}
run: |
cd ios
pod install
- name: Setup iOS dependencies (Expo)
if: matrix.project == 'react-native-expo'
working-directory: ${{ matrix.project }}
run: |
npx expo install --fix
npx expo prebuild --platform ios
cd ios
pod install
- name: Build iOS
working-directory: ${{ matrix.project }}
run: |
cd ios
xcodebuild -workspace *.xcworkspace -scheme $(basename *.xcworkspace .xcworkspace) -configuration Debug -sdk iphonesimulator -arch x86_64 build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO