Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Update build
Browse files Browse the repository at this point in the history
This commit udates the gradle build. More in details:
- Update Gradle to version 7.6
- Update Nextflow runtime to version 22.10.x
- Update Groovy runtime to version 3.0.14
- Fixed some failing tests
- Update Java min version to 11
- Update GitHub action build

Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Jan 15, 2023
1 parent b09fb65 commit 0a1718e
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 43 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,25 @@ jobs:
strategy:
fail-fast: false
matrix:
java_version: [8, 11]
java_version: [11, 17]

steps:
- name: Environment
run: env | sort

- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true

- name: Setup Java ${{ matrix.java_version }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{matrix.java_version}}
distribution: 'adopt'
architecture: x64
cache: gradle

- name: Compile
run: ./gradlew assemble
Expand All @@ -43,10 +45,10 @@ jobs:
env:
GRADLE_OPTS: '-Dorg.gradle.daemon=false'

- name: Publish
- name: Publish tests report
if: failure()
run: bash pub-tests.sh github
env:
TEST_JDK: ${{ matrix.java_version }}
NXF_AWS_ACCESS: ${{ secrets.NXF_AWS_ACCESS }}
NXF_AWS_SECRET: ${{ secrets.NXF_AWS_SECRET }}
uses: actions/upload-artifact@v3
with:
name: test-reports-jdk-${{ matrix.java_version }}
path: |
./plugins/nf-validation/build/reports/tests/test/**
14 changes: 14 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
// Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build.
id 'groovy-gradle-plugin'
}

repositories {
// Use the plugin portal to apply community plugins in convention plugins.
gradlePluginPortal()
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
// Apply the common convention plugin for shared build configuration between library and application projects.
id 'io.nextflow.groovy-common-conventions'

// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
// Apply the groovy Plugin to add support for Groovy.
id 'groovy'
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

compileJava {
options.release.set(11)
}

tasks.withType(GroovyCompile) {
sourceCompatibility = '11'
targetCompatibility = '11'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
// Apply the common convention plugin for shared build configuration between library and application projects.
id 'io.nextflow.groovy-common-conventions'
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
}

2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nextflowVersion = 22.10.0
groovyVersion = 3.0.14
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
26 changes: 23 additions & 3 deletions plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ ext.github_organization = 'nextflow-io'
ext.github_username = project.findProperty('github_username') ?: 'pditommaso'
ext.github_access_token = project.findProperty('github_access_token') ?: System.getenv('GITHUB_TOKEN')
ext.github_commit_email = project.findProperty('github_commit_email') ?: '[email protected]'
ext.nextflowVersion = '22.08.1-edge'

jar.enabled = false

Expand Down Expand Up @@ -59,7 +58,7 @@ subprojects {
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'io.nextflow.nf-build-plugin'

repositories {
mavenLocal()
mavenCentral()
Expand Down Expand Up @@ -95,6 +94,8 @@ subprojects {
"sha512sum": "${computeSha512(zip)}"
}
""".stripIndent()
// cleanup tmp dir
file("$buildDir/tmp/makeZip").deleteDir()
}
outputs.file("$buildDir/libs/${project.name}-${project.version}.zip")
}
Expand Down Expand Up @@ -138,13 +139,32 @@ subprojects {
skipExisting = true
}

jar {
from sourceSets.main.allSource
doLast {
file("$buildDir/tmp/jar").deleteDir()
}
}

tasks.withType(GenerateModuleMetadata) {
enabled = false
}

task upload(dependsOn: [uploadPlugin] ) { }
}

/*
* Upload all plugins to the corresponding GitHub repos
*/
task upload(dependsOn: [subprojects.uploadPlugin]) { }

classes.dependsOn subprojects.copyPluginLibs
/*
* Copies the plugins required dependencies in the corresponding lib directory
*/
classes.dependsOn subprojects.copyPluginLibs


