aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorMenny Even Danan <menny@evendanan.net>2019-10-30 17:19:21 +0000
committerGitHub <noreply@github.com>2019-10-30 17:19:21 +0000
commit1f1990d3330c5ea529eb7dc2343a9ad53eeefc36 (patch)
treed187325d6af2440c974198170d64de8e6b3344b6 /.github
parente7b0fb9c67277fefe8d184d7bdb1e69928cdfc42 (diff)
parent467fa4b6daa14b41b4ef9db02e32bad1709e3599 (diff)
downloadAnySoftKeyboard-1f1990d3330c5ea529eb7dc2343a9ad53eeefc36.tar.gz
AnySoftKeyboard-1f1990d3330c5ea529eb7dc2343a9ad53eeefc36.tar.bz2
Breaking tests into reusable actions (#1868)
Breaking tests into reusable actions
Diffstat (limited to '.github')
-rw-r--r--.github/actions/codecov/action.yml16
-rw-r--r--.github/actions/codecov/upload_coverage.sh5
-rw-r--r--.github/actions/collect-reports/action.yml22
-rw-r--r--.github/actions/collect-reports/collect.sh7
-rw-r--r--.github/actions/test-shard-run/action.yml29
-rw-r--r--.github/actions/test-shard-run/run_tests.sh10
-rw-r--r--.github/workflows/android.yml254
-rw-r--r--.github/workflows/anysoftkeyboard.yml152
8 files changed, 241 insertions, 254 deletions
diff --git a/.github/actions/codecov/action.yml b/.github/actions/codecov/action.yml
new file mode 100644
index 000000000..ae6de1d98
--- /dev/null
+++ b/.github/actions/codecov/action.yml
@@ -0,0 +1,16 @@
+name: "Code Cov"
+author: "menny"
+
+runs:
+ using: "docker"
+ image: "docker://menny/ndk_ask:1.13.1"
+ env:
+ TERM: dumb
+ CODECOV_TOKEN: 1a4cd171-2784-4f48-8a62-0b7ec31e6d7e
+ entrypoint: /bin/bash
+ args:
+ - .github/actions/codecov/upload_coverage.sh
+
+branding:
+ icon: 'pie-chart'
+ color: 'green'
diff --git a/.github/actions/codecov/upload_coverage.sh b/.github/actions/codecov/upload_coverage.sh
new file mode 100644
index 000000000..6d399d23f
--- /dev/null
+++ b/.github/actions/codecov/upload_coverage.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+curl https://codecov.io/bash -o codecov.sh
+chmod +x codecov.sh
+./codecov.sh -X gcov -X coveragepy -X xcode `find . -name "test*UnitTestCoverage.xml" | xargs -n 1 echo -n " -f "`
diff --git a/.github/actions/collect-reports/action.yml b/.github/actions/collect-reports/action.yml
new file mode 100644
index 000000000..b09e27ec8
--- /dev/null
+++ b/.github/actions/collect-reports/action.yml
@@ -0,0 +1,22 @@
+name: "Collect reports"
+author: "menny"
+
+inputs:
+ output_folder:
+ description: "collect destination"
+ default: "collected_reports"
+ file_pattern:
+ description: "pattern"
+
+runs:
+ using: "docker"
+ image: "docker://menny/ndk_ask:1.13.1"
+ entrypoint: /bin/bash
+ args:
+ - .github/actions/collect-reports/collect.sh
+ - ${{ inputs.output_folder }}
+ - ${{ inputs.file_pattern }}
+
+branding:
+ icon: 'package'
+ color: 'brown'
diff --git a/.github/actions/collect-reports/collect.sh b/.github/actions/collect-reports/collect.sh
new file mode 100644
index 000000000..da274db47
--- /dev/null
+++ b/.github/actions/collect-reports/collect.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+OUTPUT=${1}
+PATTERN=${2}
+rm -rf ${OUTPUT} || true
+mkdir ${OUTPUT} || true
+find . -path ./${OUTPUT} -prune -o -name "${PATTERN}" -exec cp {} ${OUTPUT}/ \;
diff --git a/.github/actions/test-shard-run/action.yml b/.github/actions/test-shard-run/action.yml
new file mode 100644
index 000000000..4d4582dce
--- /dev/null
+++ b/.github/actions/test-shard-run/action.yml
@@ -0,0 +1,29 @@
+name: "Run tests"
+author: "menny"
+
+inputs:
+ index:
+ description: "zero-based index of the shard"
+ groups_count:
+ description: "count of groups"
+ default: 3
+ module:
+ default: ""
+ extra_args:
+ default: ""
+runs:
+ using: "docker"
+ image: "docker://menny/ndk_ask:1.13.1"
+ env:
+ TERM: dumb
+ entrypoint: /bin/bash
+ args:
+ - .github/actions/test-shard-run/run_tests.sh
+ - ${{ inputs.groups_count }}
+ - ${{ inputs.index }}
+ - ${{ inputs.module }}
+ - ${{ inputs.extra_args }}
+
+branding:
+ icon: 'activity'
+ color: 'yellow'
diff --git a/.github/actions/test-shard-run/run_tests.sh b/.github/actions/test-shard-run/run_tests.sh
new file mode 100644
index 000000000..08871151c
--- /dev/null
+++ b/.github/actions/test-shard-run/run_tests.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+export TEST_GROUPS_COUNT=${1}
+export TEST_GROUP_INDEX=${2}
+MODULE=${3}
+EXTRA_ARGS=${4}
+
+echo "Will run tests for module '${MODULE}' with extra args '${EXTRA_ARGS}' for group-index ${TEST_GROUP_INDEX} out of ${TEST_GROUPS_COUNT} groups:"
+
+./gradlew --stacktrace -Dorg.gradle.daemon=false ${MODULE}testDebugUnitTest ${MODULE}testDebugUnitTestCoverage ${EXTRA_ARGS}
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
deleted file mode 100644
index 8aa4deb24..000000000
--- a/.github/workflows/android.yml
+++ /dev/null
@@ -1,254 +0,0 @@
-name: AnySoftKeyboard
-
-on:
- push:
- branches:
- - master
- - release-branch-v*
- pull_request:
- branches:
- - '*'
- paths-ignore:
- - '**.md'
-
-jobs:
- checks:
- runs-on: ubuntu-18.04
- container: menny/ndk_ask:1.13.1
- steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
- - name: setup
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- run: |
- echo "ENV:"
- printenv
- echo "******"
- echo "Event: "
- cat ${GITHUB_EVENT_PATH}
- echo "***"
- ./scripts/ci/ci_setup.sh
-
- - name: check
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- run: ./scripts/ci/ci_check.sh
- - uses: actions/upload-artifact@v1.0.0
- with:
- name: debug-apk
- path: app/build/outputs/apk/debug/app-debug.apk
- - name: artifacts
- if: always()
- run: |
- rm -rf all-checks-reports || true
- mkdir all-checks-reports || true
-
- find . -path ./all-checks-reports -prune -o -name "pmd*.html" -exec mkdir -p all-checks-reports/{} \; -exec cp {} all-checks-reports/{}/report.html \;
- find . -path ./all-checks-reports -prune -o -name "checkstyle*.html" -exec mkdir -p all-checks-reports/{} \; -exec cp {} all-checks-reports/{}/report.html \;
- find . -path ./all-checks-reports -prune -o -name "lint-results-*.html" -exec mkdir -p all-checks-reports/{} \; -exec cp {} all-checks-reports/{}/report.html \;
- - uses: actions/upload-artifact@v1.0.0
- if: always()
- with:
- name: checks-reports
- path: all-checks-reports/
-
- heavy-tests:
- runs-on: ubuntu-18.04
- container: menny/ndk_ask:1.13.1
- steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
- - name: setup
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- run: ./scripts/ci/ci_setup.sh
- - name: tests
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- run: |
- ./gradlew --stacktrace :app:testDebugUnitTest --tests="*AllSdkTest*" :app:testDebugUnitTestCoverage
- - name: codecov
- env:
- TERM: dumb
- CODECOV_TOKEN: 1a4cd171-2784-4f48-8a62-0b7ec31e6d7e
- run: |
- curl https://codecov.io/bash -o codecov.sh
- chmod +x codecov.sh
- ./codecov.sh -X gcov -X coveragepy -X xcode `find . -name "test*UnitTestCoverage.xml" | xargs -n 1 echo -n " -f "`
- - name: artifacts
- if: always()
- run: |
- rm -rf all-test-reports || true
- mkdir all-test-reports || true
- find . -path ./all-test-reports -prune -o -name "TEST-*.xml" -exec cp {} all-test-reports/ \;
- - uses: actions/upload-artifact@v1.0.0
- if: always()
- with:
- name: heavy-tests
- path: all-test-reports/
-
- app-normal-tests_1:
- runs-on: ubuntu-18.04
- container: menny/ndk_ask:1.13.1
- steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
- - name: setup
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- run: ./scripts/ci/ci_setup.sh
- - name: tests
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- TEST_GROUP_INDEX: 0
- TEST_GROUPS_COUNT: 2
- run: |
- ./gradlew --stacktrace app:testDebugUnitTest app:testDebugUnitTestCoverage -PexcludeTestClasses="**/*AllSdkTest*"
- - name: codecov
- env:
- TERM: dumb
- CODECOV_TOKEN: 1a4cd171-2784-4f48-8a62-0b7ec31e6d7e
- run: |
- curl https://codecov.io/bash -o codecov.sh
- chmod +x codecov.sh
- ./codecov.sh -X gcov -X coveragepy -X xcode `find . -name "test*UnitTestCoverage.xml" | xargs -n 1 echo -n " -f "`
- - name: artifacts
- if: always()
- run: |
- rm -rf all-test-reports || true
- mkdir all-test-reports || true
- find . -path ./all-test-reports -prune -o -name "TEST-*.xml" -exec cp {} all-test-reports/ \;
- - uses: actions/upload-artifact@v1.0.0
- if: always()
- with:
- name: app-normal-tests_1
- path: all-test-reports/
-
- app-normal-tests_2:
- runs-on: ubuntu-18.04
- container: menny/ndk_ask:1.13.1
- steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
- - name: setup
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- run: ./scripts/ci/ci_setup.sh
- - name: tests
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- TEST_GROUP_INDEX: 1
- TEST_GROUPS_COUNT: 2
- run: |
- ./gradlew --stacktrace app:testDebugUnitTest app:testDebugUnitTestCoverage -PexcludeTestClasses="**/*AllSdkTest*"
- - name: codecov
- env:
- TERM: dumb
- CODECOV_TOKEN: 1a4cd171-2784-4f48-8a62-0b7ec31e6d7e
- run: |
- curl https://codecov.io/bash -o codecov.sh
- chmod +x codecov.sh
- ./codecov.sh -X gcov -X coveragepy -X xcode `find . -name "test*UnitTestCoverage.xml" | xargs -n 1 echo -n " -f "`
- find . -path ./all-test-reports -prune -o -name "TEST-*.xml" -exec cp {} all-test-reports/ \;
- - name: artifacts
- if: always()
- run: |
- rm -rf all-test-reports || true
- mkdir all-test-reports || true
- find . -path ./all-test-reports -prune -o -name "TEST-*.xml" -exec cp {} all-test-reports/ \;
- - uses: actions/upload-artifact@v1.0.0
- if: always()
- with:
- name: app-normal-tests_2
- path: all-test-reports/
-
- non-app-normal-tests:
- runs-on: ubuntu-18.04
- container: menny/ndk_ask:1.13.1
- steps:
- - uses: actions/checkout@v1
- with:
- fetch-depth: 1
- - name: setup
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- run: ./scripts/ci/ci_setup.sh
- - name: tests
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- run: |
- ./gradlew --stacktrace testDebugUnitTest testDebugUnitTestCoverage -x app:testDebugUnitTest -x app:testDebugUnitTestCoverage
- - name: codecov
- env:
- TERM: dumb
- CODECOV_TOKEN: 1a4cd171-2784-4f48-8a62-0b7ec31e6d7e
- run: |
- curl https://codecov.io/bash -o codecov.sh
- chmod +x codecov.sh
- ./codecov.sh -X gcov -X coveragepy -X xcode `find . -name "test*UnitTestCoverage.xml" | xargs -n 1 echo -n " -f "`
- find . -path ./all-test-reports -prune -o -name "TEST-*.xml" -exec cp {} all-test-reports/ \;
- - name: artifacts
- if: always()
- run: |
- rm -rf all-test-reports || true
- mkdir all-test-reports || true
- find . -path ./all-test-reports -prune -o -name "TEST-*.xml" -exec cp {} all-test-reports/ \;
- - uses: actions/upload-artifact@v1.0.0
- if: always()
- with:
- name: non-app-normal-tests
- path: all-test-reports/
-
- pr_audit:
- if: github.event_name == 'pull_request'
- needs: [checks, app-normal-tests_1, app-normal-tests_2, heavy-tests, non-app-normal-tests]
- runs-on: ubuntu-18.04
- steps:
- - name: Success Message
- run: echo "Thank you, ${GITHUB_ACTOR}. ${GITHUB_WORKFLOW} ${GITHUB_EVENT_NAME} verification of ref ${GITHUB_REF} finished successfully!"
-
- deploy:
- if: github.event_name == 'push'
- needs: [checks, app-normal-tests_1, app-normal-tests_2, heavy-tests, non-app-normal-tests]
- runs-on: ubuntu-18.04
- container: menny/ndk_ask:1.13.1
- steps:
- - uses: actions/checkout@v1
- - name: setup
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- run: ./scripts/ci/ci_setup.sh
- - name: deploy
- env:
- TERM: dumb
- GRADLE_OPTS: "-Dorg.gradle.daemon=false"
- RELEASE_BUILD: ${{ contains(github.ref, 'release-branch-v') }}
- KEYSTORE_FILE_URL: ${{ secrets.KEYSTORE_FILE_URL }}
- PUBLISH_CERT_FILE_URL: ${{ secrets.PUBLISH_CERT_FILE_URL }}
- ANYSOFTKEYBOARD_CRASH_REPORT_EMAIL: ${{ secrets.ANYSOFTKEYBOARD_CRASH_REPORT_EMAIL }}
- ANYSOFTKEYBOARD_KEYSTORE_ALIAS: ${{ secrets.ANYSOFTKEYBOARD_KEYSTORE_ALIAS }}
- ANYSOFTKEYBOARD_KEYSTORE_KEY_PASSWORD: ${{ secrets.ANYSOFTKEYBOARD_KEYSTORE_KEY_PASSWORD }}
- ANYSOFTKEYBOARD_KEYSTORE_PASSWORD: ${{ secrets.ANYSOFTKEYBOARD_KEYSTORE_PASSWORD }}
- PUBLISH_APK_SERVICE_ACCOUNT_EMAIL: ${{ secrets.PUBLISH_APK_SERVICE_ACCOUNT_EMAIL }}
- run: |
- echo "This will deploy"
- export BUILD_COUNT_FOR_VERSION=$( git rev-list --count ${GITHUB_REF} -- )
- export BUILD_TYPE="canary"
- if [[ "${RELEASE_BUILD}" == "true" ]] then BUILD_TYPE="release" fi
- echo "Counter is ${BUILD_COUNT_FOR_VERSION}, build-type: ${BUILD_TYPE}, RELEASE_BUILD: ${RELEASE_BUILD}, and crash email: ${ANYSOFTKEYBOARD_CRASH_REPORT_EMAIL}"
diff --git a/.github/workflows/anysoftkeyboard.yml b/.github/workflows/anysoftkeyboard.yml
new file mode 100644
index 000000000..31a75ecc4
--- /dev/null
+++ b/.github/workflows/anysoftkeyboard.yml
@@ -0,0 +1,152 @@
+name: AnySoftKeyboard
+
+on:
+ push:
+ branches:
+ - master
+ - release-branch-v*
+ pull_request:
+ branches:
+ - '*'
+ paths-ignore:
+ - '**.md'
+
+env:
+ TERM: dumb
+ GRADLE_OPTS: "-Dorg.gradle.daemon=false"
+
+jobs:
+ setup:
+ runs-on: ubuntu-18.04
+ container: menny/ndk_ask:1.13.1
+ steps:
+ - uses: actions/checkout@v1
+ with:
+ fetch-depth: 1
+ - name: setup
+ run: |
+ echo "ENV:"
+ printenv
+ echo "******"
+ echo "Event: "
+ cat ${GITHUB_EVENT_PATH}
+ echo "***"
+ ./scripts/ci/ci_setup.sh
+
+ checks:
+ needs: [setup]
+ runs-on: ubuntu-18.04
+ container: menny/ndk_ask:1.13.1
+ steps:
+ - uses: actions/checkout@v1
+ with:
+ fetch-depth: 1
+ - name: check
+ run: ./scripts/ci/ci_check.sh
+ - uses: actions/upload-artifact@v1.0.0
+ with:
+ name: debug-apk
+ path: app/build/outputs/apk/debug/app-debug.apk
+ - uses: ./.github/actions/collect-reports
+ if: always()
+ with:
+ file_pattern: pmd*.html
+ - uses: ./.github/actions/collect-reports
+ if: always()
+ with:
+ file_pattern: checkstyle*.html
+ - uses: ./.github/actions/collect-reports
+ if: always()
+ with:
+ file_pattern: lint-results-*.html
+ - uses: actions/upload-artifact@v1.0.0
+ if: always()
+ with:
+ name: checks-reports
+ path: collected_reports/
+
+ app-tests-shards:
+ needs: [setup]
+ runs-on: ubuntu-18.04
+ container: menny/ndk_ask:1.13.1
+ strategy:
+ matrix:
+ index: [0, 1, 2]
+ fail-fast: false
+ steps:
+ - uses: actions/checkout@v1
+ with:
+ fetch-depth: 1
+ - name: tests
+ uses: ./.github/actions/test-shard-run
+ with:
+ index: ${{ matrix.index }}
+ module: "app:"
+ - uses: ./.github/actions/codecov
+ - uses: ./.github/actions/collect-reports
+ if: always()
+ with:
+ file_pattern: TEST-*.xml
+ - uses: actions/upload-artifact@v1.0.0
+ if: always()
+ with:
+ name: app-tests_${{ matrix.index }}
+ path: collected_reports/
+
+ non-app-tests:
+ needs: [setup]
+ runs-on: ubuntu-18.04
+ container: menny/ndk_ask:1.13.1
+ steps:
+ - uses: actions/checkout@v1
+ with:
+ fetch-depth: 1
+ - name: tests
+ uses: ./.github/actions/test-shard-run
+ with:
+ index: 0
+ groups_count: 1
+ module: ""
+ extra_args: "-x app:testDebugUnitTest -x app:testDebugUnitTestCoverage"
+ - uses: ./.github/actions/codecov
+ - uses: ./.github/actions/collect-reports
+ if: always()
+ with:
+ file_pattern: TEST-*.xml
+ - uses: actions/upload-artifact@v1.0.0
+ if: always()
+ with:
+ name: non-app-tests
+ path: collected_reports/
+
+ pr_audit:
+ if: github.event_name == 'pull_request'
+ needs: [checks, app-tests-shards, non-app-tests]
+ runs-on: ubuntu-18.04
+ steps:
+ - name: Success Message
+ run: echo "Thank you, ${GITHUB_ACTOR}. ${GITHUB_WORKFLOW} ${GITHUB_EVENT_NAME} verification of ref ${GITHUB_REF} finished successfully!"
+
+ deploy:
+ if: github.event_name == 'push'
+ needs: [checks, app-tests-shards, non-app-tests]
+ runs-on: ubuntu-18.04
+ container: menny/ndk_ask:1.13.1
+ steps:
+ - uses: actions/checkout@v1
+ - name: deploy
+ env:
+ RELEASE_BUILD: ${{ contains(github.ref, 'release-branch-v') }}
+ KEYSTORE_FILE_URL: ${{ secrets.KEYSTORE_FILE_URL }}
+ PUBLISH_CERT_FILE_URL: ${{ secrets.PUBLISH_CERT_FILE_URL }}
+ ANYSOFTKEYBOARD_CRASH_REPORT_EMAIL: ${{ secrets.ANYSOFTKEYBOARD_CRASH_REPORT_EMAIL }}
+ ANYSOFTKEYBOARD_KEYSTORE_ALIAS: ${{ secrets.ANYSOFTKEYBOARD_KEYSTORE_ALIAS }}
+ ANYSOFTKEYBOARD_KEYSTORE_KEY_PASSWORD: ${{ secrets.ANYSOFTKEYBOARD_KEYSTORE_KEY_PASSWORD }}
+ ANYSOFTKEYBOARD_KEYSTORE_PASSWORD: ${{ secrets.ANYSOFTKEYBOARD_KEYSTORE_PASSWORD }}
+ PUBLISH_APK_SERVICE_ACCOUNT_EMAIL: ${{ secrets.PUBLISH_APK_SERVICE_ACCOUNT_EMAIL }}
+ run: |
+ echo "This will deploy"
+ export BUILD_COUNT_FOR_VERSION=$( git rev-list --count ${GITHUB_REF} -- )
+ export BUILD_TYPE="canary"
+ if [[ "${RELEASE_BUILD}" == "true" ]] then BUILD_TYPE="release" fi
+ echo "Counter is ${BUILD_COUNT_FOR_VERSION}, build-type: ${BUILD_TYPE}, RELEASE_BUILD: ${RELEASE_BUILD}, and crash email: ${ANYSOFTKEYBOARD_CRASH_REPORT_EMAIL}"