Skip to content

Commit

Permalink
Remove dependency-builder, use ndkports instead. Upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Jan 2, 2024
1 parent 93c8dbd commit a043e99
Show file tree
Hide file tree
Showing 98 changed files with 241 additions and 4,324 deletions.
162 changes: 79 additions & 83 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 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
# Copyright (c) 2021, 2022, 2024 ViliusSutkus89.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -28,15 +24,10 @@ 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
Expand All @@ -51,102 +42,108 @@ permissions:
statuses: none

jobs:
buildLibrary:
build:
if: "!contains(github.event.head_commit.message, '[SkipCI]')"
environment: LibraryKeyAndSonatypeAccess
outputs:
STAGING_REPO_URL: ${{ steps.sonatype.outputs.stagingRepoUrl }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
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
- uses: android-actions/setup-android@v3

- 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
- run: ./gradlew lintRelease publishToMavenLocal

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
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
- uses: actions/upload-artifact@v4
with:
name: maven-local.tar
path: maven-local.tar
name: maven-local
path: ~/.m2
if-no-files-found: error

runInstrumentedTests:
needs: buildLibrary
instrumentedTests-aosp_atd-target:
# Only macos VMs are available with exposed CPU extensions to run hardware accelerated emulator
runs-on: macos-11
runs-on: macos-13
name: android-${{ matrix.api-level }} on ${{ matrix.arch }} (${{ matrix.api-type-target }})
needs: build
strategy:
fail-fast: false
matrix:
api-level: [34, 33, 32, 31, 30]
arch: [x86_64]
api-type-target: [aosp_atd]
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
- api-level: 30
arch: x86
api-type-target: aosp_atd
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- uses: android-actions/setup-android@v2
- uses: android-actions/setup-android@v3

- 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
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
- run: ./ci-scripts/prepareLibraryTestsForStagingRepository wvWare --output=build/lib-staging --repository=${{ needs.buildLibrary.outputs.STAGING_REPO_URL }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: testResults-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.api-type-target }}
path: testResults
if-no-files-found: error

instrumentedTests-default-target:
# Only macos VMs are available with exposed CPU extensions to run hardware accelerated emulator
runs-on: macos-13
name: android-${{ matrix.api-level }} on ${{ matrix.arch }} (${{ matrix.api-type-target }})
needs: build
strategy:
fail-fast: false
matrix:
api-level: [29, 28, 27, 26, 25, 24, 23, 22, 21]
arch: [x86_64, x86]
api-type-target: [default]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- uses: android-actions/setup-android@v3

- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
- 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
Expand All @@ -155,7 +152,6 @@ jobs:
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 &
Expand All @@ -174,9 +170,9 @@ jobs:
test ! -f sorry_but_tests_are_failing
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: testResults-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.api-type-target }}
path: build/lib-staging/testResults
path: testResults
if-no-files-found: error
6 changes: 3 additions & 3 deletions .github/workflows/incrementVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ jobs:
permissions:
# Needed to make a version increment commit
contents: write
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# A branch is required for post release version increment commit
ref: ${{ github.event.ref }}

- run: ./ci-scripts/incrementVersion ${{ github.event.inputs.ARGUMENTS }}
id: version

- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Increment version"
file_pattern: ${{ steps.version.outputs.files }}
62 changes: 23 additions & 39 deletions .github/workflows/fullRelease.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# MIT License
#
# Copyright (c) 2021 - 2022 ViliusSutkus89.com
#
# https://github.com/ViliusSutkus89/Sample_Android_Library-MavenCentral-Instrumented_Tests
# .github/workflows/fullRelease.yml - v2.1.0
# Copyright (c) 2021 - 2024 ViliusSutkus89.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,18 +20,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

name: fullRelease
name: release
on:
workflow_dispatch:
inputs:
STAGING_REPO_URL:
description: 'Provided by privilegedBuild.yml (example: https://oss.sonatype.org/service/local/repositories/comviliussutkus89-????/content/)'
required: true

permissions:
actions: none
checks: none
contents: none
contents: write
deployments: none
issues: none
packages: none
Expand All @@ -45,43 +38,34 @@ permissions:

jobs:
releaseSonatype:
environment: SonatypeAccess
runs-on: ubuntu-20.04
outputs:
ARTIFACTS: ${{ steps.promote.outputs.artifacts }}
steps:
- uses: ViliusSutkus89/promote-Nexus-repository-to-MavenCentral@v1
id: promote
with:
repositoryURL: ${{ github.event.inputs.STAGING_REPO_URL }}
sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}

releaseGitHub:
environment: TenMinuteWait
needs: releaseSonatype
permissions:
# Permission needed to create GitHub release and version increment commit.
contents: write
outputs:
RELEASE_TAG: "v${{ steps.updateDownstreamVersion.outputs.version }}"
runs-on: ubuntu-20.04
environment: LibraryKeyAndSonatypeAccess
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# A branch is required for post release version increment commit
ref: ${{ github.event.ref }}

- uses: ViliusSutkus89/WaitForURLsToBeAvailable@v1
- uses: actions/setup-java@v4
with:
URLs: ${{ needs.releaseSonatype.outputs.ARTIFACTS }}
distribution: temurin
java-version: 17
- uses: android-actions/setup-android@v3

- run: ./gradlew lintRelease publishToMavenLocal

- run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
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 }}

- run: ./ci-scripts/updateDownstreamVersion
id: updateDownstreamVersion

- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update library version in README.md (${{ steps.updateDownstreamVersion.outputs.version }})"
commit_message: "Update version in README.md (${{ steps.updateDownstreamVersion.outputs.version }})"
file_pattern: ${{ steps.updateDownstreamVersion.outputs.files }}

- name: Create GitHub Release
Expand All @@ -95,13 +79,13 @@ jobs:
- run: ./ci-scripts/incrementVersion --patch
id: postReleaseVersionIncrement

- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Post release library version increment to ${{ steps.postReleaseVersionIncrement.outputs.newVersion }} (from ${{ steps.postReleaseVersionIncrement.outputs.oldVersion }})"
file_pattern: ${{ steps.postReleaseVersionIncrement.outputs.files }}

- run: echo -n > UpcomingReleaseNotes.md
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Post release truncation of UpcomingReleaseNotes.md"
file_pattern: UpcomingReleaseNotes.md
Loading

0 comments on commit a043e99

Please sign in to comment.