Skip to content

Commit

Permalink
Add build steps for both architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
hellostu committed Oct 16, 2024
1 parent 59bc5cf commit 5cbb82b
Showing 1 changed file with 184 additions and 32 deletions.
216 changes: 184 additions & 32 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI

on: [push, pull_request]

concurrency:
Expand All @@ -13,62 +14,147 @@ jobs:
- uses: actions/[email protected]
with:
node-version: 18.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v4
id: yarn-cache

# Cache Yarn dependencies
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run test
# Install dependencies and run lint
- name: Install dependencies and run lint
run: |
yarn
yarn lint
build-ios:
runs-on: macos-latest
sed -i '' 's/"newArchEnabled": true/"newArchEnabled": false/g' path/to/your/file.json
build-ios-old-arch:
runs-on: macos-latest
steps:
# Checkout the code
- name: Checkout the code
uses: actions/checkout@v4

# Set up Node.js environment
# Disable new architecture in app config
- name: Disable New Architecture in JSON
working-directory: apps/external-display-example
run: |
sed -i '' 's/"newArchEnabled": true/"newArchEnabled": false/g' app.json
# Set up Node.js
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: 18.x

# Cache Yarn dependencies to speed up the build
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v4
id: yarn-cache
# Cache Yarn dependencies
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Cache CocoaPods dependencies
- name: Cache CocoaPods
uses: actions/cache@v4
with:
path: |
apps/external-display-example/ios/Pods
apps/external-display-example/ios/Podfile.lock
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
# Install dependencies
- name: Install dependencies
run: yarn

# Prebuild the iOS folder for Expo
- name: Prebuild iOS with Expo
working-directory: apps/external-display-example
run: yarn expo prebuild --platform ios

# Install xcpretty for better build output
- name: Install xcpretty
run: gem install xcpretty

# Cache Xcode derived data
- name: Cache Xcode Derived Data
uses: actions/cache@v4
with:
path: apps/external-display-example/ios/build
key: build-${{ github.sha }}

# Build the iOS app using Xcode (with xcpretty)
- name: Build iOS App (Debug) with xcpretty
working-directory: apps/external-display-example/ios
run: |
yarn expo prebuild --platform ios
set -o pipefail && xcodebuild \
-workspace externaldisplayexample.xcworkspace \
-scheme externaldisplayexample \
-configuration Debug \
-sdk iphonesimulator \
-derivedDataPath build | xcpretty
build-ios-new-arch:
runs-on: macos-latest
steps:
# Checkout the code
- name: Checkout the code
uses: actions/checkout@v4

# Set up Node.js
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: 18.x

# Cache Yarn dependencies
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Cache CocoaPods dependencies
- name: Cache CocoaPods
uses: actions/cache@v4
with:
path: |
apps/external-display-example/ios/Pods
apps/external-display-example/ios/Podfile.lock
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
# Install dependencies
- name: Install dependencies
run: yarn

# Prebuild the iOS folder for Expo
- name: Prebuild iOS with Expo
working-directory: apps/external-display-example
run: yarn expo prebuild --platform ios

# Install xcpretty for better build output
- name: Install xcpretty
run: gem install xcpretty

# Cache Xcode derived data
- name: Cache Xcode Derived Data
uses: actions/cache@v4
with:
path: apps/external-display-example/ios/build
key: build-${{ github.sha }}

# Build the iOS app using Xcode (with xcpretty)
- name: Build iOS App (Debug) with xcpretty
working-directory: apps/external-display-example/ios
Expand All @@ -80,15 +166,20 @@ jobs:
-sdk iphonesimulator \
-derivedDataPath build | xcpretty
build-android:
build-android-old-arch:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout the code
uses: actions/checkout@v4

# Disable new architecture in app config
- name: Disable New Architecture in JSON
working-directory: apps/external-display-example
run: |
sed -i '' 's/"newArchEnabled": true/"newArchEnabled": false/g' app.json
# Set up Node.js environment
# Set up Node.js
- name: Set up Node.js
uses: actions/[email protected]
with:
Expand All @@ -101,30 +192,91 @@ jobs:
distribution: 'temurin'
java-version: '17'

# Cache Yarn dependencies to speed up the build
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
# Cache Yarn dependencies
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v4
id: yarn-cache
# Cache Gradle dependencies
- name: Cache Gradle
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
# Install dependencies
- name: Install dependencies
run: yarn

# Prebuild the Android folder for Expo
- name: Prebuild Android with Expo
working-directory: apps/external-display-example
run: yarn expo prebuild --platform android

# Build the APK using Gradle (without running on a device)
- name: Build Android APK
working-directory: apps/external-display-example/android
run: ./gradlew assembleDebug


build-android-new-arch:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout the code
uses: actions/checkout@v4

# Set up Node.js
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: 18.x

# Install Java 17
- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

# Cache Yarn dependencies
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Cache Gradle dependencies
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
# Install dependencies
- name: Install dependencies
run: yarn

# Prebuild the Android folder for Expo
- name: Prebuild Android with Expo
working-directory: apps/external-display-example
run: |
yarn expo prebuild --platform android
run: yarn expo prebuild --platform android

# Build the APK without running on a device
# Build the APK using Gradle (without running on a device)
- name: Build Android APK
working-directory: apps/external-display-example/android
run: ./gradlew assembleDebug

0 comments on commit 5cbb82b

Please sign in to comment.