Skip to content

Commit

Permalink
Merge pull request zingolabs#754 from juanky201271/dev_recovering_ci_…
Browse files Browse the repository at this point in the history
…flow_for_ARM

Recovering ci flow for arm
  • Loading branch information
juanky201271 authored Nov 20, 2024
2 parents 21f4650 + af4d2cf commit 1c10876
Show file tree
Hide file tree
Showing 8 changed files with 311 additions and 420 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Android Macos Integration tests
name: Android Integration test

on:
workflow_call:
Expand All @@ -12,7 +12,7 @@ on:
abi:
required: true
type: string

env:
CACHE-KEY: ${{ inputs.cache-key }}
TIMESTAMP: ${{ inputs.timestamp }}
Expand All @@ -21,8 +21,8 @@ env:
RUSTFLAGS: -D warnings

jobs:
android-macos-integration-avd-cache:
name: Android Macos integration AVD cache
android-build-test-artifacts:
name: Android Build test artifacts
runs-on: macos-13
steps:
- name: Set envs for zingolib CI
Expand All @@ -34,82 +34,49 @@ jobs:
with:
repository: ${{ env.REPO-OWNER }}/zingo-mobile

- name: Set envs for x86_64
if: ${{ env.ABI == 'x86_64' }}
run: echo "AVD-ARCH=x86_64" >> $GITHUB_ENV

- name: Set envs for x86
if: ${{ env.ABI == 'x86' }}
run: echo "AVD-ARCH=x86" >> $GITHUB_ENV

- name: Set envs for arm64-v8a
if: ${{ env.ABI == 'arm64-v8a' }}
run: echo "AVD-ARCH=x86_64" >> $GITHUB_ENV

- name: Set envs for armeabi-v7a
if: ${{ env.ABI == 'armeabi-v7a' }}
run: echo "AVD-ARCH=x86" >> $GITHUB_ENV
- name: Install protoc
run: brew install protobuf

- name: AVD cache
uses: actions/cache/restore@v4
id: avd-cache
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.AVD-ARCH }}-integ-macos
lookup-only: true

