Skip to content

Commit

Permalink
Merge pull request #112 from overheadhunter/gh-actions
Browse files Browse the repository at this point in the history
Migrated to GitHub Actions
  • Loading branch information
vvatanabe committed Apr 3, 2022
2 parents aa11a77 + ad594bd commit 6392d89
Show file tree
Hide file tree
Showing 7 changed files with 275 additions and 204 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build

on:
[push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['8', '11', '17']
fail-fast: false
name: Build and test on JDK ${{ matrix.Java }}
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'gradle'
- name: Run gradle
run: ./gradlew jacocoTestReport coveralls publishToMavenLocal --no-daemon
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

120 changes: 53 additions & 67 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,41 +1,31 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.saliman:gradle-cobertura-plugin:2.6.1' // cobertura plugin
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.4.0'
}
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.12.0'
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'net.saliman.cobertura'
apply plugin: 'com.github.kt3k.coveralls'

apply from: 'dictionary.gradle'

group = 'com.nulab-inc'
version = '1.5.2'
archivesBaseName = 'zxcvbn'
sourceCompatibility = 1.7
targetCompatibility = 1.7
ext.moduleName = 'com.nulabinc.zxcvbn'
ext.isReleaseVersion = !version.endsWith('SNAPSHOT')

wrapper {
gradleVersion = '5.5'
gradleVersion = '7.2'
}

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.13.2'
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
}

cobertura.coverageFormats = ['html', 'xml'] // coveralls plugin depends on xml format report

javadoc {
options.locale = 'en_US'
title = 'zxcvbn4j ' + version + ' API'
Expand All @@ -55,85 +45,73 @@ jar {
inputs.property("moduleName", moduleName)

manifest {
attributes 'Implementation-Title': archivesBaseName, 'Implementation-Version': version, 'Automatic-Module-Name': moduleName
attributes 'Implementation-Title': archivesBaseName, 'Implementation-Version': archiveVersion, 'Automatic-Module-Name': moduleName
}
}

task sourceJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allJava
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourceJar, javadocJar
java {
withJavadocJar()
withSourcesJar()
}

configurations {
deployerJars
}

if (project.hasProperty("signing.keyId")) {
apply plugin: 'signing'

signing {
// Skip signing snapshot archives
if (System.env.TRAVIS || version.endsWith("-SNAPSHOT")) return
if (System.env.GITHUB_ACTIONS || !isReleaseVersion) return

sign configurations.archives
sign publishing.publications.mavenJava
}
}

def ossrhUsername = hasProperty('ossrhUsername') ? ossrhUsername : ''
def ossrhPassword = hasProperty('ossrhPassword') ? ossrhPassword : ''

uploadArchives {
// Skip uploading production archives when travis
if (System.env.TRAVIS && !version.endsWith("-SNAPSHOT")) return

publishing {
repositories {
mavenDeployer {
beforeDeployment {
MavenDeployment deployment -> if (!version.endsWith("-SNAPSHOT")) { signing.signPom(deployment) }
}

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
maven {
// Skip uploading production archives when using github actions
if (System.env.GITHUB_ACTIONS && isReleaseVersion) return

def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
url = isReleaseVersion ? releasesRepoUrl : snapshotsRepoUrl
credentials {
username = project.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user'
password = project.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password'
}
}
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
publications {
mavenJava(MavenPublication) {
from components.java

pom.project {
name 'zxcvbn4j'
artifactId archivesBaseName
packaging 'jar'
description 'This is a java port of zxcvbn, which is a JavaScript password strength generator.'
url 'https://github.com/nulab/zxcvbn4j'
pom {
name = 'zxcvbn4j'
artifactId = archivesBaseName
packaging = 'jar'
description = 'This is a java port of zxcvbn, which is a JavaScript password strength generator.'
url = 'https://github.com/nulab/zxcvbn4j'

scm {
connection 'https://github.com/nulab/zxcvbn4j.git'
developerConnection 'https://github.com/nulab/zxcvbn4j.git'
url 'https://github.com/nulab/zxcvbn4j.git'
connection = 'https://github.com/nulab/zxcvbn4j.git'
developerConnection = 'https://github.com/nulab/zxcvbn4j.git'
url = 'https://github.com/nulab/zxcvbn4j.git'
}

licenses {
license {
name 'MIT License'
url 'http://www.opensource.org/licenses/mit-license.php'
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
}
}

developers {
developer {
id 'vvatanabe'
name 'Yuichi Watanabe'
email 'yuichi.watanabe@nulab-inc.com'
id = 'vvatanabe'
name = 'Yuichi Watanabe'
email = 'yuichi.watanabe@nulab-inc.com'
}
}
}
Expand All @@ -146,3 +124,11 @@ test {
forkEvery = 4
testLogging.showStandardStreams = true
}

jacocoTestReport {
dependsOn test
reports {
xml.required = true // coveralls plugin depends on xml format report
html.required = true
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Mar 30 18:39:50 JST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
Loading

0 comments on commit 6392d89

Please sign in to comment.