Skip to content

Commit 4cad1ac

Browse files
authored
Merge pull request #12 from devatherock/tests
feat: Added functional tests and used latest scriptjar
2 parents 5af85a4 + 6a44c9a commit 4cad1ac

14 files changed

Lines changed: 496 additions & 13 deletions

File tree

.circleci/config.yml

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,23 @@ executors:
3131
username: $DOCKER_USERNAME
3232
password: $DOCKER_PASSWORD
3333
<<: *resource_class
34+
<<: *work_directory
35+
machine-executor:
36+
machine:
37+
image: ubuntu-2204:2023.04.2
38+
resource_class: medium
39+
<<: *work_directory
40+
arm-executor:
41+
machine:
42+
image: ubuntu-2004:2022.04.1
43+
resource_class: arm.medium
3444
<<: *work_directory
3545

3646
version: 2.1
3747
jobs:
3848
groovy_script_to_jar:
3949
docker:
40-
- image: devatherock/vela-groovy-script-to-jar:0.6.2
50+
- image: devatherock/scriptjar:2.0.0
4151
auth:
4252
username: $DOCKER_USERNAME
4353
password: $DOCKER_PASSWORD
@@ -85,9 +95,7 @@ jobs:
8595
-t devatherock/java-to-native:latest .
8696
8797
dockerhub_readme:
88-
machine:
89-
image: ubuntu-2204:2023.04.2
90-
resource_class: medium
98+
executor: machine-executor
9199
steps:
92100
- checkout
93101
- run: |
@@ -98,6 +106,26 @@ jobs:
98106
-e SHORT_DESCRIPTION='CI plugin to convert a java program into a graalvm native image' \
99107
-e README_FILEPATH='/workspace/README.md' \
100108
peterevans/dockerhub-description:3.4.1
109+
110+
functional_test:
111+
parameters:
112+
runner:
113+
type: executor
114+
executor: << parameters.runner >>
115+
steps:
116+
- checkout
117+
- attach_workspace:
118+
at: ~/java-to-native
119+
- restore_cache:
120+
keys:
121+
- v1-dependencies-{{ checksum "build.gradle" }}
122+
- v1-dependencies-
123+
- run: |
124+
make test
125+
- save_cache:
126+
paths:
127+
- ~/.gradle
128+
key: v1-dependencies-{{ checksum "build.gradle" }}
101129

102130
publish_release:
103131
executor: jdk-executor
@@ -147,12 +175,27 @@ workflows:
147175
- dockerhub-readme-credentials
148176
requires:
149177
- publish
178+
- functional_test:
179+
name: functional_test_amd
180+
context:
181+
- docker-credentials
182+
runner: machine-executor
183+
requires:
184+
- publish
185+
- functional_test:
186+
name: functional_test_arm
187+
context:
188+
- docker-credentials
189+
runner: arm-executor
190+
requires:
191+
- dockerhub_readme
150192
- notify_success:
151193
context:
152194
- docker-credentials
153195
- slack-webhook
154196
requires:
155-
- dockerhub_readme
197+
- functional_test_amd
198+
- functional_test_arm
156199

157200
release:
158201
jobs:

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
.project
22
*.jar
3-
*.iml
3+
*.iml
4+
.gradle
5+
code-formatter.xml
6+
checkstyle.xml
7+
*artifacts.txt
8+
codenarc.xml
9+
Hello
10+
build

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Added
5+
- [#3](https://github.com/devatherock/java-to-native/issues/3): Functional tests
6+
7+
### Changed
8+
- [#5](https://github.com/devatherock/java-to-native/issues/5): Used latest `scriptjar`
9+
10+
## [2.2.0] - 2023-06-06
411
### Changed
512
- Updated base image with upx binary of correct architecture
613

CreateNativeImage.groovy

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
@Grab(group = 'org.yaml', module = 'snakeyaml', version = '1.25')
2-
@Grab(group = 'org.codehaus.groovy', module = 'groovy-cli-commons', version = '2.5.7')
3-
4-
import groovy.cli.commons.CliBuilder
5-
import groovy.transform.Field
6-
import org.yaml.snakeyaml.Yaml
1+
@Grab(group = 'org.yaml', module = 'snakeyaml', version = '2.0')
2+
@Grab(group = 'org.codehaus.groovy', module = 'groovy-cli-commons', version = '3.0.9')
73

84
import java.nio.file.Files
95
import java.nio.file.Paths
106
import java.util.logging.Level
117
import java.util.logging.Logger
128

9+
import groovy.cli.commons.CliBuilder
10+
import groovy.transform.Field
11+
12+
import org.yaml.snakeyaml.Yaml
13+
1314
@Field static final String CONFIG_AGENT_ARGS = 'native-image.agent.args'
1415
@Field static final String CONFIG_BUILD_ADDITIONAL_ARGS = 'native-image.build.additional-args'
1516
@Field static final String CONFIG_BUILD_OVERRIDE_ARGS = 'native-image.build.override-args'

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
docker_tag=latest
2+
scriptjar_image=scriptjar
3+
scriptjar_version=2.0.0
24

5+
clean:
6+
./gradlew clean
7+
test:
8+
SCRIPTJAR_IMAGE=$(scriptjar_image) SCRIPTJAR_VERSION=$(scriptjar_version) ./gradlew spotlessApply test -x compileGroovy -Dtest.logs=true $(additional_gradle_args)
39
jar-build:
410
docker run --rm \
511
-v $(CURDIR):/work \
612
-w=/work \
713
-e PARAMETER_SCRIPT_PATH=CreateNativeImage.groovy \
8-
devatherock/vela-groovy-script-to-jar:0.6.2
14+
devatherock/$(scriptjar_image):$(scriptjar_version)
915
docker-build:
1016
docker build -t devatherock/java-to-native:$(docker_tag) .

build.gradle

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
plugins {
2+
id 'groovy'
3+
id 'com.diffplug.spotless' version '6.19.0'
4+
}
5+
6+
repositories {
7+
mavenCentral()
8+
}
9+
10+
sourceCompatibility = '11'
11+
targetCompatibility = '11'
12+
13+
dependencies {
14+
testImplementation group: 'org.spockframework', name: 'spock-core', version: '2.3-groovy-4.0'
15+
}
16+
17+
sourceSets {
18+
main {
19+
groovy {
20+
srcDirs = ['.']
21+
exclude([
22+
'**/test/**',
23+
'build/**',
24+
'bin/**'
25+
])
26+
}
27+
}
28+
}
29+
30+
test {
31+
useJUnitPlatform()
32+
}
33+
34+
apply from: 'https://raw.githubusercontent.com/devatherock/gradle-includes/master/checks.gradle'

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.gradle.daemon=false
2+
org.gradle.jvmargs=-Xmx1024m
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)