Skip to content

Commit

Permalink
Merge pull request zingolabs#696 from juanky201271/dev_working_new_te…
Browse files Browse the repository at this point in the history
…st_version_pre_zip320

Working new test version with zip320 support
  • Loading branch information
juanky201271 authored Sep 25, 2024
2 parents 6f6b265 + 8db78db commit a91e91a
Show file tree
Hide file tree
Showing 37 changed files with 1,319 additions and 605 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/android-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
if: ${{ needs.android-check-build-cache.outputs.native-cache-found != 'true' || needs.android-check-build-cache.outputs.kotlin-cache-found != 'true' }}
runs-on: ubuntu-22.04
container:
image: zingodevops/android_builder:009
image: zingodevops/android_builder:010
env:
RUSTUP_HOME: /root/.rustup
steps:
Expand Down Expand Up @@ -92,6 +92,9 @@ jobs:
- name: Cargo default nightly
run: rustup default nightly

- name: AWS libcrypto rust building
run: cargo install --force --locked bindgen-cli

- name: Cargo uniffi kotlin
working-directory: ./rust/lib
run: |
Expand Down
210 changes: 210 additions & 0 deletions .github/workflows/android-ubuntu-integration-test-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
name: Android Ubuntu Integration tests

on:
workflow_call:
inputs:
timestamp:
required: true
type: string
cache-key:
required: true
type: string
abi:
required: true
type: string
api-level:
required: true
type: string

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

jobs:
android-ubuntu-integration-test-actions:
name: Android Ubuntu Integration test
runs-on: ubuntu-22.04
strategy:
matrix:
test: ["offline_testsuite", "execute_sync_from_seed", "execute_send_from_orchard", "execute_currentprice_and_value_transfers_from_seed", "execute_sapling_balance_from_seed"]
env:
CACHE-KEY: ${{ inputs.cache-key }}
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: |
echo "AVD-ARCH=x86_64" >> $GITHUB_ENV
echo "NEXTEST-ABI=x86_64" >> $GITHUB_ENV
- name: Set envs for x86
if: ${{ env.ABI == 'x86' }}
run: |
echo "AVD-ARCH=x86" >> $GITHUB_ENV
echo "NEXTEST-ABI=x86_32" >> $GITHUB_ENV
- name: Set envs for arm64-v8a
if: ${{ env.ABI == 'arm64-v8a' }}
run: |
echo "AVD-ARCH=x86_64" >> $GITHUB_ENV
echo "NEXTEST-ABI=arm64" >> $GITHUB_ENV
- name: Set envs for armeabi-v7a
if: ${{ env.ABI == 'armeabi-v7a' }}
run: |
echo "AVD-ARCH=x86" >> $GITHUB_ENV
echo "NEXTEST-ABI=arm32" >> $GITHUB_ENV
- name: Remove unnecessary directories to free up space
run: |
echo "Disk space before post-build cleanup:"
df -h
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/lib/android/sdk/ndk
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo apt-get clean
echo "Disk space after post-build cleanup:"
df -h
- name: socket
run: |
sudo chmod 777 /var/run/docker.sock
sudo chmod 777 ./scripts/integration_tests_actions.sh
- 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: Install protoc
run: sudo apt install protobuf-compiler

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

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

- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
workspaces: rust

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

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

- name: Gradle cache
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: Native rust cache
uses: actions/cache/restore@v4
with:
path: android/app/src/main/jniLibs/${{ env.ABI }}
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: Restore AVD cache
uses: actions/cache/restore@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.ABI }}-api-${{ env.API-LEVEL }}-integ

- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API-LEVEL }}
arch: ${{ env.AVD-ARCH }}
force-avd-creation: true
emulator-options: -no-snapshot-load -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."

- name: Save AVD cache
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
id: avd-cache-saving
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.ABI }}-api-${{ env.API-LEVEL }}-integ

- name: Yarn install
run: yarn

- name: Run Build
working-directory: android
run: ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug -PsplitApk=true

- name: Remove unnecessary directories to free up space after build
run: |
echo "Disk space before post-build cleanup:"
df -h
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/lib/android/sdk/ndk
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo apt-get clean
echo "Disk space after post-build cleanup:"
df -h
- name: Yarn Start
run: nohup yarn start > "yarn_react_native_start.out" &

- name: Run Integration Test
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.API-LEVEL }}
arch: ${{ env.AVD-ARCH }}
force-avd-creation: true
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: cargo nextest run ${{ env.NEXTEST-ABI }}::${{ matrix.test }} --features "ci regchest actions" --verbose --release
working-directory: ./rust

- name: Upload test reports
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: test-integration-reports-${{ env.ABI }}-${{ matrix.test }}-${{ env.TIMESTAMP }}
path: android/app/build/outputs/integration_test_reports
34 changes: 4 additions & 30 deletions .github/workflows/ci-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,17 @@ jobs:
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
arch: ${{ matrix.arch }}