/*
* Merge and publish the plugins index file
*/
task publishIndex( type: io.nextflow.gradle.tasks.GithubRepositoryPublisher ) {
Expand Down
19 changes: 6 additions & 13 deletions plugins/nf-validation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,13 @@

plugins {
// Apply the groovy plugin to add support for Groovy
id 'groovy'
id 'java-library'
id 'io.nextflow.groovy-library-conventions'
id 'idea'
}

group = 'io.nextflow'
// DO NOT SET THE VERSION HERE
// THE VERSION FOR PLUGINS IS DEFINED IN THE `/resources/META-INF/MANIFEST.NF` file
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

idea {
module.inheritOutputDirs = true
Expand Down Expand Up @@ -63,14 +57,14 @@ dependencies {
api 'com.github.everit-org.json-schema:org.everit.json.schema:1.14.1'

// test configuration
testImplementation "org.codehaus.groovy:groovy:3.0.10"
testImplementation "org.codehaus.groovy:groovy-nio:3.0.10"
testImplementation "io.nextflow:nextflow:$nextflowVersion"
testImplementation ("org.codehaus.groovy:groovy-test:3.0.10") { exclude group: 'org.codehaus.groovy' }
testImplementation "org.codehaus.groovy:groovy:$groovyVersion"
testImplementation "org.codehaus.groovy:groovy-nio:$groovyVersion"
testImplementation ("org.codehaus.groovy:groovy-test:$groovyVersion") { exclude group: 'org.codehaus.groovy' }
testImplementation ("cglib:cglib-nodep:3.3.0")
testImplementation ("org.objenesis:objenesis:3.1")
testImplementation ("org.spockframework:spock-core:2.0-M3-groovy-3.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation ('org.spockframework:spock-junit4:2.0-M3-groovy-3.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation ("org.spockframework:spock-core:2.2-groovy-3.0") { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation ('org.spockframework:spock-junit4:2.2-groovy-3.0') { exclude group: 'org.codehaus.groovy'; exclude group: 'net.bytebuddy' }
testImplementation ('com.google.jimfs:jimfs:1.1')

testImplementation(testFixtures("io.nextflow:nextflow:$nextflowVersion"))
Expand All @@ -86,4 +80,3 @@ dependencies {
test {
useJUnitPlatform()
}

Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class SchemaValidator extends PluginExtensionPoint {
for (p in properties) {
def String key = (String) p.key
expectedParams.push(key)
def Map property = properties[key]
def Map property = properties[key] as Map
if (property.containsKey('enum')) {
enums[key] = property['enum']
}
Expand Down Expand Up @@ -270,9 +270,9 @@ class SchemaValidator extends PluginExtensionPoint {
def String param = params.help
def Map get_param = [:]
for (group in params_map.keySet()) {
def Map group_params = params_map.get(group) // This gets the parameters of that particular group
def Map group_params = params_map.get(group) as Map // This gets the parameters of that particular group
if (group_params.containsKey(param)) {
get_param = group_params.get(param)
get_param = group_params.get(param) as Map
}
}
if (!get_param) {
Expand All @@ -299,9 +299,9 @@ class SchemaValidator extends PluginExtensionPoint {
for (group in params_map.keySet()) {
Integer num_params = 0
String group_output = "$colors.underlined$colors.bold$group$colors.reset\n"
def Map group_params = params_map.get(group) // This gets the parameters of that particular group
def Map group_params = params_map.get(group) as Map // This gets the parameters of that particular group
for (String param in group_params.keySet()) {
def Map get_param = group_params.get(param)
def Map get_param = group_params.get(param) as Map
def String type = '[' + get_param.type + ']'
def String enums_string = ""
if (get_param.enum != null) {
Expand Down Expand Up @@ -374,11 +374,11 @@ class SchemaValidator extends PluginExtensionPoint {
def Map params_map = paramsLoad( Path.of(getSchemaPath(baseDir, schema_filename)) )
for (group in params_map.keySet()) {
def sub_params = new LinkedHashMap()
def Map group_params = params_map.get(group) // This gets the parameters of that particular group
def Map group_params = params_map.get(group) as Map // This gets the parameters of that particular group
for (String param in group_params.keySet()) {
if (params.containsKey(param)) {
def String params_value = params.get(param)
def Map group_params_value = group_params.get(param)
def Map group_params_value = group_params.get(param) as Map
def String schema_value = group_params_value.default
def String param_type = group_params_value.type
if (schema_value != null) {
Expand Down Expand Up @@ -430,7 +430,7 @@ class SchemaValidator extends PluginExtensionPoint {
def LinkedHashMap params_map = paramsSummaryMap(workflow, schema_filename)
def max_chars = paramsMaxChars(params_map)
for (group in params_map.keySet()) {
def Map group_params = params_map.get(group) // This gets the parameters of that particular group
def Map group_params = params_map.get(group) as Map // This gets the parameters of that particular group
if (group_params) {
output += "$colors.bold$group$colors.reset\n"
for (String param in group_params.keySet()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
package nextflow.validation

import java.nio.file.Path

import nextflow.plugin.Plugins
import nextflow.plugin.TestPluginDescriptorFinder
import nextflow.plugin.TestPluginManager
import nextflow.plugin.extension.PluginExtensionProvider
import org.junit.Rule
import org.pf4j.PluginDescriptorFinder
import spock.lang.Shared
import spock.lang.TempDir
import test.Dsl2Spec
import test.OutputCapture

import java.nio.file.Path


/**
* @author : jorge <[email protected]>
*
Expand Down Expand Up @@ -398,7 +395,7 @@ class PluginExtensionMethodsTest extends Dsl2Spec{

then:
noExceptionThrown()
stdout.size == 10
stdout.size() == 10
}

def 'should print a help message with argument options' () {
Expand All @@ -424,7 +421,7 @@ class PluginExtensionMethodsTest extends Dsl2Spec{

then:
noExceptionThrown()
stdout.size == 1
stdout.size() == 1
}

def 'should print a help message of one parameter' () {
Expand Down Expand Up @@ -457,7 +454,7 @@ class PluginExtensionMethodsTest extends Dsl2Spec{

then:
noExceptionThrown()
stdout.size == 7
stdout.size() == 7
}

def 'should fail when help param doesnt exist' () {
Expand Down Expand Up @@ -517,7 +514,7 @@ class PluginExtensionMethodsTest extends Dsl2Spec{

then:
noExceptionThrown()
stdout.size == 11
stdout.size() == 11
stdout ==~ /.*\[0;34moutdir : .\[0;32moutDir.*/
}
}

0 comments on commit 0a1718e

Please sign in to comment.