-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade Shipkit and Gradle, and move off JCenter (#8)
* Upgraded to Shipkit 3.0 and Gradle 6.x * Moved to GH Actions from Travis CI * Added the ability to publish to LinkedIn Artifactory and Maven Central directly
- Loading branch information
1 parent
5d5c758
commit 652fcda
Showing
10 changed files
with
325 additions
and
109 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,86 @@ | ||
# CI build that assembles artifacts and runs tests. | ||
# If validation is successful this workflow releases from the main dev branch. | ||
# | ||
# - skipping CI: add [skip ci] to the commit message | ||
# - skipping release: add [skip release] to the commit message | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
tags-ignore: [v*] # release tags are autogenerated after a successful CI, no need to run CI against them | ||
paths-ignore: | ||
- 'docs/**' | ||
- '**.md' | ||
pull_request: | ||
branches: ['**'] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- scala-version: 2.11.8 | ||
spark-version: 2.3.0 | ||
- scala-version: 2.11.8 | ||
spark-version: 2.4.3 | ||
- scala-version: 2.12.11 | ||
spark-version: 2.4.3 | ||
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" | ||
steps: | ||
- name: Check out code | ||
# https://github.com/actions/checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
# Needed to get all tags. Refer https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci | ||
fetch-depth: '0' | ||
- name: Setup Java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Build and test code, and test artifact publishing | ||
run: ./gradlew build publishToMavenLocal artifactoryPublishAll -s -Partifactory.dryRun -PscalaVersion=$SCALA_VERSION -PsparkVersion=$SPARK_VERSION | ||
env: | ||
SCALA_VERSION: ${{ matrix.scala-version }} | ||
SPARK_VERSION: ${{ matrix.spark-version }} | ||
- name: Release to Maven Central and LinkedIn Artifactory | ||
# Release job, only for pushes to the main development branch | ||
if: github.event_name == 'push' | ||
&& github.ref == 'refs/heads/main' | ||
&& github.repository == 'linkedin/LiFT' | ||
&& !contains(toJSON(github.event.commits.*.message), '[skip release]') | ||
run: ./gradlew publishToSonatype closeAndReleaseStagingRepository artifactoryPublishAll -s -PscalaVersion=$SCALA_VERSION -PsparkVersion=$SPARK_VERSION | ||
env: | ||
SCALA_VERSION: ${{ matrix.scala-version }} | ||
SPARK_VERSION: ${{ matrix.spark-version }} | ||
SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | ||
SONATYPE_PWD: ${{ secrets.SONATYPE_PWD }} | ||
PGP_KEY: ${{ secrets.PGP_KEY }} | ||
PGP_PWD: ${{ secrets.PGP_PWD }} | ||
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} | ||
ARTIFACTORY_KEY: ${{ secrets.ARTIFACTORY_KEY }} | ||
github-release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
# Release job, only for pushes to the main development branch | ||
if: github.event_name == 'push' | ||
&& github.ref == 'refs/heads/main' | ||
&& github.repository == 'linkedin/LiFT' | ||
&& !contains(toJSON(github.event.commits.*.message), '[skip release]') | ||
steps: | ||
- name: Check out code | ||
# https://github.com/actions/checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
# Needed to get all tags. Refer https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci | ||
fetch-depth: '0' | ||
- name: Setup Java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- name: Release | ||
run: ./gradlew githubRelease -s | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
plugins { | ||
id "org.shipkit.java" version "2.3.4" | ||
buildscript { | ||
repositories { | ||
mavenLocal() // for local testing | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
} | ||
dependencies { | ||
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.+" | ||
classpath "io.github.gradle-nexus:publish-plugin:1.+" | ||
classpath "org.shipkit:shipkit-auto-version:1.+" | ||
classpath "org.shipkit:shipkit-changelog:1.+" | ||
} | ||
} | ||
|
||
apply from: "gradle/release.gradle" | ||
|
||
allprojects { | ||
apply plugin: "eclipse" | ||
apply plugin: "idea" | ||
|
||
group = "com.linkedin.lift" | ||
|
||
repositories { | ||
jcenter() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete "build" | ||
} |
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,116 @@ | ||
assert plugins.hasPlugin(JavaPlugin) | ||
|
||
tasks.withType(Jar) { | ||
from "$rootDir/LICENSE" | ||
from "$rootDir/NOTICE" | ||
} | ||
|
||
// Auxiliary jar files required by Maven module publications | ||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
artifacts { | ||
archives sourcesJar | ||
archives javadocJar | ||
} | ||
|
||
apply plugin: "maven-publish" // https://docs.gradle.org/current/userguide/publishing_maven.html | ||
publishing { | ||
publications { | ||
liftJar(MavenPublication) { | ||
from components.java | ||
artifact sourcesJar | ||
artifact javadocJar | ||
|
||
artifactId = project.archivesBaseName | ||
|
||
pom { | ||
name = artifactId | ||
description = "A Scala/Spark library that enables the measurement of fairness in large scale machine learning workflows." | ||
url = "https://github.com/linkedin/LiFT" | ||
licenses { | ||
license { | ||
name = 'BSD 2-CLAUSE' | ||
url = 'https://github.com/linkedin/LiFT/blob/master/LICENSE' | ||
distribution = 'repo' | ||
} | ||
} | ||
developers { | ||
[ | ||
'sriramvasudevan:Sriram Vasudevan' | ||
].each { devData -> | ||
developer { | ||
def devInfo = devData.split(':') | ||
id = devInfo[0] | ||
name = devInfo[1] | ||
url = 'https://github.com/' + devInfo[0] | ||
roles = ["Core developer"] | ||
} | ||
} | ||
} | ||
scm { | ||
url = 'https://github.com/linkedin/LiFT.git' | ||
} | ||
issueManagement { | ||
url = 'https://github.com/linkedin/LiFT/issues' | ||
system = 'GitHub issues' | ||
} | ||
ciManagement { | ||
url = 'https://travis-ci.com/linkedin/LiFT' | ||
system = 'Travis CI' | ||
} | ||
} | ||
} | ||
} | ||
|
||
//useful for testing - running "publish" will create artifacts/pom in a local dir | ||
repositories { maven { url = "$rootProject.buildDir/repo" } } | ||
} | ||
|
||
//fleshes out problems with Maven pom generation when building | ||
tasks.build.dependsOn("publishLiftJarPublicationToMavenLocal") | ||
|
||
apply plugin: 'signing' //https://docs.gradle.org/current/userguide/signing_plugin.html | ||
signing { | ||
if (System.getenv("PGP_KEY")) { | ||
useInMemoryPgpKeys(System.getenv("PGP_KEY"), System.getenv("PGP_PWD")) | ||
sign publishing.publications.liftJar | ||
} | ||
} | ||
|
||
////////////////////////////////// | ||
// LinkedIn Artifactory Config | ||
////////////////////////////////// | ||
|
||
apply plugin: "com.jfrog.artifactory" //https://www.jfrog.com/confluence/display/rtf/gradle+artifactory+plugin | ||
artifactory { | ||
contextUrl = 'https://linkedin.jfrog.io/artifactory' | ||
publish { | ||
repository { | ||
repoKey = 'LiFT' | ||
username = System.getenv('ARTIFACTORY_USER') | ||
password = System.getenv('ARTIFACTORY_KEY') | ||
maven = true | ||
} | ||
|
||
defaults { | ||
publications('liftJar') | ||
publishBuildInfo = true | ||
publishArtifacts = true | ||
publishPom = true | ||
publishIvy = true | ||
} | ||
} | ||
clientConfig.setIncludeEnvVars(false) | ||
} | ||
|
||
artifactoryPublish { | ||
skip = project.hasProperty('artifactory.dryRun') | ||
} |
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,83 @@ | ||
//Plugin jars are added to the buildscript classpath in the root build.gradle file | ||
|
||
////////////////////////////////// | ||
// Token Verification Tasks | ||
////////////////////////////////// | ||
|
||
task checkGitHubToken { | ||
doFirst { | ||
if (System.getenv("GITHUB_TOKEN") == null) { | ||
throw new Exception("Environment variable GITHUB_TOKEN not set."); | ||
} | ||
println "Using repository " + System.getenv("GITHUB_REPOSITORY") | ||
} | ||
} | ||
|
||
task verifyArtifactoryProperties { | ||
doFirst { | ||
if (!project.hasProperty('artifactory.dryRun')) { | ||
if (System.getenv('ARTIFACTORY_USER') == null) { | ||
throw new Exception("Environment variable ARTIFACTORY_USER not set."); | ||
} | ||
if (System.getenv('ARTIFACTORY_KEY') == null) { | ||
throw new Exception("Environment variable ARTIFACTORY_KEY not set."); | ||
} | ||
} | ||
} | ||
} | ||
|
||
////////////////////////////////// | ||
// Shipkit Tasks | ||
////////////////////////////////// | ||
|
||
apply plugin: "org.shipkit.shipkit-auto-version" //https://github.com/shipkit/shipkit-auto-version | ||
|
||
apply plugin: "org.shipkit.shipkit-changelog" //https://github.com/shipkit/shipkit-changelog | ||
tasks.named("generateChangelog") { | ||
dependsOn checkGitHubToken | ||
previousRevision = project.ext.'shipkit-auto-version.previous-tag' | ||
githubToken = System.getenv("GITHUB_TOKEN") | ||
repository = "linkedin/LiFT" | ||
} | ||
|
||
apply plugin: "org.shipkit.shipkit-github-release" //https://github.com/shipkit/shipkit-changelog | ||
tasks.named("githubRelease") { | ||
def genTask = tasks.named("generateChangelog").get() | ||
dependsOn genTask | ||
dependsOn checkGitHubToken | ||
repository = genTask.repository | ||
changelog = genTask.outputFile | ||
githubToken = System.getenv("GITHUB_TOKEN") | ||
newTagRevision = System.getenv("GITHUB_SHA") | ||
} | ||
|
||
////////////////////////////////// | ||
// Maven Central Config | ||
////////////////////////////////// | ||
|
||
apply plugin: "io.github.gradle-nexus.publish-plugin" //https://github.com/gradle-nexus/publish-plugin/ | ||
nexusPublishing { | ||
repositories { | ||
if (System.getenv("SONATYPE_PWD")) { | ||
sonatype { | ||
username = System.getenv("SONATYPE_USER") | ||
password = System.getenv("SONATYPE_PWD") | ||
} | ||
} | ||
} | ||
} | ||
|
||
////////////////////////////////// | ||
// Additional Release Tasks | ||
////////////////////////////////// | ||
|
||
task artifactoryPublishAll { | ||
description = "Runs 'artifactoryPublish' tasks from all projects" | ||
} | ||
|
||
allprojects { | ||
tasks.matching { it.name == "artifactoryPublish" }.all { | ||
it.dependsOn verifyArtifactoryProperties | ||
artifactoryPublishAll.dependsOn it | ||
} | ||
} |
Oops, something went wrong.