-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added CI + Bintray releases #402
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8b97f9a
Initial GH Actions workflow
867e386
Bumped Gradle
50f284a
Working on Shipkit integration
5624a10
Enabled Bintray publications
23b53a8
Fixed CI bugs
8744735
Deleted Travis CI
28263af
Debuggability, disabled old Kotlin versions
aebeba6
Removed unused plugin
bc9618f
Bumped Gradle
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,106 @@ | ||
# | ||
# 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 automatically generated after a successful CI build, no need to run CI against them | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
|
||
# | ||
# SINGLE-JOB | ||
# | ||
verify: | ||
runs-on: ubuntu-latest | ||
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" | ||
|
||
steps: | ||
|
||
- name: 1. Check out code | ||
uses: actions/checkout@v2 # https://github.com/actions/checkout | ||
|
||
- name: 2. Set up Java 8 | ||
uses: actions/setup-java@v1 # https://github.com/actions/setup-java | ||
with: | ||
java-version: 8 | ||
|
||
- name: 3. Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 # https://github.com/gradle/wrapper-validation-action | ||
|
||
# | ||
# Main build job | ||
# | ||
build: | ||
needs: [verify] | ||
runs-on: ubuntu-latest | ||
|
||
# Definition of the build matrix | ||
strategy: | ||
matrix: | ||
mock-maker: ['mock-maker-default', 'mock-maker-inline'] | ||
kotlin: ['1.3.50', '1.4.21'] | ||
# Note that the old Travis CI referenced other Kotlin versions: '1.0.7', '1.1.61', '1.2.50' | ||
# However, those versions of Kotlin don't work with latest Gradle | ||
|
||
steps: | ||
|
||
- name: 1. Check out code | ||
uses: actions/checkout@v2 # https://github.com/actions/checkout | ||
|
||
- name: 2. Set up Java 8 | ||
uses: actions/setup-java@v1 # https://github.com/actions/setup-java | ||
with: | ||
java-version: 8 | ||
|
||
- name: 3. Build with Kotlin ${{ matrix.kotlin }} and mock-maker ${{ matrix.mock-maker }} | ||
run: | | ||
ops/mockMakerInline.sh | ||
./gradlew build bintrayUpload -PbintrayDryRun | ||
env: | ||
KOTLIN_VERSION: ${{ matrix.kotlin }} | ||
MOCK_MAKER: ${{ matrix.mock-maker }} | ||
|
||
# | ||
# Release job, only for pushes to the main development branch | ||
# | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: [build] # build job must pass before we can release | ||
|
||
if: github.event_name == 'push' | ||
&& github.ref == 'refs/heads/main' | ||
&& github.repository == 'mockito/mockito-kotlin' | ||
&& !contains(toJSON(github.event.commits.*.message), '[skip release]') | ||
|
||
steps: | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 # https://github.com/actions/checkout | ||
with: | ||
fetch-depth: '0' # https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci | ||
|
||
- name: Set up Java 8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
|
||
- name: Build and publish to Bintray/MavenCentral | ||
run: ./gradlew tasks # TODO, in progress: bintrayUpload githubRelease | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
# BINTRAY_API_KEY: ${{secrets.BINTRAY_API_KEY}} | ||
# NEXUS_TOKEN_USER: ${{secrets.NEXUS_TOKEN_USER}} | ||
# NEXUS_TOKEN_PWD: ${{secrets.NEXUS_TOKEN_PWD}} | ||
|
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
buildscript { | ||
repositories { | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
} | ||
dependencies { | ||
classpath "io.spring.gradle:spring-bintray-plugin:0.11.1" | ||
} | ||
plugins { | ||
id "org.shipkit.shipkit-auto-version" version "1.1.1" | ||
id "org.shipkit.shipkit-changelog" version "1.1.1" | ||
id "org.shipkit.shipkit-github-release" version "1.1.1" | ||
} | ||
|
||
plugins { | ||
id 'com.github.ben-manes.versions' version '0.20.0' | ||
tasks.named("generateChangelog") { | ||
previousRevision = project.ext.'shipkit-auto-version.previous-tag' | ||
githubToken = System.getenv("GITHUB_TOKEN") | ||
repository = "mockito/mockito-kotlin" | ||
} | ||
|
||
apply from: 'gradle/scripts/tagging.gradle' | ||
tasks.named("githubRelease") { | ||
def genTask = tasks.named("generateChangelog").get() | ||
dependsOn genTask | ||
repository = genTask.repository | ||
changelog = genTask.outputFile | ||
githubToken = System.getenv("GITHUB_TOKEN") | ||
newTagRevision = System.getenv("GITHUB_SHA") | ||
} | ||
|
||
println ext.versionName |
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,101 @@ | ||
apply plugin: 'maven-publish' | ||
|
||
//TODO: update the group to 'org.mockito' ***AND*** change java packages | ||
group = 'com.nhaarman.mockitokotlin2' | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from 'build/javadoc' | ||
} | ||
|
||
task sourceJar(type: Jar) { | ||
from sourceSets.main.allSource | ||
} | ||
|
||
publishing { | ||
publications { | ||
javaLibrary(MavenPublication) { | ||
artifactId 'mockito-kotlin' | ||
|
||
from components.java | ||
|
||
artifact sourceJar { | ||
classifier "sources" | ||
} | ||
|
||
artifact javadocJar | ||
|
||
pom.withXml { | ||
def root = asNode() | ||
root.appendNode('name', 'Mockito-Kotlin') | ||
root.appendNode('description', 'Using Mockito with Kotlin.') | ||
root.appendNode('url', 'https://github.com/mockito/mockito-kotlin') | ||
|
||
def scm = root.appendNode('scm') | ||
scm.appendNode('url', 'scm:[email protected]:mockito/mockito-kotlin.git') | ||
|
||
def licenses = root.appendNode('licenses') | ||
def mitLicense = licenses.appendNode('license') | ||
mitLicense.appendNode('name', 'MIT') | ||
|
||
def developers = root.appendNode('developers') | ||
def nhaarman = developers.appendNode('developer') | ||
nhaarman.appendNode('id', 'nhaarman') | ||
nhaarman.appendNode('name', 'Niek Haarman') | ||
} | ||
} | ||
} | ||
|
||
//useful for testing - running "publish" will create artifacts/pom in a local dir | ||
repositories { maven { url = "$rootProject.buildDir/repo" } } | ||
} | ||
|
||
clean { | ||
delete "$rootProject.buildDir/repo" | ||
} | ||
|
||
// Avoid generation of the module metadata so that we don't have to publish an additional file | ||
// and keep the build logic simple. | ||
tasks.withType(GenerateModuleMetadata) { | ||
enabled = false | ||
} | ||
|
||
//fleshes out problems with Maven pom generation when building | ||
tasks.build.dependsOn('publishJavaLibraryPublicationToMavenLocal') | ||
|
||
//Bintray Gradle plugin configuration (https://github.com/bintray/gradle-bintray-plugin) | ||
//Plugin jars are added to the buildscript classpath in the root build.gradle file | ||
apply plugin: 'com.jfrog.bintray' | ||
|
||
bintray { | ||
//We need to use some user id here, because the Bintray key is associated with the user | ||
//However, any user id is good, so longer the user has necessary privileges to the repository | ||
user = 'szczepiq' //https://bintray.com/szczepiq | ||
key = System.getenv('BINTRAY_API_KEY') | ||
publish = false //can be changed to 'false' for testing | ||
dryRun = project.hasProperty('bintrayDryRun') | ||
|
||
publications = ['javaLibrary'] | ||
|
||
pkg { | ||
repo = 'test' //https://bintray.com/mockito/maven // TODO change to 'maaven' when CI ready | ||
userOrg = 'mockito' //https://bintray.com/mockito | ||
|
||
name = 'mockito-kotlin' | ||
|
||
licenses = ['MIT'] | ||
labels = ['kotlin', 'mockito'] | ||
vcsUrl = 'https://github.com/mockito/mockito-kotlin.git' | ||
|
||
version { | ||
name = project.version | ||
vcsTag = "v$project.version" | ||
|
||
mavenCentralSync { | ||
sync = false // TODO enable after CI+bintray integration is ready | ||
user = System.getenv('NEXUS_TOKEN_USER') | ||
password = System.getenv('NEXUS_TOKEN_PWD') | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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,6 +1,5 @@ | ||
#Mon Oct 29 21:53:52 CET 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work.
Minor: Gradle 6.8.1 was released last week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1