-
Notifications
You must be signed in to change notification settings - Fork 12
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
29 changed files
with
846 additions
and
269 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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: Build Java Pinning | ||
|
||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: | ||
java: | ||
- 17 | ||
- 21 | ||
env: | ||
PRIMARY_JAVA_VERSION: 21 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
|
||
# Caches | ||
- name: Cache Maven | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: maven-${{ hashFiles('**/build.gradle') }} | ||
restore-keys: | | ||
maven- | ||
- name: Cache Gradle | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.gradle/caches | ||
key: gradle-caches-${{ hashFiles('**/build.gradle') }} | ||
restore-keys: | ||
gradle-caches | ||
- name: Cache Android SDK | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.android/sdk | ||
key: android-${{ hashFiles('build.gradle') }} | ||
restore-keys: | | ||
android- | ||
# Pre-reqs | ||
- name: Install Android SDK Manager | ||
uses: android-actions/setup-android@v2 | ||
- name: Install Android SDK | ||
run: | | ||
sdkmanager "platforms;android-15" "platforms;android-30" | ||
# Testing | ||
- name: Gradle Check | ||
run: ./gradlew check --stacktrace | ||
|
||
# Test local publish | ||
- name: Gradle publish | ||
run: ./gradlew publishToMavenLocal --stacktrace | ||
|
||
# Javadoc | ||
- name: Javadoc | ||
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }} | ||
run: ./gradlew javadocAll --stacktrace | ||
|
||
# Test Coverage Report | ||
- name: Jacoco Test Coverage | ||
run: ./gradlew java-pinning-java11:testCodeCoverageReport | ||
|
||
# Coveralls | ||
- name: Report coverage stats to Coveralls | ||
if: ${{ matrix.java == env.PRIMARY_JAVA_VERSION }} | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
format: jacoco | ||
file: java-pinning-java11/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml | ||
|
||
# Upload build artifacts | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: java-pinning-java-${{ matrix.java }} | ||
path: | | ||
java-pinning-*/build/libs/*.jar | ||
!**/*-test-fixtures.jar | ||
!**/*-tests.jar |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
GRADLE ?= ./gradlew | ||
|
||
.PHONY: all | ||
all: check codecov eclipse javadocAll show-dependency-updates | ||
|
||
.PHONY: codecov | ||
codecov: | ||
$(GRADLE) java-pinning-java11:testCodeCoverageReport | ||
echo "Code coverage report available at file://$(PWD)/java-pinnging-java11/build/reports/jacoco/testCodeCoverageReport/html/index.html" | ||
|
||
.PHONY: check | ||
check: | ||
$(GRADLE) $@ | ||
|
||
.PHONY: eclipse | ||
eclipse: | ||
$(GRADLE) $@ | ||
|
||
.PHONY: javadocAll | ||
javadocAll: | ||
$(GRADLE) $@ | ||
echo "javadoc available at file://$(PWD)/build/javadoc/index.html" | ||
|
||
.PHONY: show-dependency-updates | ||
show-dependency-updates: | ||
$(GRADLE) dependencyUpdates |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
plugins { | ||
id 'groovy-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
google() | ||
} | ||
|
||
dependencies { | ||
implementation "biz.aQute.bnd:biz.aQute.bnd.gradle:7.0.0" | ||
implementation "net.ltgt.gradle:gradle-errorprone-plugin:4.0.1" | ||
implementation "ru.vyarus:gradle-animalsniffer-plugin:1.7.1" | ||
implementation "com.github.ben-manes:gradle-versions-plugin:0.51.0" | ||
implementation 'com.android.tools.build:gradle:8.7.0' | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'javapinning-build-logic' |
11 changes: 11 additions & 0 deletions
11
build-logic/src/main/groovy/eu.geekplace.javapinning.android-conventions.gradle
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
plugins { | ||
id 'ru.vyarus.animalsniffer' | ||
id 'eu.geekplace.javapinning.common-conventions' | ||
} | ||
|
||
dependencies { | ||
signature "net.sf.androidscents.signature:android-api-level-${minAndroidSdk}:4.0.3_r5@signature" | ||
} | ||
animalsniffer { | ||
sourceSets = [sourceSets.main] | ||
} |
37 changes: 37 additions & 0 deletions
37
build-logic/src/main/groovy/eu.geekplace.javapinning.common-conventions.gradle
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
ext { | ||
javaVersion = JavaVersion.VERSION_11 | ||
javaMajor = javaVersion.getMajorVersion() | ||
minAndroidSdk = 15 | ||
|
||
androidBootClasspath = getAndroidRuntimeJar(minAndroidSdk) | ||
|
||
// Export the function by turning it into a closure. | ||
// https://stackoverflow.com/a/23290820/194894 | ||
getAndroidRuntimeJar = this.&getAndroidRuntimeJar | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
mavenLocal() | ||
} | ||
|
||
def getAndroidRuntimeJar(androidApiLevel) { | ||
def androidHome = getAndroidHome() | ||
def androidJar = new File("$androidHome/platforms/android-${androidApiLevel}/android.jar") | ||
if (androidJar.isFile()) { | ||
return androidJar | ||
} else { | ||
throw new Exception("Can't find android.jar for API level ${androidApiLevel}. Please install corresponding SDK platform package") | ||
} | ||
} | ||
|
||
def getAndroidHome() { | ||
def androidHomeEnv = System.getenv("ANDROID_HOME") | ||
if (androidHomeEnv == null) { | ||
throw new Exception("ANDROID_HOME environment variable is not set") | ||
} | ||
def androidHome = new File(androidHomeEnv) | ||
if (!androidHome.isDirectory()) throw new Exception("Environment variable ANDROID_HOME is not pointing to a directory") | ||
return androidHome | ||
} |
Oops, something went wrong.