Skip to content

Add GitHub Actions CI for React Native projects #10

Add GitHub Actions CI for React Native projects

Add GitHub Actions CI for React Native projects #10

Workflow file for this run

name: React Native CI
on:
push:
branches: [ main ]
paths:
- 'react-native/**'
pull_request:
branches: [ main ]
paths:
- 'react-native/**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: react-native/yarn.lock
- name: Install dependencies
working-directory: react-native
run: yarn install --frozen-lockfile
- name: Run linting
working-directory: react-native
run: yarn lint
- name: Run tests
working-directory: react-native
run: yarn test --passWithNoTests --watchAll=false || true
android-build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: react-native/yarn.lock
- name: Install dependencies
working-directory: react-native
run: yarn install --frozen-lockfile
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Build Android
working-directory: react-native
run: |
cd android
./gradlew assembleDebug
ios-build:
runs-on: macos-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
cache-dependency-path: react-native/yarn.lock
- name: Install dependencies
working-directory: react-native
run: yarn install --frozen-lockfile
- name: Setup iOS dependencies
working-directory: react-native
run: |
cd ios
rm -f Podfile.lock
pod install
- name: Build iOS
working-directory: react-native
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