Skip to content

Commit

Permalink
Add build-macos to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Saadnajmi committed Nov 7, 2024
1 parent 51648f5 commit ada8975
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,36 @@ jobs:
- name: Build example for iOS
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
build-macos:
runs-on: macos-latest
env:
TURBO_CACHE_DIR: .turbo/macos
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Cache turborepo for macOS
uses: actions/cache@v3
with:
path: ${{ env.TURBO_CACHE_DIR }}
key: ${{ runner.os }}-turborepo-macos-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-turborepo-macos-
- name: Check turborepo cache for macOS
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:macos --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:macos').cache.status")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Build example for macOS
run: |
yarn turbo run build:macos --cache-dir="${{ env.TURBO_CACHE_DIR }}"
4 changes: 3 additions & 1 deletion apps/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"pod:install": "pod install --project-directory=ios",
"pod:install:ios": "pod install --project-directory=ios",
"pod:install:macos": "pod install --project-directory=macos",
"build:android": "cd android && ./gradlew assembleDebug --warning-mode all",
"build:ios": "react-native build-ios --scheme Example --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\"",
"build:macos": "react-native build-macos --scheme Example --mode Debug",
"mkdist": "node -e \"require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })\""
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"lint": "turbo run lint",
"tsc": "turbo run tsc",
"build:ios": "turbo run build:ios",
"build:macos": "turbo run build:macos",
"build:android": "turbo run build:android",
"build": "turbo run build",
"pod:install": "turbo run pod:install"
Expand Down
28 changes: 25 additions & 3 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
]
},
"build:ios": {
"dependsOn": ["pod:install"],
"dependsOn": ["pod:install:ios"],
"outputs": [
"apps/*/ios/build",
"apps/*/ios/Pods"
Expand All @@ -34,14 +34,36 @@
"**/package.json",
"**/*.podspec",
"packages/webgpu/cpp/**",
"packages/webgpu/ios/**",
"packages/webgpu/apple/**",
"apps/*/package.json",
"apps/*/ios",
"!apps/*/ios/build",
"!apps/*/ios/Pods"
]
},
"pod:install": {
"build:macos": {
"dependsOn": ["pod:install:macos"],
"outputs": [
"apps/*/macos/build",
"apps/*/macos/Pods"
],
"inputs": [
"**/package.json",
"**/*.podspec",
"packages/webgpu/cpp/**",
"packages/webgpu/apple/**",
"apps/*/package.json",
"apps/*/macos",
"!apps/*/macos/build",
"!apps/*/macos/Pods"
]
},
"pod:install:ios": {
"cache": false,
"inputs": ["**/ios/Podfile", "**/ios/Podfile.lock"],
"outputs": ["**/ios/Pods/**"]
},
"pod:install:macos": {
"cache": false,
"inputs": ["**/ios/Podfile", "**/ios/Podfile.lock"],
"outputs": ["**/ios/Pods/**"]
Expand Down

0 comments on commit ada8975

Please sign in to comment.