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
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary

34 changes: 34 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 2
registries:
maven-central:
type: maven-repository
url: https://repo.maven.apache.org/maven2/
maven-itemis:
type: maven-repository
url: https://artifacts.itemis.cloud/repository/maven-mps/
updates:
- package-ecosystem: "gradle"
open-pull-requests-limit: 20
registries:
- maven-central
- maven-itemis
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "npm"
open-pull-requests-limit: 20
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "build(deps)"
prefix-development: "build(deps)"
- package-ecosystem: "npm"
open-pull-requests-limit: 20
directory: "/redocly"
schedule:
interval: "daily"
commit-message:
prefix: "build(deps)"
prefix-development: "build(deps)"

38 changes: 38 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build

on:
push:
branches: [ "main" ]
pull_request: {}
workflow_dispatch: {}

jobs:
build:
name: Build and Package
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build
run: ./gradlew build
39 changes: 39 additions & 0 deletions .github/workflows/dry-run-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Dry-Run Release
on:
pull_request:

jobs:
lint-commits:
name: Lint PR commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6

test-release:
name: Dry-run semantic-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- name: Checkout branch
# Pretend to semantic-release that the PR result is eligible for
# building releases because --dry-run still filters for configured
# branches.
run: git checkout -b main
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: Dry-run release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
# We need to convince semantic-release to not pick up some
# configuration from the CI environment by removing the variable that
# is used for CI detection.
run: unset GITHUB_ACTIONS && npx semantic-release --dry-run --ci false
47 changes: 47 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
workflow_dispatch: {}

jobs:
publish:
name: Build and Publish
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://artifacts.itemis.cloud/repository/npm-open/'
scope: '<@modelix>'

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Use tag as version
run: echo "${GITHUB_REF#refs/*/}" > version.txt

- name: Build and Publish
run: |-
./gradlew publish \
-Partifacts.itemis.cloud.user=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_USER }} \
-Partifacts.itemis.cloud.pw=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_PW }} \
-Partifacts.itemis.cloud.npm.token=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_NPM_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC

jobs:
release:
name: Run semantic release
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: npx semantic-release
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

/specifications/merged.yaml
/version.txt
node_modules
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
23.10.0
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
default_install_hook_types:
- pre-commit
- commit-msg
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# - id: end-of-file-fixer # disabled, because it modifies MPS XML files
- id: check-toml
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
- id: fix-byte-order-marker
- id: mixed-line-ending
# - id: trailing-whitespace # disabled, because it modifies multiline string literals to invalid values
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.22.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ["@commitlint/config-angular"]
args: ["--config", "./commitlint.config.js"]
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-kotlin
args:
- --ktlint-version=1.5.0
- --autofix
21 changes: 21 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"branches": [
"main"
],
"tagFormat": "${version}",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "angular"
}
],
"@semantic-release/github"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# modelix.api-specifications
# modelix.openapi
OpenAPI specifications of the services provided by Modelix
78 changes: 78 additions & 0 deletions api-server-stubs-ktor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import ch.acanda.gradle.fabrikt.FabriktGenerateTask

plugins {
kotlin("jvm")
`maven-publish`
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.fabrikt)
}

dependencies {
implementation(libs.ktor.server.core)
implementation(libs.ktor.server.auth)
implementation(libs.ktor.server.data.conversion)
}

fabrikt {
defaults {
validationLibrary = NoValidation
model {
generate = enabled
serializationLibrary = Kotlin
includeCompanionObject = enabled
// ignoreUnknownProperties = enabled
extensibleEnums = enabled
}
controller {
generate = enabled
target = Ktor
authentication = enabled
suspendModifier = enabled
completionStage = enabled
}
}
generate("mavenConnector") {
apiFile = rootProject.layout.projectDirectory.file("redocly/build/bundled/maven-connector-v1.yaml")
basePackage = "org.modelix.services.maven_connector.stubs"
}
generate("repository") {
apiFile = rootProject.layout.projectDirectory.file("redocly/build/bundled/repository-v3.yaml")
basePackage = "org.modelix.services.repository.stubs"
}
}

tasks.withType<FabriktGenerateTask> {
dependsOn(":redocly:npm_run_bundle")
}

val generatedKotlinSrc = project.layout.buildDirectory.dir("generated/sources/fabrikt/src/main/kotlin")
sourceSets.main {
kotlin.srcDir(generatedKotlinSrc)
}

java {
withSourcesJar()
}

kotlin {
jvmToolchain(11)
}

publishing {
publications {
create<MavenPublication>("apiServerStubs") {
from(components["java"])
}
}
}

tasks.processResources {
dependsOn(tasks.fabriktGenerate)
}
tasks.compileKotlin {
dependsOn(tasks.fabriktGenerate)
}

tasks.named("sourcesJar") {
dependsOn(tasks.fabriktGenerate)
}
Loading
Loading