Skip to content

NDK26 has stricter default compiler errors. Disable incompatible-func… #118

NDK26 has stricter default compiler errors. Disable incompatible-func…

NDK26 has stricter default compiler errors. Disable incompatible-func… #118

Workflow file for this run

# MIT License
#
# Copyright (c) 2021 - 2022 ViliusSutkus89.com
#
# https://github.com/ViliusSutkus89/Sample_Android_Library-MavenCentral-Instrumented_Tests
# .github/workflows/build.yml - v2.2.0
# Renamed from .github/workflows/privilegedBuild.yml
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: build
on:
workflow_dispatch:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '.github/**'
- '!.github/workflows/build.yml'
- 'licenseOnly/**'
env:
TARBALL_CACHE_KEY: "tarballs-key-3"
permissions:
actions: none
checks: none
contents: none
deployments: none
issues: none
packages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
jobs:
buildLibrary:
if: "!contains(github.event.head_commit.message, '[SkipCI]')"
environment: LibraryKeyAndSonatypeAccess
outputs:
STAGING_REPO_URL: ${{ steps.sonatype.outputs.stagingRepoUrl }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: android-actions/setup-android@v2
# ninja is required to build projects, using meson build system
- run: pip3 install --user meson ninja
- name: Cache tarballs
uses: actions/cache@v3
with:
key: ${{ env.TARBALL_CACHE_KEY }}
path: dependency-builder/src/main/cpp/tarballs
- run: ./dodownloadtarballs --serial
- run: ./gradlew lintRelease publishToMavenLocal publishToSonatype closeSonatypeStagingRepository | tee publishToSonatype.log
# bash has pipefail on by default, which is needed for tee to fail, if gradle fails
shell: bash
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASS: ${{ secrets.SIGNING_PASS }}
- name: Parse Sonatype repository
id: sonatype
# publishToSonatype.log contains a line looking like this:
# Created staging repository 'comviliussutkus89-1055' at https://oss.sonatype.org/service/local/repositories/comviliussutkus89-1055/content/
run: perl -ne 'print "::set-output name=stagingRepoUrl::$2\n::warning ::$1\n" if /^(Created staging repository .+ at (.+))$/' < publishToSonatype.log
- uses: actions/upload-artifact@v3
if: always()
with:
name: dependencyBuildLogs
path: |
dependency-builder/.cxx/**/*-download-*.log
dependency-builder/.cxx/**/*-configure-*.log
dependency-builder/.cxx/**/*-build-*.log
dependency-builder/.cxx/**/*-install-*.log
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: library-lint-report
path: wvWare/build/reports/lint-results-release.html
if-no-files-found: error
- run: tar -cvf maven-local.tar ~/.m2
- uses: actions/upload-artifact@v3
with:
name: maven-local.tar
path: maven-local.tar
if-no-files-found: error
runInstrumentedTests:
needs: buildLibrary
# Only macos VMs are available with exposed CPU extensions to run hardware accelerated emulator
runs-on: macos-11
strategy:
fail-fast: false
matrix:
include:
# Oldest x86_64 image
- arch: x86_64
api-level: 21
api-type-target: default
# Latest x86 image
- arch: x86
api-level: 30
api-type-target: google_apis
# Latest image
- arch: x86_64
api-level: 33
api-type-target: google_apis
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: android-actions/setup-android@v2
- run: ./ci-scripts/prepareLibraryTestsForStagingRepository wvWare --output=build/lib-staging --repository=${{ needs.buildLibrary.outputs.STAGING_REPO_URL }}
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot-save
api-level: ${{ matrix.api-level }}
arch: ${{ matrix.arch }}
target: ${{ matrix.api-type-target }}
sdcard-path-or-size: 1G
disk-size: 8G
working-directory: build/lib-staging
script: |
mkdir -p testResults/screenshots
adb logcat > testResults/logcat.txt &
adb shell screencap /data/local/tmp/beforeTests.png
adb pull /data/local/tmp/beforeTests.png testResults/screenshots/
./gradlew connectedCheck || touch sorry_but_tests_are_failing
adb pull /sdcard/Pictures/screenshots testResults/ || true
adb shell screencap /data/local/tmp/afterTests.png
adb pull /data/local/tmp/afterTests.png testResults/screenshots/
mv wvWare/build/reports/androidTests/connected testResults/
mv wvWare/build/outputs/androidTest-results testResults/
test ! -f sorry_but_tests_are_failing
- uses: actions/upload-artifact@v3
if: always()
with:
name: testResults-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.api-type-target }}
path: build/lib-staging/testResults
if-no-files-found: error