Skip to content

Commit

Permalink
Merge branch 'main' into test-automation
Browse files Browse the repository at this point in the history
  • Loading branch information
a-szotyori authored Aug 21, 2024
2 parents e097417 + 38cbce3 commit 3b858f1
Show file tree
Hide file tree
Showing 764 changed files with 23,826 additions and 1,446 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/capture-sdk.check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,65 @@ jobs:
# name: capture-sdk-unit-test-coverage
# path: capture-sdk/sdk/build/jacoco/jacocoHtml

instrumented-test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

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

- name: enable KVM group perms for emulator
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: avd cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-x86_64-33-${{ github.ref_name }}

- 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: 33
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -no-audio -no-boot-anim -camera-back none
disable-animations: true
script: echo "Generated AVD snapshot for caching."

- name: run instrumented tests
timeout-minutes: 20
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: >
adb uninstall net.gini.android.capture.test ;
./gradlew capture-sdk:sdk:connectedCheck
- name: archive instrumented test results
if: always()
uses: actions/upload-artifact@v4
with:
name: capture-sdk-instrumented-test-results
path: capture-sdk/sdk/build/outputs/androidTest-results/connected

default-network-test:
runs-on: ubuntu-latest
steps:
Expand Down
157 changes: 157 additions & 0 deletions .github/workflows/merchant-sdk.check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: Check Merchant SDK

on:
push:
paths:
- 'merchant-sdk/**'
- 'health-api-library/**'
- 'core-api-library/**'
- 'gradle/**'
branches:
- '**'
tags-ignore:
- '**'
pull_request:
types: [opened, edited, reopened]
paths:
- 'merchant-sdk/**'
- 'health-api-library/**'
- 'core-api-library/**'
- 'gradle/**'
workflow_call:
secrets:
GINI_MOBILE_TEST_CLIENT_SECRET:
required: true
MERCHANT_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD:
required: true

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: run unit tests
run: ./gradlew merchant-sdk:sdk:testDebugUnitTest

- name: archive unit test results
if: always()
uses: actions/upload-artifact@v3
with:
name: merchant-sdk-unit-test-results
path: merchant-sdk/sdk/build/reports/tests

build-example-app:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: build release example app for QA
run: >
./gradlew merchant-sdk:example-app:assembleQaRelease
-PclientId="gini-mobile-test"
-PclientSecret="${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}"
-PreleaseKeystoreFile="merchant_sdk_example.jks"
-PreleaseKeystorePassword='${{ secrets.MERCHANT_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}'
-PreleaseKeyAlias="merchant_sdk_example"
-PreleaseKeyPassword='${{ secrets.MERCHANT_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}'
- name: archive release example app for QA
uses: actions/upload-artifact@v3
with:
name: merchant-sdk-example-app-qa-release
path: merchant-sdk/example-app/build/outputs/apk/qa/release

- name: build release example app for production
run: >
./gradlew merchant-sdk:example-app:assembleProdRelease
-PclientId="gini-mobile-test"
-PclientSecret="${{ secrets.GINI_MOBILE_TEST_CLIENT_SECRET }}"
-PreleaseKeystoreFile="merchant_sdk_example.jks"
-PreleaseKeystorePassword='${{ secrets.MERCHANT_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}'
-PreleaseKeyAlias="merchant_sdk_example"
-PreleaseKeyPassword='${{ secrets.MERCHANT_SDK_EXAMPLE_APP_KEYSTORE_PASSWORD }}'
- name: archive release example app for production
uses: actions/upload-artifact@v3
with:
name: merchant-sdk-example-app-prod-release
path: merchant-sdk/example-app/build/outputs/apk/prod/release

android-lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: run android lint
run: ./gradlew merchant-sdk:sdk:lint

- name: archive android lint report
uses: actions/upload-artifact@v3
with:
name: merchant-sdk-android-lint-report
path: merchant-sdk/sdk/build/reports/lint-results*.html

detekt:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: run detekt
run: ./gradlew merchant-sdk:sdk:detekt

- name: archive detekt report
uses: actions/upload-artifact@v3
with:
name: merchant-sdk-detekt-report
path: merchant-sdk/sdk/build/reports/detekt/*.html

ktlint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: run ktlint
run: ./gradlew merchant-sdk:sdk:ktlintCheck

- name: archive ktlint report
uses: actions/upload-artifact@v3
with:
name: merchant-sdk-ktlint-report
path: merchant-sdk/sdk/build/reports/ktlint/**/*.html
55 changes: 55 additions & 0 deletions .github/workflows/merchant-sdk.docs.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build docs for Merchant SDK

on:
push:
paths:
- 'merchant-sdk/**'
branches:
- '**'
tags-ignore:
- '**'
pull_request:
types: [opened, edited, reopened]
paths:
- 'merchant-sdk/**'

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: setup python
uses: actions/setup-python@v4
with:
python-version: 'pypy2.7'

- name: setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.0'
bundler-cache: true

- name: build documentation
uses: maierj/[email protected]
with:
lane: 'build_documentation'
options: >
{
"project_id": "merchant-sdk",
"module_id": "sdk"
}
- name: archive documentation
uses: actions/upload-artifact@v3
with:
name: merchant-sdk-documentation
path: merchant-sdk/sdk/build/docs
75 changes: 75 additions & 0 deletions .github/workflows/merchant-sdk.docs.release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Release docs for Merchant SDK

on:
push:
tags:
- 'merchant-sdk;[0-9]+.[0-9]+.[0-9]+;doc**'
- 'merchant-sdk;[0-9]+.[0-9]+.[0-9]+-beta[0-9][0-9];doc**'
workflow_call:
secrets:
RELEASE_GITHUB_USER:
required: true
RELEASE_GITHUB_PASSWORD:
required: true

jobs:
release-docs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: get branch name
id: branch
shell: bash
run: |
# Get the branch ref that contains the tag in github.ref
# (github.ref contains the tag because this workflow is triggered by tags:
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context)
branch_ref=$(git branch -r --contains "${{ github.ref }}")
# Remove "origin/" prefix from branch_ref and trim whitespace
branch_name=$(echo ${branch_ref/origin\/} | tr -d '[:space:]')
echo "::set-output name=branch_name::$branch_name"
echo "branch_name: $branch_name"
- name: setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'

- name: setup python
uses: actions/setup-python@v4
with:
python-version: 'pypy2.7'

- name: setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.0'
bundler-cache: true

- name: release documentation
uses: maierj/[email protected]
with:
lane: 'release_documentation'
options: >
{
"project_id": "merchant-sdk",
"module_id": "sdk",
"documentation_title": "Gini Merchant SDK for Android",
"is_stable_release": "${{ steps.branch.outputs.branch_name == 'main' }}",
"git_tag": "${{ github.ref }}",
"ci": "true",
"git_user": "${{ secrets.RELEASE_GITHUB_USER }}",
"git_password": "${{ secrets.RELEASE_GITHUB_PASSWORD }}"
}
- name: archive documentation
uses: actions/upload-artifact@v3
with:
name: merchant-sdk-documentation
path: merchant-sdk/sdk/build/docs
Loading

0 comments on commit 3b858f1

Please sign in to comment.