Skip to content

Commit

Permalink
ci: split test and ci
Browse files Browse the repository at this point in the history
  • Loading branch information
INDAPP committed Aug 24, 2024
1 parent a0ad58f commit 10be5ce
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 115 deletions.
31 changes: 24 additions & 7 deletions .github/actions/expo-prebuild/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,38 @@ inputs:
platform:
description: Should be android or ios
required: true
cache-key:
description: Cache prebuild folder if set
key:
description: Artifact key
required: false
outputs:
artifact:
description: Artifact name
value: ${{ steps.artifact-name.outputs.name }}
runs:
using: 'composite'
steps:
- name: Expo prebuild cache
uses: actions/cache@v4
if: ${{ inputs.cache-key != '' }}
- name: Define artifact name
id: artifact-name
shell: bash
run: echo "name=${{ inputs.platform }}-prebuild-${{ inputs.key }}" >> $GITHUB_OUTPUT
- name: Check artifact existance
id: artifact-check
uses: LIT-Protocol/artifact-exists-action@v0
with:
path: ./example/${{ inputs.platform }}
key: ${{ inputs.cache-key }}
name: ${{ steps.artifact-name.outputs.name }}
- name: Expo prebuild
if: ${{ steps.artifact-check.outputs.exists != 'true' }}
env:
PLATFORM: ${{ inputs.platform }}
working-directory: ./example
shell: bash
run: npm run prebuild -- --no-install --platform $PLATFORM
- name: Create artifact
if: ${{ inputs.key != '' && steps.artifact-check.outputs.exists != 'true' }}
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact-name.outputs.name }}
path: ./example/${{ inputs.platform }}
if-no-files-found: error
retention-days: 90
overwrite: true
108 changes: 1 addition & 107 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: CI
name: Continuous integration

on:
pull_request:
branches: [main]

env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
CP_HOME_DIR: ${{ github.workspace }}/.cocoapods

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'main' }}
Expand Down Expand Up @@ -35,105 +31,3 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- run: npm run build
expo_fingerprint:
name: Calculate fingerprint
runs-on: ubuntu-latest
needs: [npm_install]
outputs:
fingerprint: ${{ steps.expo-fingerprint.outputs.fingerprint }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- uses: ./.github/actions/expo-fingerprint
id: expo-fingerprint
prebuild_android:
name: Expo prebuild Android
runs-on: ubuntu-latest
needs: [expo_fingerprint]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- uses: ./.github/actions/expo-prebuild
with:
cache-key: prebuild-android-${{ needs.expo_fingerprint.outputs.fingerprint }}
platform: android
prebuild_ios:
name: Expo prebuild iOS
runs-on: ubuntu-latest
needs: [expo_fingerprint]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- uses: ./.github/actions/expo-prebuild
with:
cache-key: prebuild-ios-${{ needs.expo_fingerprint.outputs.fingerprint }}
platform: ios
test_android:
name: Test Android
# Can't run on macos-latest: https://github.com/ReactiveCircus/android-emulator-runner/issues/392
runs-on: macos-13
needs: [expo_fingerprint, prebuild_android]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- uses: actions/cache/restore@v4
with:
path: ./example/android
key: prebuild-android-${{ needs.expo_fingerprint.outputs.fingerprint }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Test Android Module
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
target: google_apis
arch: x86_64
working-directory: ./example/android
script: ./gradlew expo-signature:connectedAndroidTest
disable-animations: true
test_ios:
name: Test iOS
runs-on: macos-latest
needs: [expo_fingerprint, prebuild_ios]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- name: Cache CocoaPods
id: cocoapods-cache
uses: actions/cache@v4
with:
path: ${{ env.CP_HOME_DIR }}
key: ${{ runner.os }}-pods
- uses: actions/cache/restore@v4
with:
path: ./example/ios
key: prebuild-ios-${{ needs.expo_fingerprint.outputs.fingerprint }}
- uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
- uses: ./.github/actions/npm-install
- name: Pod install
working-directory: ./example/ios
run: pod install
- name: Test iOS Module
working-directory: ./example
run: |
xcodebuild test \
-workspace ios/exposignatureexample.xcworkspace \
-scheme SignatureModule-Unit-Tests \
-destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest'
2 changes: 1 addition & 1 deletion .github/workflows/CD.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CD
name: Release new package version

on:
push:
Expand Down
122 changes: 122 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Test native

on:
push:
pull_request:
branches: [main]
paths:
- 'android/**'
- 'ios/**'
workflow_dispatch:

env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
CP_HOME_DIR: ${{ github.workspace }}/.cocoapods

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'main' }}

jobs:
expo_fingerprint:
name: Calculate fingerprint
runs-on: ubuntu-latest
outputs:
fingerprint: ${{ steps.expo-fingerprint.outputs.fingerprint }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- uses: ./.github/actions/expo-fingerprint
id: expo-fingerprint
prebuild_android:
name: Expo prebuild Android
runs-on: ubuntu-latest
needs: [expo_fingerprint]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- uses: ./.github/actions/expo-prebuild
with:
key: ${{ needs.expo_fingerprint.outputs.fingerprint }}
platform: android
prebuild_ios:
name: Expo prebuild iOS
runs-on: ubuntu-latest
needs: [expo_fingerprint]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- uses: ./.github/actions/expo-prebuild
with:
key: ${{ needs.expo_fingerprint.outputs.fingerprint }}
platform: ios
test_android:
name: Test Android
# Can't run on macos-latest: https://github.com/ReactiveCircus/android-emulator-runner/issues/392
runs-on: macos-13
needs: [prebuild_android]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- uses: actions/download-artifact@v4
with:
path: ./example/android
name: ${{ needs.prebuild_android.outputs.artifact }}

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Test Android Module
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
target: google_apis
arch: x86_64
working-directory: ./example/android
script: ./gradlew expo-signature:connectedAndroidTest
disable-animations: true
test_ios:
name: Test iOS
runs-on: macos-latest
needs: [prebuild_ios]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/npm-install
- name: Cache CocoaPods
id: cocoapods-cache
uses: actions/cache@v4
with:
path: ${{ env.CP_HOME_DIR }}
key: ${{ runner.os }}-pods
- uses: actions/download-artifact@v4
with:
path: ./example/ios
name: ${{ needs.prebuild_ios.outputs.artifact }}
- uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
- uses: ./.github/actions/npm-install
- name: Pod install
working-directory: ./example/ios
run: pod install
- name: Test iOS Module
working-directory: ./example
run: |
xcodebuild test \
-workspace ios/exposignatureexample.xcworkspace \
-scheme SignatureModule-Unit-Tests \
-destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=latest'

0 comments on commit 10be5ce

Please sign in to comment.