Skip to content

Commit 21d8eef

Browse files
authored
Fix GitHub actions pipeline (#1)
1 parent 2665a3f commit 21d8eef

9 files changed

Lines changed: 105 additions & 120 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Build Java Core Library
22

33
on:
4+
pull_request:
45
push:
56
branches: [ "master" ]
67
workflow_dispatch:
@@ -11,6 +12,8 @@ jobs:
1112
steps:
1213
- name: Checkout code
1314
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
1417
- name: Setup Java
1518
uses: actions/setup-java@v3
1619
with:
@@ -20,15 +23,14 @@ jobs:
2023
uses: gradle/gradle-build-action@v2
2124
with:
2225
gradle-version: 8.4
23-
- name: Inject nexus credentials
24-
env:
25-
NEXUS_USER: ${{secrets.NEXUS_USER}}
26-
NEXUS_PASSWORD: ${{secrets.NEXUS_PASSWORD}}
27-
run: ./deploy/injectGradleCredentials.sh $NEXUS_USER $NEXUS_PASSWORD "gradle.properties"
2826
- name: Run tests
2927
run: ./gradlew unitTest integrationTest --fail-fast
3028
- name: Generate reports
31-
run: ./gradlew jacocoUnitTestReport jacocoIntegrationTestReport
29+
run: ./gradlew jacocoTestReport
30+
- name: Run Sonar analysis
31+
env:
32+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
33+
run: ./gradlew sonar -x test --no-watch-fs
3234
- name: Upload Artifact
3335
uses: actions/upload-artifact@v3
3436
with:
@@ -38,6 +40,7 @@ jobs:
3840

3941
build:
4042
runs-on: ubuntu-latest
43+
needs: [test]
4144
steps:
4245
- uses: actions/checkout@v3
4346
- uses: actions/setup-java@v3
@@ -48,26 +51,11 @@ jobs:
4851
uses: gradle/gradle-build-action@v2
4952
with:
5053
gradle-version: 8.4
51-
- name: Inject nexus credentials
52-
env:
53-
NEXUS_USER: ${{secrets.NEXUS_USER}}
54-
NEXUS_PASSWORD: ${{secrets.NEXUS_PASSWORD}}
55-
run: ./deploy/injectGradleCredentials.sh $NEXUS_USER $NEXUS_PASSWORD "gradle.properties"
5654
- name: Run build with Gradle Wrapper
5755
run: ./gradlew build -x test
58-
59-
deploy:
60-
runs-on: ubuntu-latest
61-
needs: [test, build]
62-
steps:
63-
- uses: actions/checkout@v3
64-
- uses: actions/setup-java@v3
65-
with:
66-
distribution: temurin
67-
java-version: 17
68-
- name: Setup Gradle
69-
uses: gradle/gradle-build-action@v2
56+
- name: Upload Artifact
57+
uses: actions/upload-artifact@v3
7058
with:
71-
gradle-version: 8.4
72-
- name: Run build with Gradle Wrapper
73-
run: ./gradlew build -x test
59+
name: jar
60+
path: build/libs/**
61+
retention-days: 5
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v4
11+
- name: Setup Java
12+
uses: actions/setup-java@v3
13+
with:
14+
distribution: temurin
15+
java-version: 17
16+
- name: Setup Gradle
17+
uses: gradle/gradle-build-action@v2
18+
with:
19+
gradle-version: 8.5
20+
- name: Publish packages
21+
env:
22+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
23+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
24+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY }}
25+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }}
26+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository

‎bitbucket-pipelines.yml‎

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

‎build.gradle‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
buildscript {
22
ext {
3-
springBootVersion = '3.1.1'
4-
springVersion = '6.0.11'
5-
jacksonVersion = '2.15.2'
3+
springBootVersion = '3.1.6'
4+
springVersion = '6.0.14'
5+
jacksonVersion = '2.15.3'
66
mockitoVersion = '5.2.+'
77
retrofitVersion = '2.9.0'
88
}
99
dependencies {
10-
classpath 'org.owasp:dependency-check-gradle:6.5.3'
10+
classpath 'org.owasp:dependency-check-gradle:7.4.4'
1111
}
1212
}
1313

1414
plugins {
1515
id 'java'
16-
id "org.owasp.dependencycheck" version "6.5.3"
16+
id "org.owasp.dependencycheck" version "7.4.4"
1717
id "io.freefair.lombok" version "8.3"
18+
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
1819
}
1920

2021
group 'ee.bitweb'
21-
version '3.0.0'
22-
sourceCompatibility = JavaVersion.VERSION_17
22+
version '3.0.1'
23+
java {
24+
sourceCompatibility = '17'
25+
}
2326

2427
apply from: "test.gradle"
25-
apply from: "library.gradle"
2628
apply from: "sonarcloud.gradle"
29+
apply from: "library.gradle"
2730

2831
repositories {
2932
mavenCentral()
30-
maven {
31-
url "https://nexus.bitweb.ee/repository/maven-public/"
32-
}
3333
}
3434

3535
dependencies {
@@ -88,10 +88,10 @@ dependencies {
8888
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-amqp', version: "${springBootVersion}"
8989

9090
// https://mvnrepository.com/artifact/org.json/json
91-
testImplementation group: 'org.json', name: 'json', version: '20230227'
91+
testImplementation group: 'org.json', name: 'json', version: '20231013'
9292

93-
// https://bitbucket.org/bitwebou/java-core-test-lib/src/master/
94-
testImplementation group: 'ee.bitweb', name: 'test-core-lib', version: '1.+'
93+
// https://mvnrepository.com/artifact/ee.bitweb/spring-test-core
94+
testImplementation group: 'ee.bitweb', name: 'spring-test-core', version: '2.+'
9595

9696
// https://mvnrepository.com/artifact/org.mockito/mockito-inline
9797
testImplementation group: 'org.mockito', name: 'mockito-inline', version: "${mockitoVersion}"

‎gradle/wrapper/gradle-wrapper.jar‎

346 Bytes
Binary file not shown.

‎gradle/wrapper/gradle-wrapper.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

‎gradlew‎

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎library.gradle‎

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: 'java-library'
22
apply plugin: 'maven-publish'
33
apply plugin: 'signing'
4+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
45

56
java {
67
withJavadocJar()
@@ -25,10 +26,35 @@ publishing {
2526
}
2627
developers {
2728
developer {
28-
id = 'erichjag'
29+
id = 'Jorich'
2930
name = 'Erich Jagomägis'
3031
email = 'erich@bitweb.ee'
3132
}
33+
developer {
34+
id = 'rammrain'
35+
name = 'Rain Ramm'
36+
email = 'rain@bitweb.ee'
37+
}
38+
developer {
39+
id = 'meritlaidroo'
40+
name = 'Merit Laidroo'
41+
email = 'merit.laidroo@bitweb.ee'
42+
}
43+
developer {
44+
id = 'taavisikk'
45+
name = 'Taavi Sikk'
46+
email = 'taavi.sikk@bitweb.ee'
47+
}
48+
developer {
49+
id = 'ennoeller'
50+
name = 'Enno Eller'
51+
email = 'enno.eller@bitweb.ee'
52+
}
53+
developer {
54+
id = 'pr11t'
55+
name = 'Priit Pärkson'
56+
email = 'priit.parkson@bitweb.ee'
57+
}
3258
}
3359
scm {
3460
connection = 'scm:https://github.com/BitWeb/java-core-lib.git'
@@ -38,12 +64,14 @@ publishing {
3864
}
3965
}
4066
}
67+
}
68+
69+
nexusPublishing {
4170
repositories {
42-
maven {
43-
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
44-
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
45-
url = version.contains('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
46-
credentials {
71+
if (project.hasProperty('mavenCentralUsername') & project.hasProperty('mavenCentralPassword')) {
72+
sonatype {
73+
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
74+
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots"))
4775
username = project.mavenCentralUsername
4876
password = project.mavenCentralPassword
4977
}
@@ -52,6 +80,9 @@ publishing {
5280
}
5381

5482
signing {
83+
if (project.hasProperty("signingKey") & project.hasProperty("signingPassword")) {
84+
useInMemoryPgpKeys(project.signingKey, project.signingPassword)
85+
}
5586
sign publishing.publications.mavenJava
5687
}
5788

‎sonarcloud.gradle‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ buildscript {
66
}
77
}
88
dependencies {
9-
classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.3.1.3277")
9+
classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373")
1010
}
1111
}
1212
apply plugin: org.sonarqube.gradle.SonarQubePlugin
1313

1414
sonarqube {
1515
properties {
16+
property "sonar.organization", "bitwebou"
1617
property "sonar.projectName", "java-core-lib"
18+
property "sonar.projectKey", "bitwebou_java-core-lib"
19+
property "sonar.host.url", "https://sonarcloud.io"
1720
property "sonar.exclusions", "build/generated/**"
1821
}
1922
}

0 commit comments

Comments
 (0)