Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Dünkelmann <[email protected]>
  • Loading branch information
MartinX3 committed Aug 23, 2024
1 parent 8b1cfb0 commit 0d6cb03
Show file tree
Hide file tree
Showing 141 changed files with 12,873 additions and 2 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI Release
on:
push:
branches:
- main
jobs:
build_frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout frontend
uses: actions/[email protected]
with:
sparse-checkout: 'frontend'
- name: Install PNPM
uses: pnpm/[email protected]
with:
package_json_file: 'frontend/package.json'
- name: Setup node env
uses: actions/[email protected]
with:
cache: 'pnpm'
cache-dependency-path: 'frontend/pnpm-lock.yaml'
check-latest: true
node-version: 'lts/*'
- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: 'frontend'
- name: Lint code
run: pnpm prepare && pnpm lint
working-directory: 'frontend'
- name: Build frontend
run: pnpm build
working-directory: 'frontend'
- name: Upload frontend artifact
uses: actions/[email protected]
with:
name: frontend-build
path: frontend/dist/spa/
build_backend:
needs: build_frontend
runs-on: ubuntu-latest
steps:
- name: Checkout backend
uses: actions/[email protected]
with:
sparse-checkout: 'backend'
- name: setup jdk 17
uses: actions/setup-java@v3
with:
cache: 'gradle'
distribution: 'temurin'
java-version: '21'
- name: Create needed folders for the frontend artifact
run: |
mkdir -p src/main/resources/static/
mkdir -p src/main/resources/templates/
working-directory: 'backend'
- name: Download frontend artifact
uses: actions/[email protected]
with:
name: frontend-build
path: backend/src/main/resources/static/
- name: Move index.html from static to templates
run: gradle bootJar
working-directory: 'backend'
- name: Upload backend artifact
uses: actions/[email protected]
with:
name: backend-build
path: backend/build/libs/openapi-catalog-*.jar
release:
needs: build_backend
runs-on: ubuntu-latest
steps:
- name: Download backend artifact
uses: actions/[email protected]
with:
name: backend-build
path: build/libs/
- name: Upload release
uses: softprops/action-gh-release@v2
with:
files: build/libs/
make_latest: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ gradle-app.setting
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

# IDE
.idea
77 changes: 75 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,75 @@
# openapi-catalog
Membrane OpenAPI Catalog
# OpenAPI Catalog

The Membrane OpenAPI Catalog manages OpenAPI specifications.
Features:

- Automatic updates
- Linting
- Diff checking for breaking changes

## Requirements

- Linux, macOS or Windows
- x86-64
- Java 21
- Internet connection

## Installation

1. [Download the latest release](https://github.com/membrane/openapi-catalog/releases/latest)
2. Execute the OpenAPI-Catalog with `java -jar openapi-catalog-{version}.jar`
3. After you see `Completed initialization` in the terminal the application is ready.
4. A browser window should open automatically. If not, [open the service in the browser](http://localhost:8000).

## Configuration

You can configurate the application by opening its file with an archive manager and edit specific files.

### Database

- file: /BOOT-INF/classes/application.yml
- values:
- datasource.username
- file: /BOOT-INF/classes/application-prod.yml
- values:
- datasource.password
- datasource.url

### Port

- file: /BOOT-INF/classes/application-prod.yml
- values:
- server.port

### Used tools

If the organization or repository names of the used tools change on GitHub, these values can be updated with the following parameters:

- file: /BOOT-INF/classes/application.yml
- values:
- tools.diff.github.name
_repository name_
- tools.diff.github.organization
_organization name_
- tools.lint.github.name
_repository name_
- tools.lint.github.organization
_organization name_

## Automatic setup

On execution, the software will do the following tasks:

1. Installation of the tools:
- If the tool doesn't exist or is older than the GitHub version, it will be downloaded.
- If no internet is available and tools are already downloaded, the software will use them.
- The location of the downloaded tools will be at `/home/{$HOME}/.predic8/openapicatalog/tools/`.
- diff tool
- filename: `openapi-changes`
- version file: `.openapi-changes`
- linting tool
- filename: `spectral`
- version file: `.spectral`
2. Installation of the `hsqldb` database:
- The database will be created at `/home/{$HOME}/.predic8/openapicatalog/database/`
3. Update specifications which should be updated automatically.
43 changes: 43 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Kotlin ###
.kotlin
/.idea/

### Frontend ###
src/main/resources/static
src/main/resources/templates
21 changes: 21 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Backend

## Run in development mode

### Linux / Unix

`./gradlew bootRun --args='--spring.profiles.active=dev'`

### Windows

`gradlew.bat bootRun --args="--spring.profiles.active=dev"`

## Run in productive mode

### Linux / Unix

`./gradlew bootRun --args='--spring.profiles.active=prod'`

### Windows

`gradlew.bat bootRun --args="--spring.profiles.active=prod"`
85 changes: 85 additions & 0 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import org.gradle.api.JavaVersion.VERSION_21
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.springframework.boot.gradle.tasks.bundling.BootJar

plugins {
val kotlinVersion = "2.0.20"

id("com.github.ben-manes.versions") version "0.51.0"
id("io.spring.dependency-management") version "1.1.6"
id("org.springframework.boot") version "3.3.3"

kotlin("jvm") version kotlinVersion
kotlin("plugin.jpa") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
}

group = "de.predic8"
version = "1.0.0"

java {
sourceCompatibility = VERSION_21
}

repositories {
mavenCentral()
}

dependencies {
// Database
runtimeOnly("org.hsqldb:hsqldb")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")

// (De-)Compression
implementation("org.apache.commons:commons-compress:1.27.1")

// (De-)Serialization
implementation("com.charleskorn.kaml:kaml:0.61.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")

// Git
implementation("org.eclipse.jgit:org.eclipse.jgit:6.10.0.202406032230-r")
implementation("org.kohsuke:github-api:1.324")

// Kotlin
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib")

// Open the browser on startup
implementation("org.seleniumhq.selenium:selenium-java:4.23.1")

// OS detection
implementation("org.apache.commons:commons-lang3:3.16.0")

// Scheduler
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC.2")

// Versioning
implementation("org.semver4j:semver4j:5.3.0")

// Web
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-web")

// Testing
testImplementation("org.springframework.boot:spring-boot-starter-test")
}

tasks.named<BootJar>("bootJar") {
archiveFileName = "openapi-catalog-${version}.jar"

launchScript()
}

tasks.named("compileKotlin", KotlinCompilationTask::class.java) {
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
}
}

tasks.withType<Test> {
useJUnitPlatform()
}
Binary file added backend/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions backend/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0d6cb03

Please sign in to comment.