Skip to content

Commit

Permalink
build: streamline actions into setup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7061 committed Sep 26, 2024
1 parent e4d5981 commit 786ef9a
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 164 deletions.
51 changes: 51 additions & 0 deletions .github/actions/capacitor-setup-android/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 'capacitor-setup-android'
description: ''
runs:
using: 'composite'
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Install Android SDK
uses: android-actions/setup-android@v3
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
android/.gradle
~/.gradle/caches
key: gradle
- name: Cache Android SDK
id: aandroid-sdk
uses: actions/cache@v4
with:
path: ~/Android/Sdk
key: android-sdk
- name: Cache AVD
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29
- name: Npm Install
run: npm i
43 changes: 43 additions & 0 deletions .github/actions/capacitor-setup-ios/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'capacitor-setup-ios'
description: ''
runs:
using: 'composite'
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Install Swift
uses: SwiftyLab/setup-swift@latest
with:
swift-version: '5.10.0'
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Cache Pods
id: pods
uses: actions/cache@v4
with:
path: |
ios/Pods
key: pods
- name: Cache Xcode
uses: irgaly/[email protected]
with:
key: xcode-deriveddata
restore-keys: xcode-deriveddata
- name: Npm Install
shell: bash
run: npm i
- name: Pod Install
shell: bash
run: cd ios; pod install; cd -
18 changes: 18 additions & 0 deletions .github/actions/capacitor-setup-web/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'capacitor-setup-web'
description: ''
runs:
using: 'composite'
steps:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Npm Install
run: npm i
88 changes: 6 additions & 82 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Npm Install
run: npm i
- name: Setup Capacitor iOS
uses: ./.github/actions/capacitor-setup-web
- name: Run Build
run: npm run verify:web
build_ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Install Swift
uses: SwiftyLab/setup-swift@latest
with:
swift-version: '5.10.0'
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Cache Pods
id: pods
uses: actions/cache@v4
with:
path: |
ios/Pods
key: pods
- name: Cache Xcode
uses: irgaly/[email protected]
with:
key: xcode-deriveddata
restore-keys: xcode-deriveddata
- name: Npm Install
run: npm i
- name: Pod Install
run: cd ios; pod install; cd -
- name: Setup Capacitor iOS
uses: ./.github/actions/capacitor-setup-ios
- name: Run Build
env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app
Expand All @@ -78,38 +33,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Install Android SDK
uses: android-actions/setup-android@v3
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
android/.gradle
~/.gradle/caches
key: gradle
- name: Cache Android SDK
id: aandroid-sdk
uses: actions/cache@v4
with:
path: ~/Android/Sdk
key: android-sdk
- name: Npm Install
run: npm i
- name: Setup Capacitor Android
uses: ./.github/actions/capacitor-setup-android
- name: Run Build
run: npm run verify:android
86 changes: 4 additions & 82 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,8 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Install Swift
uses: SwiftyLab/setup-swift@latest
with:
swift-version: '5.10.0'
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Cache Pods
id: pods
uses: actions/cache@v4
with:
path: |
ios/Pods
key: pods
- name: Cache Xcode
uses: irgaly/[email protected]
with:
key: xcode-deriveddata
restore-keys: xcode-deriveddata
- name: Npm Install
run: npm i
- name: Pod Install
run: cd ios; pod install; cd -
- name: Setup Capacitor iOS
uses: ./.github/actions/capacitor-setup-ios
- name: Run Tests
env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app
Expand All @@ -61,52 +27,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Install Android SDK
uses: android-actions/setup-android@v3
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Cache node_modules
id: node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
android/.gradle
~/.gradle/caches
key: gradle
- name: Cache Android SDK
id: aandroid-sdk
uses: actions/cache@v4
with:
path: ~/Android/Sdk
key: android-sdk
- name: Cache AVD
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29
- name: Npm Install
run: npm i
- name: Setup Capacitor Android
uses: ./.github/actions/capacitor-setup-android
- name: Run Tests
uses: reactivecircus/android-emulator-runner@v2
with:
Expand Down

0 comments on commit 786ef9a

Please sign in to comment.