Skip to content

Add GitHub Actions CI for React Native projects #24

Add GitHub Actions CI for React Native projects

Add GitHub Actions CI for React Native projects #24

Workflow file for this run

name: React Native CI
on:
push:
branches: [ main ]
paths:
- 'react-native/**'
pull_request:
branches: [ main ]
paths:
- 'react-native/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
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
build-android:
runs-on: ubuntu-latest
needs: lint
timeout-minutes: 30
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: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
react-native/android/.gradle
key: gradle-${{ runner.os }}-${{ hashFiles('react-native/android/gradle/wrapper/gradle-wrapper.properties', 'react-native/android/**/*.gradle*') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Build Android
working-directory: react-native
run: yarn build:android
build-ios:
runs-on: macos-latest
needs: lint
timeout-minutes: 30
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: Install Ruby gems
working-directory: react-native
run: bundle install
- name: Install CocoaPods
working-directory: react-native/ios
run: bundle exec pod install --repo-update
- name: Build iOS
working-directory: react-native
run: yarn build:ios