Skip to content

Commit

Permalink
test: add automation testing
Browse files Browse the repository at this point in the history
Add browserstack support for workflow testing
  • Loading branch information
sanfengAndroid committed Jun 15, 2024
1 parent 5379e76 commit 1331514
Show file tree
Hide file tree
Showing 3 changed files with 927 additions and 904 deletions.
62 changes: 56 additions & 6 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ name: Android CI
on:
push:
branches: ["main"]
paths:
- "**.gradle"
- "**.py"
- ".github/**"
- "emulator-testapp/**"
- "library/**"
- "fakelinker-test/**"
- "Stub/**"
tags:
- "v*"
pull_request:
branches: ["main"]
workflow_dispatch:

env:
BROWSER_TEST_MAX_DURATION: 600

jobs:
build:
Expand All @@ -21,11 +33,6 @@ jobs:
distribution: "temurin"
cache: gradle

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install store file
run: echo ${{ secrets.STORE_FILE }} | base64 -d > fake.jks
- name: Install build configuration
Expand All @@ -45,7 +52,7 @@ jobs:
mkdir -p out/test_binary out/test_apk
mv fakelinker-test/src/main/cpp/build/Debug out/test_binary
mv fakelinker-test/build/outputs/apk/debug/fakelinker-test-debug.apk out/test_apk/fakelinker-test-debug.apk
mv fakelinker-test/build/outputs/apk/androidTest/debug/fakelinker-test-debug-androidTest.apk out/test_apk/fakelinker-androidtest-debug.apk
mv fakelinker-test/build/outputs/apk/androidTest/debug/fakelinker-test-debug-androidTest.apk out/test_apk/fakelinker-androidtest-debug-testsuite.apk
mv library/build/outputs/aar/library-debug.aar out/fakelinker-lib-debug.aar
mv library/build/outputs/aar/library-release.aar out/fakelinker-lib-release.aar
Expand Down Expand Up @@ -79,3 +86,46 @@ jobs:
name: ${{ github.sha }}-build
# A file, directory or wildcard pattern that describes what to upload
path: out

test_apk:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install requests
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}-build
path: ./artifacts
- name: Run BrowerStack 64bit Test
run: |
python ./browser_stack_test.py test \
--apk artifacts/test_apk/fakelinker-test-debug.apk \
--test-suite artifacts/test_apk/fakelinker-androidtest-debug-testsuite.apk \
--apk-custom-id FakelinkerTestApp \
--test-suite-custom-id FakelinkerTestSuite \
--build-last-failed \
--all-api \
--device-log
env:
BROWSER_STACK_KEY: ${{ secrets.BROWSER_STACK_KEY }}
- name: Run BrowerStack 32bit Test
run: |
python ./browser_stack_test.py test \
--apk artifacts/test_apk/fakelinker-test-32bit-debug.apk \
--test-suite artifacts/test_apk/fakelinker-androidtest-debug-testsuite.apk \
--apk-custom-id FakelinkerTestApp \
--test-suite-custom-id FakelinkerTestSuite \
--build-last-failed \
--all-api \
--device-log \
--is-32bit
env:
BROWSER_STACK_KEY: ${{ secrets.BROWSER_STACK_KEY }}
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ repos:
rev: v2.0.4
hooks:
- id: autopep8
args:
["-i", "--indent-size=2", "--max-line-length=120", "--experimental"]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.13.0
hooks:
Expand Down
Loading

0 comments on commit 1331514

Please sign in to comment.