Skip to content

Commit

Permalink
Merge pull request #24 from devatherock/gradle-7-groovy-3
Browse files Browse the repository at this point in the history
chore: Upgraded to gradle 7
  • Loading branch information
devatherock committed May 6, 2023
2 parents 4e27cc4 + ed2ba1f commit 767bde3
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 31 deletions.
31 changes: 18 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
docker_image: &docker_image
docker:
- image: cimg/openjdk:11.0
- image: cimg/openjdk:17.0
auth:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
Expand All @@ -10,6 +10,18 @@ resource_class: &resource_class

work_directory: &work_directory
working_directory: ~/git-sync

release_filter: &release_filter
filters:
branches:
only: non-existent-branch
tags:
only: /^v[0-9\.]+$/

pr_filter: &pr_filter
filters:
branches:
ignore: master

executors:
docker-executor:
Expand Down Expand Up @@ -41,7 +53,7 @@ jobs:

groovy_script_to_jar:
docker:
- image: devatherock/drone-groovy-script-to-jar:0.6.2
- image: devatherock/scriptjar:1.0.0
auth:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
Expand Down Expand Up @@ -174,31 +186,24 @@ workflows:
- publish_release:
context:
- docker-credentials
filters:
branches:
only: non-existent-branch
tags:
only: /^v[0-9\.]+$/
<<: *release_filter
- notify:
context:
- docker-credentials
- slack-webhook
<<: *release_filter
requires:
- publish_release
pr_check:
jobs:
- test:
context:
- docker-credentials
filters:
branches:
ignore: master
<<: *pr_filter
- groovy_script_to_jar:
context:
- docker-credentials
filters:
branches:
ignore: master
<<: *pr_filter
requires:
- test
- docker_build_dry_run:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ git-sync.iml
.classpath
/bin/
.settings
code-formatter.xml
checkstyle.xml
git-sync-test
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]
### Changed
- Used custom ssh key to push to github
- Upgraded to gradle 7 and groovy 3

## [2.0.0] - 2021-10-29
### Added
Expand Down
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
DOCKER_TAG=latest

clean:
./gradlew clean
test:
sh unit-tests.sh
functional-test:
sh functional-tests.sh
jar-build:
docker run --rm \
-v $(CURDIR):/work \
-w=/work \
-e PARAMETER_SCRIPT_PATH=SyncGitRepos.groovy \
-e PARAMETER_OUTPUT_FILE=SyncGitRepos.jar \
devatherock/scriptjar:1.0.0
docker-build:
docker build -t devatherock/git-sync:$(DOCKER_TAG) -f docker/Dockerfile .
10 changes: 5 additions & 5 deletions SyncGitRepos.groovy
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@Grab(group = 'commons-cli', module = 'commons-cli', version = '1.4')
@Grab(group = 'org.codehaus.groovy', module = 'groovy-cli-commons', version = '2.5.7')

import groovy.transform.Field
import groovy.cli.commons.CliBuilder
@Grab(group = 'org.codehaus.groovy', module = 'groovy-cli-commons', version = '3.0.9')

import java.util.function.Supplier
import java.util.logging.Logger
import java.util.regex.Pattern
import java.util.function.Supplier

import groovy.cli.commons.CliBuilder
import groovy.transform.Field

System.setProperty('java.util.logging.SimpleFormatter.format', '%5$s%n')
@Field Logger logger = Logger.getLogger('SyncGitRepos.log')
Expand Down
26 changes: 20 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
plugins {
id 'groovy'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.10.2'
id 'com.github.kt3k.coveralls' version '2.12.2'
id 'com.diffplug.spotless' version '6.5.2'
}

repositories {
mavenCentral()
}

sourceCompatibility = '1.6'
targetCompatibility = '1.6'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'

dependencies {
implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.5.13'
def groovyVersion = '3.0.9'

testImplementation group: 'org.spockframework', name: 'spock-core', version: '1.3-groovy-2.5'
implementation group: 'org.codehaus.groovy', name: 'groovy-cli-commons', version: groovyVersion

testImplementation group: 'org.spockframework', name: 'spock-core', version: '2.3-groovy-3.0'
testImplementation group: 'cglib', name: 'cglib-nodep', version: '3.3.0'
testImplementation group: 'org.objenesis', name: 'objenesis', version: '3.1'
}
Expand All @@ -23,7 +26,14 @@ sourceSets {
main {
groovy {
srcDirs = ['.']
exclude(['**/test/**', 'gradle/**', 'build/**', 'docker/**', 'bin/**', 'git-sync-test/**'])
exclude([
'**/test/**',
'gradle/**',
'build/**',
'docker/**',
'bin/**',
'git-sync-test/**'
])
}
}
}
Expand All @@ -32,6 +42,10 @@ compileGroovy {
groovyOptions.configurationScript = file('gradle/config.groovy')
}

test {
useJUnitPlatform()
}

ext.jacoco = [
exclusions: [
'SyncGitRepos$_run_closure*'
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx1024m
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-5.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
DEFAULT_JVM_OPTS=''

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
9 changes: 5 additions & 4 deletions src/test/groovy/SyncGitReposSpec.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import io.github.devatherock.util.ProcessUtil
import spock.lang.Specification
import spock.lang.Unroll

import java.util.logging.Handler
import java.util.logging.LogRecord
import java.util.logging.Logger

import io.github.devatherock.util.ProcessUtil

import spock.lang.Specification
import spock.lang.Unroll

/**
* Test class for SyncGitRepos.groovy
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.devatherock.gitsync.docker

import io.github.devatherock.util.ProcessUtil

import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Unroll
Expand Down

0 comments on commit 767bde3

Please sign in to comment.