Skip to content

Commit 999f6f8

Browse files
committed
Add github workflow
1 parent ae3c473 commit 999f6f8

File tree

8 files changed

+184
-65
lines changed

8 files changed

+184
-65
lines changed

.github/workflows/build.yml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [ main, 'patch*' ]
6+
tags: [ '*' ]
7+
pull_request:
8+
branches: [ '*' ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '17'
20+
distribution: 'temurin'
21+
22+
- name: Setup Gradle
23+
uses: gradle/actions/setup-gradle@v4
24+
25+
- name: Build
26+
run: ./gradlew classes
27+
28+
- name: Cache build artifacts
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
*/build
33+
key: ${{ github.ref_name }}-build-${{ github.sha }}
34+
35+
test:
36+
needs: build
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Set up JDK 17
42+
uses: actions/setup-java@v4
43+
with:
44+
java-version: '17'
45+
distribution: 'temurin'
46+
47+
- name: Setup Gradle
48+
uses: gradle/actions/setup-gradle@v4
49+
50+
- name: Restore build artifacts
51+
uses: actions/cache@v4
52+
with:
53+
path: |
54+
*/build
55+
key: ${{ github.ref_name }}-build-${{ github.sha }}
56+
57+
- name: Run tests
58+
run: ./gradlew --continue check koverXmlReport
59+
60+
- name: Publish Test Report
61+
uses: mikepenz/action-junit-report@v5
62+
if: always()
63+
with:
64+
report_paths: |
65+
reactive/api/build/test-results/test/TEST-*.xml
66+
reactive/core/build/test-results/test/TEST-*.xml
67+
reactive/java-flow/build/test-results/test/TEST-*.xml
68+
reactive/kotlin/build/test-results/test/TEST-*.xml
69+
reactive/reactivestreams/build/test-results/test/TEST-*.xml
70+
spring/build/test-results/test/TEST-*.xml
71+
util/build/test-results/test/TEST-*.xml
72+
73+
- name: Upload coverage reports
74+
uses: codecov/codecov-action@v5
75+
with:
76+
files: build/reports/kover/report.xml
77+
fail_ci_if_error: false
78+
79+
docs:
80+
needs: build
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- name: Set up JDK 17
86+
uses: actions/setup-java@v4
87+
with:
88+
java-version: '17'
89+
distribution: 'temurin'
90+
91+
- name: Setup Gradle
92+
uses: gradle/actions/setup-gradle@v4
93+
94+
- name: Restore build artifacts
95+
uses: actions/cache@v4
96+
with:
97+
path: |
98+
*/build
99+
key: ${{ github.ref_name }}-build-${{ github.sha }}
100+
101+
- name: Generate documentation
102+
run: ./gradlew dokkaGenerate
103+
104+
- name: Upload documentation
105+
uses: actions/upload-artifact@v4
106+
with:
107+
name: documentation
108+
path: docs/build/dokka/html
109+
110+
pages:
111+
needs: docs
112+
runs-on: ubuntu-latest
113+
if: github.ref == 'refs/heads/main'
114+
permissions:
115+
pages: write
116+
id-token: write
117+
environment:
118+
name: github-pages
119+
url: ${{ steps.deployment.outputs.page_url }}
120+
steps:
121+
- uses: actions/checkout@v4
122+
123+
- name: Download documentation
124+
uses: actions/download-artifact@v4
125+
with:
126+
name: documentation
127+
path: docs/build/dokka/html
128+
129+
- name: Setup GitHub Pages
130+
uses: actions/configure-pages@v5
131+
132+
- name: Upload artifact
133+
uses: actions/upload-pages-artifact@v3
134+
with:
135+
path: 'docs/build/dokka/html'
136+
137+
- name: Deploy to GitHub Pages
138+
id: deployment
139+
uses: actions/deploy-pages@v4
140+
141+
publish:
142+
needs: test
143+
runs-on: ubuntu-latest
144+
if: startsWith(github.ref, 'refs/tags/')
145+
steps:
146+
- uses: actions/checkout@v4
147+
148+
- name: Set up JDK 17
149+
uses: actions/setup-java@v4
150+
with:
151+
java-version: '17'
152+
distribution: 'temurin'
153+
154+
- name: Setup Gradle
155+
uses: gradle/actions/setup-gradle@v4
156+
157+
- name: Publish libraries
158+
run: ./gradlew publish
159+
env:
160+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.idea/modules.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

buildSrc/build.gradle.kts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ plugins {
33
id("com.ncorti.ktfmt.gradle") version libs.versions.ktfmtPlugin
44
}
55

6-
repositories {
7-
maven {
8-
url = uri("https://artifactory.caplin.com/artifactory/repo1")
9-
} // Caplin Maven Central cache
10-
maven { url = uri("https://artifactory.caplin.com/artifactory/thirdparty-repo") }
11-
maven { url = uri("https://artifactory.caplin.com/artifactory/caplin-release") }
12-
maven { url = uri("https://plugins.gradle.org/m2/") }
13-
mavenCentral()
14-
}
15-
166
dependencies {
177
implementation(libs.ktfmt.plugin)
188
implementation(libs.dokka.plugin)

buildSrc/settings.gradle.kts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
dependencyResolutionManagement {
22
repositories {
3-
maven {
4-
url = uri("https://artifactory.caplin.com/artifactory/repo1")
5-
} // Caplin Maven Central cache
6-
maven { url = uri("https://artifactory.caplin.com/artifactory/thirdparty-repo") }
7-
maven { url = uri("https://artifactory.caplin.com/artifactory/caplin-release") }
3+
mavenCentral()
4+
gradlePluginPortal()
85
}
96
versionCatalogs {
107
create("libs") {

buildSrc/src/main/kotlin/common-maven.gradle.kts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,18 @@ plugins { `maven-publish` }
33
group = "com.caplin.integration.datasourcex"
44

55
val configuredVersion =
6-
System.getenv("CI_COMMIT_TAG") ?: System.getenv("CI_COMMIT_REF_SLUG") ?: "dev"
6+
System.getenv("GITHUB_REF_NAME") ?: "dev"
77

88
version = configuredVersion
99

1010
publishing {
1111
repositories {
1212
maven {
13-
url = uri("https://gitlab.caplin.com/api/v4/projects/273/packages/maven")
14-
credentials(HttpHeaderCredentials::class.java) {
15-
name = "Job-Token"
16-
value = System.getenv("CI_JOB_TOKEN")
17-
}
18-
authentication { create("header", HttpHeaderAuthentication::class.java) }
19-
}
20-
maven {
21-
url =
22-
uri(
23-
"https://artifactory.caplin.com/artifactory/caplin-${
24-
when {
25-
"^[0-9]+\\.[0-9]+\\.[0-9]+\$".toRegex().matches(configuredVersion) -> "release"
26-
"^[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+\$".toRegex().matches(configuredVersion) -> "rc"
27-
else -> "ci"
28-
}
29-
}",
30-
)
13+
name = "GitHubPackages"
14+
url = uri("https://maven.pkg.github.com/${System.getenv("GITHUB_REPOSITORY") ?: "caplin/DataSource-Extensions"}")
3115
credentials {
32-
username = System.getenv("ARTIFACTORY_USERNAME")
33-
password = System.getenv("ARTIFACTORY_PASSWORD")
16+
username = System.getenv("GITHUB_ACTOR")
17+
password = System.getenv("GITHUB_TOKEN")
3418
}
3519
}
3620
}

examples/docker/liberator/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM gitlab.caplin.com:5050/platform/platformdockerimage/core:8.0.9 AS platform
1+
FROM docker-release.caplin.com/platform/core:8.0.9 AS platform
22

33
USER root
44

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ kotlinCollectionsImmutable = "0.3.8"
55
jsonPatch = "1.13"
66

77
# Caplin Dependencies
8-
datasource = "8.0.1+"
8+
datasource = "8.0.6-1430-651ec808"
99

1010
# Test Dependencies
1111
kotest = "5.9.1"

settings.gradle.kts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
pluginManagement {
2-
repositories {
3-
maven { url = uri("https://artifactory.caplin.com/artifactory/gradle-plugins/") }
4-
maven { url = uri("https://artifactory.caplin.com/artifactory/repo1") } // Caplin Maven Central cache
5-
}
6-
}
7-
81
dependencyResolutionManagement {
9-
repositories {
10-
maven { url = uri("https://artifactory.caplin.com/artifactory/repo1") } // Caplin Maven Central cache
11-
maven { url = uri("https://artifactory.caplin.com/artifactory/thirdparty-repo") }
12-
maven { url = uri("https://artifactory.caplin.com/artifactory/caplin-release") }
2+
repositories {
3+
mavenCentral()
4+
maven {
5+
url = uri("https://repository.caplin.com/repository/caplin-release")
6+
credentials {
7+
val caplinUsername: String? by settings
8+
val caplinPassword: String? by settings
9+
username = checkNotNull(
10+
caplinUsername ?: System.getenv("CAPLIN_USERNAME"),
11+
) { "Missing caplinUsername property or CAPLIN_USERNAME environment variable" }
12+
password = checkNotNull(
13+
caplinPassword ?: System.getenv("CAPLIN_PASSWORD"),
14+
) { "Missing caplinPassword property or CAPLIN_PASSWORD environment variable" }
15+
}
1316
}
17+
}
1418
}
1519

1620
rootProject.name = "datasourcex"

0 commit comments

Comments
 (0)