Skip to content

Commit 686bd4f

Browse files
committed
feat: initial build setup
1 parent 12689c8 commit 686bd4f

File tree

27 files changed

+4505
-1
lines changed

27 files changed

+4505
-1
lines changed

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+
10+
# Binary files should be left untouched
11+
*.jar binary
12+

.github/dependabot.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: 2
2+
registries:
3+
maven-central:
4+
type: maven-repository
5+
url: https://repo.maven.apache.org/maven2/
6+
maven-itemis:
7+
type: maven-repository
8+
url: https://artifacts.itemis.cloud/repository/maven-mps/
9+
updates:
10+
- package-ecosystem: "gradle"
11+
open-pull-requests-limit: 20
12+
registries:
13+
- maven-central
14+
- maven-itemis
15+
directory: "/"
16+
schedule:
17+
interval: "daily"
18+
- package-ecosystem: "npm"
19+
open-pull-requests-limit: 20
20+
directory: "/"
21+
schedule:
22+
interval: "daily"
23+
commit-message:
24+
prefix: "build(deps)"
25+
prefix-development: "build(deps)"
26+
- package-ecosystem: "npm"
27+
open-pull-requests-limit: 20
28+
directory: "/redocly"
29+
schedule:
30+
interval: "daily"
31+
commit-message:
32+
prefix: "build(deps)"
33+
prefix-development: "build(deps)"
34+

.github/workflows/build.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request: {}
7+
workflow_dispatch: {}
8+
9+
jobs:
10+
build:
11+
name: Build and Package
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '21'
22+
distribution: 'temurin'
23+
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version-file: '.nvmrc'
28+
29+
- name: Set up pnpm
30+
uses: pnpm/action-setup@v4
31+
with:
32+
version: 10
33+
34+
- name: Setup Gradle
35+
uses: gradle/actions/setup-gradle@v3
36+
37+
- name: Build
38+
run: ./gradlew build

.github/workflows/publish.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+*'
7+
workflow_dispatch: {}
8+
9+
jobs:
10+
publish:
11+
name: Build and Publish
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '21'
22+
distribution: 'temurin'
23+
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version-file: '.nvmrc'
28+
registry-url: 'https://artifacts.itemis.cloud/repository/npm-open/'
29+
scope: '<@modelix>'
30+
31+
- name: Set up pnpm
32+
uses: pnpm/action-setup@v4
33+
with:
34+
version: 10
35+
36+
- name: Setup Gradle
37+
uses: gradle/actions/setup-gradle@v3
38+
39+
- name: Use tag as version
40+
run: echo "${GITHUB_REF#refs/*/}" > version.txt
41+
42+
- name: Build and Publish
43+
run: |-
44+
./gradlew publish \
45+
-Partifacts.itemis.cloud.user=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_USER }} \
46+
-Partifacts.itemis.cloud.pw=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_PW }} \
47+
-Partifacts.itemis.cloud.npm.token=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_NPM_TOKEN }}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
6+
7+
/specifications/merged.yaml
8+
/version.txt
9+
node_modules

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
23.10.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# modelix.api-specifications
1+
# modelix.openapi
22
OpenAPI specifications of the services provided by Modelix
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import ch.acanda.gradle.fabrikt.FabriktGenerateTask
2+
3+
plugins {
4+
kotlin("jvm")
5+
`maven-publish`
6+
alias(libs.plugins.kotlin.serialization)
7+
alias(libs.plugins.fabrikt)
8+
}
9+
10+
dependencies {
11+
implementation(libs.ktor.server.core)
12+
implementation(libs.ktor.server.auth)
13+
implementation(libs.ktor.server.data.conversion)
14+
}
15+
16+
fabrikt {
17+
defaults {
18+
validationLibrary = NoValidation
19+
model {
20+
generate = enabled
21+
serializationLibrary = Kotlin
22+
includeCompanionObject = enabled
23+
// ignoreUnknownProperties = enabled
24+
extensibleEnums = enabled
25+
}
26+
controller {
27+
generate = enabled
28+
target = Ktor
29+
authentication = enabled
30+
suspendModifier = enabled
31+
completionStage = enabled
32+
}
33+
}
34+
generate("mavenConnector") {
35+
apiFile = rootProject.layout.projectDirectory.file("redocly/build/bundled/maven-connector-v1.yaml")
36+
basePackage = "org.modelix.services.maven_connector.stubs"
37+
}
38+
generate("repository") {
39+
apiFile = rootProject.layout.projectDirectory.file("redocly/build/bundled/repository-v3.yaml")
40+
basePackage = "org.modelix.services.repository.stubs"
41+
}
42+
}
43+
44+
tasks.withType<FabriktGenerateTask> {
45+
dependsOn(":redocly:npm_run_bundle")
46+
}
47+
48+
val generatedKotlinSrc = project.layout.buildDirectory.dir("generated/sources/fabrikt/src/main/kotlin")
49+
sourceSets.main {
50+
kotlin.srcDir(generatedKotlinSrc)
51+
}
52+
53+
java {
54+
withSourcesJar()
55+
}
56+
57+
kotlin {
58+
jvmToolchain(11)
59+
}
60+
61+
publishing {
62+
publications {
63+
create<MavenPublication>("apiServerStubs") {
64+
from(components["java"])
65+
}
66+
}
67+
}
68+
69+
tasks.processResources {
70+
dependsOn(tasks.fabriktGenerate)
71+
}
72+
tasks.compileKotlin {
73+
dependsOn(tasks.fabriktGenerate)
74+
}
75+
76+
tasks.named("sourcesJar") {
77+
dependsOn(tasks.fabriktGenerate)
78+
}

build.gradle.kts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
3+
plugins {
4+
base
5+
alias(libs.plugins.kotlin.jvm) apply false
6+
alias(libs.plugins.kotlin.serialization) apply false
7+
alias(libs.plugins.gitVersion)
8+
//alias(libs.plugins.node)
9+
`maven-publish`
10+
}
11+
12+
version = computeVersion().also { println("Version: $it") }
13+
14+
fun computeVersion(): String {
15+
val versionFile = file("version.txt")
16+
return if (versionFile.exists()) {
17+
versionFile.readText().trim()
18+
} else {
19+
val gitVersion: groovy.lang.Closure<String> by extra
20+
val version = gitVersion()
21+
versionFile.writeText(version)
22+
version
23+
}
24+
}
25+
26+
group = "org.modelix"
27+
28+
subprojects {
29+
group = rootProject.group
30+
version = rootProject.version
31+
apply(plugin = "maven-publish")
32+
33+
repositories {
34+
mavenLocal()
35+
maven { url = uri("https://artifacts.itemis.cloud/repository/maven-mps/") }
36+
mavenCentral()
37+
}
38+
39+
publishing {
40+
repositories {
41+
maven {
42+
name = "itemis"
43+
url = if (version.toString().contains("SNAPSHOT")) {
44+
uri("https://artifacts.itemis.cloud/repository/maven-mps-snapshots/")
45+
} else {
46+
uri("https://artifacts.itemis.cloud/repository/maven-mps-releases/")
47+
}
48+
credentials {
49+
username = project.findProperty("artifacts.itemis.cloud.user").toString()
50+
password = project.findProperty("artifacts.itemis.cloud.pw").toString()
51+
}
52+
}
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)