- name: Trying to free space in the runner
if: steps.avd-cache.outputs.cache-hit != 'true'
run: |
xcrun simctl delete all
sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/*
- name: Setup Android SDK
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: android-actions/setup-android@v3
toolchain: stable

- name: Add emulator to PATH
if: steps.avd-cache.outputs.cache-hit != 'true'
run: echo "${ANDROID_SDK_ROOT}/emulator" >> $GITHUB_PATH
- name: Install nextest
uses: taiki-e/install-action@nextest

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: nick-fields/retry@v3
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
timeout_minutes: 30
max_attempts: 3
command: ./scripts/integration_tests.sh -a ${{ env.AVD-ARCH }} -s
workspaces: rust

- name: AVD cache saving
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
id: avd-cache-saving
- name: Build and archive tests
working-directory: ./rust
run: cargo nextest archive --verbose --features "regchest" --archive-file nextest-archive-${{ env.ABI }}.tar.zst

- name: Upload archive
uses: actions/upload-artifact@v4
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.AVD-ARCH }}-integ-macos
name: nextest-archive-${{ env.ABI }}
path: ./rust/nextest-archive-${{ env.ABI }}.tar.zst

android-macos-integration-test:
needs: [android-macos-integration-avd-cache]
name: Android Macos Integration test
android-integration-test:
name: Android Integration test
runs-on: macos-13

needs: android-build-test-artifacts
strategy:
fail-fast: false
matrix:
partition: [1, 2, 3, 4, 5]
partition: [1, 2, 3, 4, 5, 6]
steps:
- name: Set envs for zingolib CI
if: ${{ contains(github.repository, 'zingolib') }}
run: echo "REPO-OWNER=zingolabs" >> $GITHUB_ENV

- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ env.REPO-OWNER }}/zingo-mobile

- name: Set envs for x86_64
if: ${{ env.ABI == 'x86_64' }}
run: |
Expand All @@ -134,48 +101,24 @@ jobs:
echo "AVD-ARCH=x86" >> $GITHUB_ENV
echo "NEXTEST-ABI=arm32" >> $GITHUB_ENV
- name: Trying to free space in the runner
run: |
xcrun simctl delete all
sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/*
- name: Setup Docker 1 try
uses: douglascamata/setup-docker-macos-action@v1-alpha
id: dockerTry1
continue-on-error: true

- name: checking outcome 1
run: echo ${{ steps.dockerTry1.outcome }}

- name: Setup Docker 2 try
if: steps.dockerTry1.outcome != 'success'
uses: douglascamata/setup-docker-macos-action@v1-alpha
id: dockerTry2
continue-on-error: true

- name: checking outcome 2
if: steps.dockerTry1.outcome != 'success'
run: echo ${{ steps.dockerTry2.outcome }}

- name: Setup Docker Manually
if: steps.dockerTry1.outcome != 'success' && steps.dockerTry2.outcome != 'success'
- name: Install docker
run: |
brew install --head colima
brew install --formula docker
colima start --vm-type qemu --arch x86_64
colima start
- name: Colima status
run: colima status

- name: Pull regchest docker image
run: docker pull zingodevops/regchest:008

- name: Rust toolchain stable
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Install nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
uses: taiki-e/install-action@nextest

- name: Cargo cache
uses: Swatinem/rust-cache@v2
Expand All @@ -189,58 +132,65 @@ jobs:
key: native-android-uniffi-${{ env.ABI }}-${{ env.CACHE-KEY }}
fail-on-cache-miss: true

- name: Kotlin uniffi cache
uses: actions/cache/restore@v4
with:
path: android/app/build/generated/source/uniffi/debug/java/uniffi/zingo
key: kotlin-android-uniffi-${{ env.ABI }}-${{ env.CACHE-KEY }}
fail-on-cache-miss: true

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: 11.0


- name: Add emulator to PATH
run: echo "${ANDROID_SDK_ROOT}/emulator" >> $GITHUB_PATH

- name: Gradle cache
uses: gradle/actions/setup-gradle@v4
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.2
build-root-directory: ./android
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }}

- name: AVD cache
uses: actions/cache/restore@v4
uses: actions/cache@v4
id: avd-cache
with:
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.AVD-ARCH }}-integ-macos

- name: Kotlin uniffi cache
uses: actions/cache/restore@v4
key: avd-${{ env.AVD-ARCH }}-integ

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
with:
path: android/app/build/generated/source/uniffi/debug/java/uniffi/zingo
key: kotlin-android-uniffi-${{ env.ABI }}-${{ env.CACHE-KEY }}
fail-on-cache-miss: true
timeout_minutes: 60
max_attempts: 3
command: ./scripts/integration_tests.sh -a ${{ env.AVD-ARCH }} -s

- name: Download archive
uses: actions/download-artifact@v4
with:
name: nextest-archive
name: nextest-archive-${{ env.ABI }}
path: ./rust

- name: Run Android integration tests
- name: Run integration tests
working-directory: ./rust
run: |
cargo nextest run ${{ env.NEXTEST-ABI }} --verbose --profile ci \
--archive-file nextest-archive.tar.zst \
--partition count:${{ matrix.partition}}/5
cargo nextest run integration::${{ env.NEXTEST-ABI }} --verbose --profile ci \
--archive-file nextest-archive-${{ env.ABI }}.tar.zst \
--partition count:${{ matrix.partition}}/6
- name: Upload test reports
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: test-integration-reports-${{ env.ABI }}-${{ matrix.partition}}-${{ env.TIMESTAMP }}
path: android/app/build/outputs/integration_test_reports
name: test-reports-${{ env.ABI }}-${{ matrix.partition}}-${{ env.TIMESTAMP }}
path: android/app/build/outputs/integration_test_reports
6 changes: 6 additions & 0 deletions .github/workflows/android-ubuntu-e2e-test-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ on:
api-level:
required: true
type: string
target:
required: true
type: string

env:
REPO-OWNER: ${{ github.repository_owner }}
ABI: ${{ inputs.abi }}
API-LEVEL: ${{ inputs.api-level }}
TARGET: ${{ inputs.target }}
TIMESTAMP: ${{ inputs.timestamp }}

jobs:
Expand Down Expand Up @@ -86,6 +90,7 @@ jobs:
with:
api-level: ${{ env.API-LEVEL }}
arch: ${{ env.AVD-ARCH }}
target: ${{ env.TARGET }}
force-avd-creation: true
emulator-options: -no-snapshot-load -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
Expand Down Expand Up @@ -278,6 +283,7 @@ jobs:
with:
api-level: ${{ env.API-LEVEL }}
arch: ${{ env.AVD-ARCH }}
target: ${{ env.TARGET }}
force-avd-creation: true
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/android-ubuntu-integration-test-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ on:
api-level:
required: true
type: string
target:
required: true
type: string

env:
REPO-OWNER: ${{ github.repository_owner }}
ABI: ${{ inputs.abi }}
API-LEVEL: ${{ inputs.api-level }}
TARGET: ${{ inputs.target }}
TIMESTAMP: ${{ inputs.timestamp }}

jobs:
Expand Down Expand Up @@ -80,6 +84,7 @@ jobs:
with:
api-level: ${{ env.API-LEVEL }}
arch: ${{ env.AVD-ARCH }}
target: ${{ env.TARGET }}
force-avd-creation: true
emulator-options: -no-snapshot-load -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
Expand Down Expand Up @@ -253,6 +258,7 @@ jobs:
with:
api-level: ${{ env.API-LEVEL }}
arch: ${{ env.AVD-ARCH }}
target: ${{ env.TARGET }}
force-avd-creation: true
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/ci-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,32 @@ jobs:
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
arch: ${{ matrix.arch }}

android-macos-integration-test:
strategy:
matrix:
arch: [arm64-v8a, armeabi-v7a]
uses: ./.github/workflows/android-macos-integration-test.yaml
needs: [ create-timestamp, create-cache-key, android-build ]
with:
timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
abi: ${{ matrix.arch }}

android-ubuntu-integration-test-ci:
strategy:
matrix:
abi: [ x86_64, x86 ]
config:
- { abi: x86_64, api-level: 34, target: default }
- { abi: x86, api-level: 29, target: default }
fail-fast: false
uses: ./.github/workflows/android-ubuntu-integration-test-ci.yaml
needs: [create-timestamp, android-build]
with:
timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
abi: ${{ matrix.abi }}
api-level: 29
abi: ${{ matrix.config.abi }}
api-level: ${{ matrix.config['api-level'] }}
target: ${{ matrix.config.target }}

ios-build:
strategy:
Expand Down
Loading

0 comments on commit 1c10876

Please sign in to comment.