Skip to content

Commit

Permalink
Change dependency to use github packages maven (#47)
Browse files Browse the repository at this point in the history
Change the dependencies to not use project structure, and instead for the publicized version.
To make sure gradle creates the package as `com.inngest:inngest` instead of `com.inngest:inngest-core`, I'll need to change the directory name since I can't seem to be able to change the name in `build.gradle.kts`

Manually ran `gradle publish` for now, but also preparing the CI workflows to automate the releases once we're ready.

---------
Co-authored-by: Darwin D Wu <[email protected]>
  • Loading branch information
darwin67 authored Feb 29, 2024
1 parent 6f35d49 commit fb78f3d
Show file tree
Hide file tree
Showing 43 changed files with 213 additions and 52 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- main
pull_request:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
test:
name: Test (Java ${{ matrix.java }})
Expand Down Expand Up @@ -36,6 +39,9 @@ jobs:
with:
fail_on_error: true
github_token: ${{ secrets.github_token }}
# NOTE: lock until this is resolved
# https://github.com/ScaCap/action-ktlint/issues/48
ktlint_version: "1.1.1"
reporter: github-pr-review

itest:
Expand Down
66 changes: 34 additions & 32 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: '26 3 * * 1'
- cron: "26 3 * * 1"

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
analyze:
Expand All @@ -40,45 +43,44 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'java-kotlin' ]
language: ["java-kotlin"]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
- name: Checkout repository
uses: actions/checkout@v4

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
release:
types:
- created

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "temurin"

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

- name: Publish package
run: gradle publish
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ gradle-app.setting

/.direnv
.DS_Store
.factorypath

# LSP generated
**/.settings/
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ itest:

.PHONY: test-core
test-core:
gradle test $(TEST_ARGS) -p inngest-core
gradle test $(TEST_ARGS) -p inngest

.PHONY: test-ktor
test-ktor:
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,24 @@ val myFunction = InngestFunction(

<details>
<summary>Java (Coming soon)</summary>

</details>

## Declaring dependencies

WIP

## Contributing [WIP]

You'll need a GitHub token in order to be able to run the builds. Create a classic GitHub personal access token, and set it in your terminal.

```sh
export GITHUB_ACTOR=<your-username> GITHUB_TOKEN=<person-access-token>
```

To build this in development, set up Java, Kotlin and Gradle locally and run the test server:

```
gradle inngest-test-server:run
make dev-ktor
```

This runs a `ktor` web server to test the SDK against the dev server.
Expand All @@ -60,5 +69,5 @@ This runs a `ktor` web server to test the SDK against the dev server.
To run the `spring-boot` test server:

```
gradle inngest-spring-boot-demo:bootRun
make dev-spring-boot
```
36 changes: 32 additions & 4 deletions inngest-spring-boot-adapter/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
group = "com.inngest"
description = "Spring Boot adapter for Inngest SDK"
version = "0.0.1"

plugins {
`java-library`
id("maven-publish")
id("io.spring.dependency-management") version "1.1.4"
}

group = "com.inngest"
version = "0.0.1-SNAPSHOT"

java {
sourceCompatibility = JavaVersion.VERSION_1_8
}

repositories {
mavenCentral()

maven {
url = uri("https://maven.pkg.github.com/inngest/inngest-kt")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}

dependencies {
api(project(":inngest-core"))
api("com.inngest:inngest:0.0.+")

implementation("org.springframework.boot:spring-boot-starter-web")
testImplementation("org.springframework.boot:spring-boot-starter-test")
Expand All @@ -29,6 +39,24 @@ dependencyManagement {
}
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/inngest/inngest-kt")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
register<MavenPublication>("gpr") {
from(components["java"])
}
}
}

tasks.withType<Test> {
useJUnitPlatform()
}
12 changes: 10 additions & 2 deletions inngest-spring-boot-demo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent


plugins {
java
id("org.springframework.boot") version "2.7.18"
Expand All @@ -18,10 +17,19 @@ java {

repositories {
mavenCentral()

maven {
url = uri("https://maven.pkg.github.com/inngest/inngest-kt")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}

dependencies {
implementation(project(":inngest-spring-boot-adapter"))
implementation("com.inngest:inngest:0.0.2")
implementation("com.inngest:inngest-spring-boot-adapter:0.0.+")

implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
Expand Down
52 changes: 52 additions & 0 deletions inngest-spring-boot-demo/fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# fly.toml app configuration file generated for inngest-spring-boot-demo on 2024-02-28T12:25:34-08:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'inngest-spring-boot-demo'
primary_region = 'sjc'
processes = []

[build]
builder = "paketobuildpacks/builder-jammy-base"

[env]
INNGEST_ENV = "prod"
INNGEST_API_BASE_URL = "https://api.inngest.net"
INNGEST_BASE_URL = "https://stage.inn.gs"
INNGEST_SERVE_ORIGIN = "https://inngest-spring-boot-demo.fly.dev"

[[services]]
http_checks = []
internal_port = 8080
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
protocol = "tcp"
script_checks = []

[service.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
handlers = ["http"]
port = 80
force_https = true

[[services.ports]]
handlers = ["tls", "http"]
port = 443

[[service.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ public Inngest inngestClient() {
return new Inngest("spring_demo");
}
}

2 changes: 1 addition & 1 deletion inngest-test-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {
}

dependencies {
api(project(":inngest-core"))
api(project(":inngest"))

// Use the Kotlin JUnit 5 integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
Expand Down
Loading

0 comments on commit fb78f3d

Please sign in to comment.