Skip to content

Commit

Permalink
Merge pull request #80 from neuhalje/feat/migrate-to-gh-actions
Browse files Browse the repository at this point in the history
Add GitHub Actions CI and upgrade Gradle
  • Loading branch information
neuhalje authored Mar 11, 2024
2 parents 65a9bd7 + 8cc0619 commit 42e94c1
Show file tree
Hide file tree
Showing 12 changed files with 334 additions and 187 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches:
- "main"
pull_request:
workflow_dispatch:
concurrency:
group:
${{ github.repository }}-${{ github.workflow }}-${{ github.event.number || github.head_ref || github.run_id || github.sha }}
cancel-in-progress: true
permissions:
contents: write

jobs:
build:
name: Build on ${{ matrix.os }} with Java ${{ matrix.java }}
strategy:
fail-fast: false
matrix:
java: [ 8, 11 ]
os: [ ubuntu-22.04, macos-13 ]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
add-job-summary-as-pr-comment: on-failure
dependency-graph: generate-and-submit
build-scan-publish: true
build-scan-terms-of-service-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-service-agree: "yes"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run build with Gradle wrapper
run: ./gradlew build --stacktrace --warning-mode all
- name: Upload build reports
uses: actions/upload-artifact@v4
if: always()
with:
name: build-reports-${{ matrix.os }}-${{ matrix.java }}
path: build/reports/
- name: Run checks
run: ./gradlew check test integrationTest jacocoTestReport --stacktrace --warning-mode all
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## V 2.x.x (NEXT)

* Enh: Upgrade tooling and migrate to GitHub Actions.

## V 2.3.0 Bugfix Release

This releases fixes a security issue (#50) where encrypted, but not signed archives could be modified.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**Looking for contributors**: *_It's boring to work alone_ - If you are interested in contributing to an open source project please open an issue to discuss your ideas or create a PR*

[![Build Status](https://travis-ci.org/neuhalje/bouncy-gpg.svg?branch=master)](https://travis-ci.org/neuhalje/bouncy-gpg)
[![Build Status](https://github.com/neuhalje/bouncy-gpg/actions/workflows/ci.yaml/badge.svg)](https://github.com/neuhalje/bouncy-gpg/actions/workflows/ci.yaml)
[![codecov](https://codecov.io/gh/neuhalje/bouncy-gpg/branch/master/graph/badge.svg)](https://codecov.io/gh/neuhalje/bouncy-gpg)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/86c099743f8b484c8da833495d7dc209)](https://www.codacy.com/app/neuhalje/bouncy-gpg?utm_source=github.com&utm_medium=referral&utm_content=neuhalje/bouncy-gpg&utm_campaign=Badge_Grade)
[![license](https://img.shields.io/badge/license-APACHE%202.0-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
Expand Down
8 changes: 4 additions & 4 deletions bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def pomConfig = {
}
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
tasks.register('javadocJar', Jar) {
getArchiveClassifier().set("javadoc")
from javadoc
}

task sourcesJar(type: Jar) {
classifier = 'sources'
tasks.register('sourcesJar', Jar) {
getArchiveClassifier().set("sources")
from sourceSets.main.allSource
}

Expand Down
70 changes: 35 additions & 35 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:4.3.1'
}
}

plugins {
id 'java'
id 'java-library'
id 'jacoco'

id 'checkstyle'
id 'pmd'

// required for: website.gradle
id 'org.ajoberstar.git-publish' version '0.3.0'
id 'org.ajoberstar.git-publish'

// deploy to maven central
id 'maven'
id 'maven-publish'
id 'signing'
id "com.jfrog.bintray" version "1.8.4"
id "com.github.ben-manes.versions" version "0.27.0"
id "com.jfrog.bintray"
id "com.github.ben-manes.versions"
id "biz.aQute.bnd.builder"
}

javadoc {
Expand All @@ -31,30 +29,30 @@ javadoc {
}

checkstyle {
toolVersion = "8.1"
toolVersion = "8.24"
showViolations = false
sourceSets = [project.sourceSets.main]
// maxWarnings = 0
}

tasks.withType(Checkstyle) {
tasks.withType(Checkstyle).configureEach {
reports {
xml.enabled true
xml.setRequired(true)
// html.destination rootProject.file("build/reports/checkstyle.html")
// html.stylesheet resources.text.fromFile('config/xsl/checkstyle-custom.xsl')
}
}

jacoco {
toolVersion = "0.8.5"
reportsDir = file("${buildDir}/jacocoHtml")
toolVersion = "0.8.11"
getReportsDirectory().set(file("${buildDir}/jacocoHtml"))
}

jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled true
xml.setRequired(true)
csv.setRequired(true)
html.setRequired(true)
html.destination file("${buildDir}/jacocoHtml")
}
}
Expand Down Expand Up @@ -90,14 +88,14 @@ group = 'name.neuhalfen.projects.crypto.bouncycastle.openpgp'
version = '2.3.0'

repositories {
mavenCentral()
jcenter()
}

sourceSets {
integrationTest {
compileClasspath += sourceSets.main.output \
+ sourceSets.test.output \
+ configurations.testRuntime
+ sourceSets.test.output

runtimeClasspath += output + compileClasspath

Expand All @@ -107,11 +105,17 @@ sourceSets {
}

configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
checkstyle {
// See https://github.com/gradle/gradle/issues/27035
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}
}

task integrationTest(type: Test) {
tasks.register('integrationTest', Test) {
description = 'Runs the integration tests.'
group = LifecycleBasePlugin.VERIFICATION_GROUP
testClassesDirs = sourceSets.integrationTest.output.classesDirs
Expand All @@ -123,20 +127,19 @@ check.dependsOn integrationTest


dependencies {
compile 'org.bouncycastle:bcprov-jdk15on:1.67'
compile 'org.bouncycastle:bcpg-jdk15on:1.67'
implementation 'org.bouncycastle:bcprov-jdk15on:1.67'
implementation 'org.bouncycastle:bcpg-jdk15on:1.67'

compile 'org.slf4j:slf4j-api:1.7.30'
implementation 'org.slf4j:slf4j-api:1.7.30'

// @Nullable and friends are not needed at runtime
compile 'com.google.code.findbugs:jsr305:3.0.2'

testCompile 'junit:junit:4.13'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile 'org.mockito:mockito-core:3.2.4'
testCompile 'org.concordion:concordion-api-documentation-extension:0.0.4'
testCompile 'ch.qos.logback:logback-classic:1.2.3'
implementation 'com.google.code.findbugs:jsr305:3.0.2'

testImplementation 'junit:junit:4.13'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.mockito:mockito-core:3.2.4'
testImplementation 'org.concordion:concordion-api-documentation-extension:0.0.4'
testImplementation 'ch.qos.logback:logback-classic:1.2.3'
}


Expand Down Expand Up @@ -164,8 +167,5 @@ if (hasProperty('bintray_Username')) {
apply from: 'website.gradle'

wrapper {
gradleVersion = '6.5'
gradleVersion = '7.6.2'
}

// Generate OSGI bundle metadata
apply plugin: 'biz.aQute.bnd.builder'
8 changes: 4 additions & 4 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<property name="eachLine" value="true"/>
</module>

<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
Expand All @@ -39,10 +43,6 @@
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 42e94c1

Please sign in to comment.