Skip to content

Commit ab0a07e

Browse files
committed
first commit
0 parents  commit ab0a07e

File tree

12 files changed

+709
-0
lines changed

12 files changed

+709
-0
lines changed

.github/workflows/release.yml

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
name: release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'the version to be released'
7+
required: true
8+
9+
jobs:
10+
build-jar-job:
11+
name: 'Build JAR'
12+
runs-on: ubuntu-latest
13+
env:
14+
RELEASE_VERSION: ${{ github.event.inputs.version }}
15+
16+
steps:
17+
- name: 'Checkout'
18+
uses: actions/checkout@v2
19+
20+
- name: 'Setup Java 11'
21+
uses: actions/setup-java@v1
22+
with:
23+
java-version: 11
24+
25+
- name: 'Build JAR'
26+
run: |
27+
./gradlew clean build shadowJar
28+
29+
- name: 'Publish JAR'
30+
uses: actions/upload-artifact@v2-preview
31+
with:
32+
name: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-all.jar'
33+
path: build/libs/*-all.jar
34+
35+
- name: 'Create Release'
36+
id: create_release
37+
uses: actions/create-release@v1
38+
env:
39+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
40+
with:
41+
tag_name: 'v${{env.RELEASE_VERSION}}'
42+
release_name: 'Version ${{env.RELEASE_VERSION}}'
43+
body: |
44+
New Release
45+
draft: false
46+
prerelease: false
47+
48+
- name: 'Upload Release Asset'
49+
id: upload-release-asset
50+
uses: actions/upload-release-asset@v1
51+
env:
52+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
53+
with:
54+
upload_url: ${{steps.create_release.outputs.upload_url}}
55+
asset_path: build/libs/graphql-anonymizer-${{env.RELEASE_VERSION}}-all.jar
56+
asset_name: graphql-anonymizer-${{env.RELEASE_VERSION}}-all.jar
57+
asset_content_type: application/java-archive
58+
59+
60+
- name: 'Write Upload URL To File'
61+
run: |
62+
echo "${{steps.create_release.outputs.upload_url}}" > upload_url.txt
63+
64+
- name: 'Publish Upload URL'
65+
uses: actions/upload-artifact@v2-preview
66+
with:
67+
name: 'upload_url.txt'
68+
path: 'upload_url.txt'
69+
70+
build-non-windows-image:
71+
name: 'Build Non-Windows Image'
72+
needs: [ build-jar-job ]
73+
strategy:
74+
matrix:
75+
os: [ 'ubuntu-latest', 'macos-latest' ]
76+
include:
77+
- os: 'ubuntu-latest'
78+
label: 'linux'
79+
- os: 'macos-latest'
80+
label: 'mac'
81+
runs-on: ${{matrix.os}}
82+
env:
83+
RELEASE_VERSION: ${{ github.event.inputs.version }}
84+
85+
86+
steps:
87+
- name: 'Checkout'
88+
uses: actions/checkout@v2
89+
90+
- name: 'Setup Java 11'
91+
uses: actions/setup-java@v1
92+
with:
93+
java-version: 11
94+
95+
- name: 'Setup GraalVM Environment'
96+
uses: DeLaGuardo/[email protected]
97+
with:
98+
graalvm-version: '21.1.0.2.java11'
99+
100+
- name: 'Install Native Image Plugin'
101+
run: |
102+
gu install native-image
103+
104+
- name: 'Get JAR Artifact'
105+
uses: actions/download-artifact@v2-preview
106+
with:
107+
name: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-all.jar'
108+
109+
- name: 'Get Release URL'
110+
uses: actions/download-artifact@v2-preview
111+
with:
112+
name: 'upload_url.txt'
113+
114+
- name: 'Get Upload URL'
115+
run: |
116+
echo "::set-env name=UPLOAD_URL::$(cat upload_url.txt)"
117+
118+
- name: 'Build Native Image'
119+
run: |
120+
native-image -H:+ReportExceptionStackTraces -H:+ReportUnsupportedElementsAtRuntime --verbose --no-server --no-fallback --allow-incomplete-classpath -jar graphql-anonymizer-${{env.RELEASEVERSION}}-all.jar
121+
122+
- name: 'Publish Native Image'
123+
if: success()
124+
uses: actions/upload-artifact@v2-preview
125+
with:
126+
name: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-${{matrix.label}}'
127+
path: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-all'
128+
129+
- name: 'Release Native Image Asset'
130+
if: success() && contains(github.ref, 'v')
131+
id: upload-release-asset
132+
uses: actions/upload-release-asset@v1
133+
env:
134+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
135+
with:
136+
upload_url: ${{env.UPLOAD_URL}}
137+
asset_name: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-${{matrix.label}}'
138+
asset_path: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-all'
139+
asset_content_type: application/octet-stream
140+
141+
build-windows-image:
142+
needs: [ build-jar-job ]
143+
name: 'Build Windows Image'
144+
runs-on: windows-latest
145+
env:
146+
RELEASE_VERSION: ${{ github.event.inputs.version }}
147+
148+
149+
steps:
150+
151+
- name: 'Checkout'
152+
uses: actions/checkout@v1
153+
154+
- name: 'Download GraalVM'
155+
run: |
156+
Invoke-RestMethod -Uri https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.0.0.2/graalvm-ce-java11-windows-amd64-21.0.0.2.zip -OutFile 'graal.zip'
157+
158+
- name: 'Install GraalVM'
159+
run: |
160+
Expand-Archive -path 'graal.zip' -destinationpath '.'
161+
162+
- name: 'Install Native Image'
163+
run: |
164+
graalvm-ce-java11-21.0.0.2\bin\gu.cmd install native-image
165+
166+
- name: 'Set up Visual C Build Tools Workload for Visual Studio 2017 Build Tools'
167+
run: |
168+
choco install visualstudio2017-workload-vctools
169+
170+
- name: 'Get JAR Artifact'
171+
uses: actions/download-artifact@v2-preview
172+
with:
173+
name: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-all.jar'
174+
175+
- name: 'Build Native Image'
176+
shell: cmd
177+
env:
178+
JAVA_HOME: ./graalvm-ce-java11-21.0.0.2
179+
run: |
180+
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
181+
./graalvm-ce-java11-21.0.0.2/bin/native-image --no-server --no-fallback -H:ReflectionConfigurationResources=reflection-config.json -H:IncludeResources=logback.xml -H:Name=graphql-anonymizer-${{env.RELEASE_VERSION}}-all --allow-incomplete-classpath -jar graphql-anonymizer-${{env.RELEASE_VERSION}}-all.jar
182+
183+
- name: 'Get Release URL'
184+
uses: actions/download-artifact@v2-preview
185+
with:
186+
name: 'upload_url.txt'
187+
188+
- name: 'Get Upload URL'
189+
run: |
190+
echo "::set-env name=UPLOAD_URL::$(cat upload_url.txt)"
191+
shell: bash
192+
193+
- name: 'Publish Windows Image'
194+
if: success()
195+
uses: actions/upload-artifact@v2-preview
196+
with:
197+
name: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-windows.exe'
198+
path: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-all.exe'
199+
200+
- name: 'Release Windows Image Asset'
201+
if: success()
202+
id: upload-release-asset
203+
uses: actions/upload-release-asset@v1
204+
env:
205+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
206+
with:
207+
upload_url: ${{env.UPLOAD_URL}}
208+
asset_name: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-windows.exe'
209+
asset_path: 'graphql-anonymizer-${{env.RELEASE_VERSION}}-all.exe'
210+
asset_content_type: application/octet-stream

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.gradle
2+
.idea
3+
build
4+
out
5+
graphql-anonymizer
6+
.DS_Store

build.gradle.kts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import java.text.SimpleDateFormat
2+
import java.util.*
3+
4+
plugins {
5+
java
6+
id("com.github.johnrengelman.shadow") version "6.1.0"
7+
}
8+
9+
group = "com.graphql-java"
10+
11+
if (JavaVersion.current() != JavaVersion.VERSION_11) {
12+
val msg = String.format("This build must be run with java 11 - you are running %s - gradle finds the JDK via JAVA_HOME=%s",
13+
JavaVersion.current(), System.getenv("JAVA_HOME"))
14+
throw GradleException(msg)
15+
}
16+
17+
fun version(): String {
18+
val RELEASE_VERSION = "RELEASE_VERSION"
19+
if (System.getenv().containsKey(RELEASE_VERSION)) {
20+
val releaseVersion = System.getenv(RELEASE_VERSION)
21+
println("using release version $releaseVersion")
22+
return releaseVersion
23+
}
24+
val version = SimpleDateFormat("yyyy-MM-dd\'T\'HH-mm-ss-mmm").format(Date())
25+
println("created development version: $version")
26+
return version
27+
}
28+
version = version()
29+
30+
31+
java {
32+
toolchain {
33+
languageVersion.set(JavaLanguageVersion.of(11))
34+
}
35+
}
36+
37+
tasks.jar {
38+
manifest {
39+
attributes(
40+
"Main-Class" to "Main"
41+
)
42+
}
43+
}
44+
repositories {
45+
mavenCentral()
46+
}
47+
tasks.withType<JavaCompile> {
48+
val compilerArgs = options.compilerArgs
49+
compilerArgs.add("-Aproject=${project.group}/${project.name}")
50+
}
51+
52+
dependencies {
53+
implementation("info.picocli:picocli:4.6.1")
54+
implementation("com.graphql-java:graphql-java:2021-02-13T23-17-27-86627c27")
55+
annotationProcessor("info.picocli:picocli-codegen:4.6.1")
56+
testCompile("junit", "junit", "4.12")
57+
}

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
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-6.8.2-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)