android-test:
uses: ./.github/workflows/android-test.yaml
needs: [ create-timestamp, android-build ]
with:
timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}

#android-e2e-test-script:
# strategy:
# matrix:
# abi: [ x86_64, x86, arm64-v8a, armeabi-v7a ]
# fail-fast: false
# uses: ./.github/workflows/android-e2e-test-script.yaml
# needs: [ create-timestamp, create-cache-key, android-test ]
# with:
# timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
# cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
# abi: ${{ matrix.abi }}

#android-e2e-test-actions:
# uses: ./.github/workflows/android-e2e-test-actions.yaml
# needs: [ create-timestamp, create-cache-key, android-test ]
# with:
# timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
# cache-key: ${{ needs.create-cache-key.outputs.cache-key }}

android-macos-integration-test:
android-ubuntu-integration-test-actions:
strategy:
matrix:
abi: [ x86_64, x86, arm64-v8a, armeabi-v7a ]
fail-fast: false
uses: ./.github/workflows/android-macos-integration-test.yaml
needs: [ android-test ]
uses: ./.github/workflows/android-ubuntu-integration-test-actions.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

ios-build:
uses: ./.github/workflows/ios-build.yaml
Expand Down
34 changes: 5 additions & 29 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,17 @@ jobs:
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
arch: ${{ matrix.arch }}

android-test:
uses: ./.github/workflows/android-test.yaml
needs: [create-timestamp, android-build]
with:
timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
cache-key: ${{ needs.create-cache-key.outputs.cache-key }}

#android-e2e-test-script:
# strategy:
# matrix:
# abi: [ x86_64, x86 ]
# uses: ./.github/workflows/android-e2e-test-script.yaml
# needs: [ create-timestamp, create-cache-key, android-test ]
# with:
# timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
# cache-key: ${{ needs.create-cache-key.outputs.cache-key }}
# abi: ${{ matrix.abi }}

#android-e2e-test-actions:
# uses: ./.github/workflows/android-e2e-test-actions.yaml
# needs: [ create-timestamp, create-cache-key, android-test ]
# with:
# timestamp: ${{ needs.create-timestamp.outputs.timestamp }}
# cache-key: ${{ needs.create-cache-key.outputs.cache-key }}

android-macos-integration-test:
android-ubuntu-integration-test-actions:
strategy:
matrix:
abi: [x86_64, x86]
uses: ./.github/workflows/android-macos-integration-test.yaml
needs: [android-test]
abi: [ x86_64, x86 ]
uses: ./.github/workflows/android-ubuntu-integration-test-actions.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

ios-build:
uses: ./.github/workflows/ios-build.yaml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-cache-key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Create cache key
runs-on: ubuntu-22.04
container:
image: zingodevops/android_builder:009
image: zingodevops/android_builder:010
env:
RUSTUP_HOME: /root/.rustup
outputs:
Expand Down
27 changes: 24 additions & 3 deletions .github/workflows/ios-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,42 @@ jobs:
if cat rust/lib/Cargo.toml | grep "^zingolib" | grep -q "branch"; then exit 1; fi
cd rust
sudo cargo update -p zingolib --aggressive
- name: Cargo default nightly
run: |
sudo rustup update
sudo rustup upgrade
sudo rustup default nightly
- name: AWS libcrypto rust building
run: sudo cargo install --force --locked bindgen-cli

- name: rustup show
run: sudo rustup show

- name: Cargo uniffi swift
working-directory: rust/lib
run: |
sudo cargo run --release --bin uniffi-bindgen \
generate ./src/zingo.udl --language swift \
--out-dir ./Generated
- name: Install Cargo Lipo
run: sudo cargo install cargo-lipo

- name: Install rust Target
run: sudo rustup target add x86_64-apple-ios

- name: Build Universal rust lib & uniffi lib and copy to ios folder
- name: Cargo lipo universal library
working-directory: rust/lib
run: |
sudo cargo run --release --bin uniffi-bindgen generate ./src/zingo.udl --language swift --out-dir ./Generated
sudo cargo lipo --release --targets x86_64-apple-ios
- name: Copy libraries to ios folder
working-directory: rust/lib
run: |
sudo cp ../target/universal/release/libzingo.a ./Generated/libuniffi_zingo.a
- name: Upload native rust
uses: actions/upload-artifact@v4
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
sudo udevadm trigger --name-match=kvm
- name: Pull regchest docker image
run: docker pull zingodevops/regchest:007
run: docker pull zingodevops/regchest:008

- name: Setup Java
uses: actions/setup-java@v4
Expand Down
Loading

0 comments on commit a91e91a

Please sign in to comment.