Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 48 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,23 @@ executors:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
<<: *resource_class
<<: *work_directory
machine-executor:
machine:
image: ubuntu-2204:2023.04.2
resource_class: medium
<<: *work_directory
arm-executor:
machine:
image: ubuntu-2004:2022.04.1
resource_class: arm.medium
<<: *work_directory

version: 2.1
jobs:
groovy_script_to_jar:
docker:
- image: devatherock/vela-groovy-script-to-jar:0.6.2
- image: devatherock/scriptjar:2.0.0
auth:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
Expand Down Expand Up @@ -85,9 +95,7 @@ jobs:
-t devatherock/java-to-native:latest .

dockerhub_readme:
machine:
image: ubuntu-2204:2023.04.2
resource_class: medium
executor: machine-executor
steps:
- checkout
- run: |
Expand All @@ -98,6 +106,26 @@ jobs:
-e SHORT_DESCRIPTION='CI plugin to convert a java program into a graalvm native image' \
-e README_FILEPATH='/workspace/README.md' \
peterevans/dockerhub-description:3.4.1

functional_test:
parameters:
runner:
type: executor
executor: << parameters.runner >>
steps:
- checkout
- attach_workspace:
at: ~/java-to-native
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
- v1-dependencies-
- run: |
make test
- save_cache:
paths:
- ~/.gradle
key: v1-dependencies-{{ checksum "build.gradle" }}

publish_release:
executor: jdk-executor
Expand Down Expand Up @@ -147,12 +175,27 @@ workflows:
- dockerhub-readme-credentials
requires:
- publish
- functional_test:
name: functional_test_amd
context:
- docker-credentials
runner: machine-executor
requires:
- publish
- functional_test:
name: functional_test_arm
context:
- docker-credentials
runner: arm-executor
requires:
- dockerhub_readme
- notify_success:
context:
- docker-credentials
- slack-webhook
requires:
- dockerhub_readme
- functional_test_amd
- functional_test_arm

release:
jobs:
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.project
*.jar
*.iml
*.iml
.gradle
code-formatter.xml
checkstyle.xml
*artifacts.txt
codenarc.xml
Hello
build
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog

## [Unreleased]
### Added
- [#3](https://github.com/devatherock/java-to-native/issues/3): Functional tests

### Changed
- [#5](https://github.com/devatherock/java-to-native/issues/5): Used latest `scriptjar`

## [2.2.0] - 2023-06-06
### Changed
- Updated base image with upx binary of correct architecture

Expand Down
13 changes: 7 additions & 6 deletions CreateNativeImage.groovy
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
@Grab(group = 'org.yaml', module = 'snakeyaml', version = '1.25')
@Grab(group = 'org.codehaus.groovy', module = 'groovy-cli-commons', version = '2.5.7')

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

import java.nio.file.Files
import java.nio.file.Paths
import java.util.logging.Level
import java.util.logging.Logger

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

import org.yaml.snakeyaml.Yaml

@Field static final String CONFIG_AGENT_ARGS = 'native-image.agent.args'
@Field static final String CONFIG_BUILD_ADDITIONAL_ARGS = 'native-image.build.additional-args'
@Field static final String CONFIG_BUILD_OVERRIDE_ARGS = 'native-image.build.override-args'
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
docker_tag=latest
scriptjar_image=scriptjar
scriptjar_version=2.0.0

clean:
./gradlew clean
test:
SCRIPTJAR_IMAGE=$(scriptjar_image) SCRIPTJAR_VERSION=$(scriptjar_version) ./gradlew spotlessApply test -x compileGroovy -Dtest.logs=true $(additional_gradle_args)
jar-build:
docker run --rm \
-v $(CURDIR):/work \
-w=/work \
-e PARAMETER_SCRIPT_PATH=CreateNativeImage.groovy \
devatherock/vela-groovy-script-to-jar:0.6.2
devatherock/$(scriptjar_image):$(scriptjar_version)
docker-build:
docker build -t devatherock/java-to-native:$(docker_tag) .
34 changes: 34 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins {
id 'groovy'
id 'com.diffplug.spotless' version '6.19.0'
}

repositories {
mavenCentral()
}

sourceCompatibility = '11'
targetCompatibility = '11'

dependencies {
testImplementation group: 'org.spockframework', name: 'spock-core', version: '2.3-groovy-4.0'
}

sourceSets {
main {
groovy {
srcDirs = ['.']
exclude([
'**/test/**',
'build/**',
'bin/**'
])
}
}
}

test {
useJUnitPlatform()
}

apply from: 'https://raw.githubusercontent.com/devatherock/gradle-includes/master/checks.gradle'
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
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
172 changes: 172 additions & 0 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading