-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
186 changed files
with
10,567 additions
and
881 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,188 @@ | ||
name: Android CI | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
|
||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
- name: Set up Android SDK License | ||
run: yes | /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew spotlessCheck lint build | ||
|
||
- name: Upload build reports | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: build-reports | ||
path: ./app/build/reports | ||
|
||
unit-test: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
- name: Set up Android SDK License | ||
run: yes | /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew test | ||
|
||
- name: Upload test results | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: unit-test-result | ||
path: "**/build/test-results/**/*.xml" | ||
|
||
connected-test: | ||
runs-on: macOS-latest | ||
needs: build | ||
timeout-minutes: 60 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
- name: Set up Android SDK License | ||
run: yes | /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses | ||
|
||
- name: Apply Signing | ||
if: ${{ github.event_name != 'pull_request' }} | ||
env: | ||
ALIAS: ${{ secrets.ALIAS }} | ||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | ||
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} | ||
run: ./.github/apply_signing.sh | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew spotlessCheck lint bundle assemble --stacktrace | ||
|
||
- name: Upload build outputs | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: build-outputs | ||
path: ./app/build/outputs | ||
|
||
- name: Upload build reports | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: build-reports | ||
path: ./app/build/reports | ||
|
||
- name: Check if is prelease | ||
if: startsWith(github.ref, 'refs/tags/') | ||
id: check-tag | ||
run: | | ||
if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+\-(dev|beta)[0-9]+$ ]]; then | ||
echo ::set-output name=prelease::true | ||
fi | ||
- name: Create Prerelease | ||
if: steps.check-tag.outputs.prelease == 'true' | ||
run: | | ||
set -x | ||
assets=() | ||
for asset in $(find -name *-release.apk); do | ||
assets+=("-a" "$asset") | ||
done | ||
tag_name="${GITHUB_REF##*/}" | ||
hub release create "${assets[@]}" -m "$tag_name" "$tag_name" -p | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Release | ||
if: steps.check-tag.outputs.prelease != 'true' && startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
set -x | ||
assets=() | ||
for asset in $(find -name *-release.apk); do | ||
assets+=("-a" "$asset") | ||
done | ||
tag_name="${GITHUB_REF##*/}" | ||
hub release create "${assets[@]}" -m "$tag_name" "$tag_name" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
strategy: | ||
# Allow tests to continue on other devices if they fail on one device. | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- api-level: 29 | ||
target: default | ||
- api-level: 28 | ||
target: default | ||
- api-level: 26 | ||
target: default | ||
- api-level: 24 | ||
target: default | ||
- api-level: 22 | ||
target: default | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
- name: Set up Android SDK License | ||
run: (while sleep 3; do echo "y"; done) | /Users/runner/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager --licenses | ||
|
||
- name: Build tests | ||
run: ./gradlew assembleAndroidTest | ||
|
||
- name: Run tests | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
timeout-minutes: 40 | ||
with: | ||
api-level: ${{ matrix.api-level }} | ||
profile: 4in WVGA (Nexus S) | ||
target: ${{ matrix.target }} | ||
script: | | ||
adb logcat > logcat.txt & | ||
./gradlew connectedCheck | ||
- name: Upload logs | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: logs-${{ matrix.api-level }}-${{ matrix.target }} | ||
path: logcat.txt | ||
|
||
- name: Upload test results | ||
if: always() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: test-results-${{ matrix.api-level }}-${{ matrix.target }} | ||
path: "**/build/outputs/**/connected/**/*.xml" | ||
|
||
release : | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
needs: [build, unit-test, connected-test] | ||
timeout-minutes: 30 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
- name: Set up Android SDK License | ||
run: yes | /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses | ||
|
||
- name: Apply Signing | ||
env: | ||
ALIAS: ${{ secrets.ALIAS }} | ||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | ||
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} | ||
run: ./.github/apply_signing.sh | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew assembleRelease bundleRelease | ||
|
||
- name: Check if is prelease | ||
if: startsWith(github.ref, 'refs/tags/') | ||
id: check-tag | ||
run: | | ||
if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+\-(dev|beta)[0-9]+$ ]]; then | ||
echo ::set-output name=prelease::true | ||
fi | ||
- name: Create Prerelease | ||
if: steps.check-tag.outputs.prelease == 'true' | ||
run: | | ||
set -x | ||
assets=() | ||
for asset in $(find -name *-release.apk); do | ||
assets+=("-a" "$asset") | ||
done | ||
for asset in $(find -name *-release.aab); do | ||
assets+=("-a" "$asset") | ||
done | ||
tag_name="${GITHUB_REF##*/}" | ||
hub release create "${assets[@]}" -m "$tag_name" "$tag_name" -p | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Release | ||
if: steps.check-tag.outputs.prelease != 'true' | ||
run: | | ||
set -x | ||
assets=() | ||
for asset in $(find -name *-release.apk); do | ||
assets+=("-a" "$asset") | ||
done | ||
for asset in $(find -name *-release.aab); do | ||
assets+=("-a" "$asset") | ||
done | ||
tag_name="${GITHUB_REF##*/}" | ||
hub release create "${assets[@]}" -m "$tag_name" "$tag_name" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.