Skip to content

Commit 46bf5df

Browse files
[RM] Support #86256. Migrated CI to GitHub workflow
1 parent d6dac5a commit 46bf5df

File tree

6 files changed

+154
-53
lines changed

6 files changed

+154
-53
lines changed

.github/workflows/ci-workflow.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build and Publish Release Version
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Set up JDK 11
12+
uses: actions/setup-java@v4
13+
with:
14+
java-version: 11
15+
distribution: liberica
16+
17+
- name: Setup Gradle
18+
uses: gradle/actions/setup-gradle@v3
19+
with:
20+
gradle-version: wrapper
21+
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Build project and run tests
26+
run: ./gradlew clean build
27+
28+
- name: Store test results
29+
if: always()
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: reports
33+
path: |
34+
**/build/reports/
35+
**/build/test-results/
36+
37+
- name: Upload archives
38+
env:
39+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
40+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
41+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
42+
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}
43+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
44+
run: |
45+
./gradlew artifactoryPublish \
46+
-Psigning.keyId=$SIGNING_KEY_ID \
47+
-Psigning.secretKey=$SIGNING_SECRET_KEY \
48+
-Psigning.password=$SIGNING_PASSWORD \
49+
-PossrhUsername=$OSSRH_USERNAME \
50+
-PossrhPassword=$OSSRH_PASSWORD
51+
52+
- name: Read version of the project
53+
id: read_project_version
54+
run: |
55+
VERSION=$(./gradlew properties | grep -w "version" | cut -d ':' -f 2 | xargs)
56+
echo "Version found: ${VERSION}"
57+
echo "project_version=${VERSION}" >> $GITHUB_OUTPUT
58+
59+
- name: Create Tag
60+
uses: actions/github-script@v5
61+
with:
62+
script: |
63+
github.rest.git.createRef({
64+
owner: context.repo.owner,
65+
repo: context.repo.repo,
66+
ref: "refs/tags/v${{ steps.read_project_version.outputs.project_version }}",
67+
sha: context.sha
68+
})
69+
70+
- name: Create Github Release
71+
uses: actions/create-release@v1
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
with:
75+
tag_name: "v${{ steps.read_project_version.outputs.project_version }}"
76+
release_name: "Release v${{ steps.read_project_version.outputs.project_version }}"
77+
body: "Release of version ${{ steps.read_project_version.outputs.project_version }}"
78+
draft: false
79+
prerelease: false

build.gradle

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/******************************************************************************
2-
* Copyright 2009-2018 Exactpro (Exactpro Systems Limited)
2+
* Copyright 2009-2024 Exactpro (Exactpro Systems Limited)
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,6 +14,10 @@
1414
* limitations under the License.
1515
******************************************************************************/
1616

17+
plugins {
18+
id 'jacoco'
19+
}
20+
1721
allprojects {
1822
ext {
1923
sharedDir = file("${project.rootDir}/shared")
@@ -22,8 +26,8 @@ allprojects {
2226
genDir = file("${srcDir}/gen")
2327
genJavaDir = file("${genDir}/java")
2428

25-
incremental_build = project.hasProperty('i') ? true : false
26-
sonatype_publish = project.hasProperty('sonatypePublish') ? true : false
29+
incremental_build = project.hasProperty('i')
30+
sonatype_publish = project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')
2731

2832
// Set defaults
2933
if (!project.hasProperty("revision")) {
@@ -37,34 +41,32 @@ allprojects {
3741
}
3842
//Lib versions
3943
version_slf4j = '1.7.5'
40-
41-
exactproVersion = '12'
4244
}
4345
}
4446

47+
version = "${quickfixjPrefixVersion}.${exactproVersion}"
48+
4549
subprojects {
4650
apply plugin: 'eclipse'
47-
apply plugin: 'jacoco'
4851
apply plugin: 'java'
49-
apply plugin: 'maven'
52+
apply plugin: 'maven-publish'
5053

5154
if (sonatype_publish) {
5255
apply plugin: 'signing'
5356
}
5457

5558
group = 'com.exactpro.quickfixj'
56-
version = "1.6.0.${exactproVersion}"
5759

58-
sourceCompatibility = 1.7 //Java version compatibility to use when compiling Java source.
59-
targetCompatibility = 1.7 //Java version to generate classes for.
60+
sourceCompatibility = JavaVersion.VERSION_1_7 //Java version compatibility to use when compiling Java source.
61+
targetCompatibility = JavaVersion.VERSION_1_7 //Java version to generate classes for.
6062
compileJava.options.debugOptions.debugLevel = "source,lines,vars" // Include debug information
6163

6264
buildscript { // artifacrory plugin
6365
repositories {
6466
jcenter()
6567
}
6668
dependencies {
67-
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.2.+')
69+
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '4.4.12')
6870
classpath(group: 'com.netflix.nebula', name: 'gradle-extra-configurations-plugin', version: '2.2.+')
6971
}
7072

@@ -82,7 +84,7 @@ subprojects {
8284
}
8385

8486
configurations {
85-
compile.exclude module: 'avalon-framework-api'
87+
implementation.exclude module: 'avalon-framework-api'
8688

8789
all {
8890
transitive = true
@@ -127,20 +129,14 @@ subprojects {
127129
}
128130
}
129131

130-
uploadArchives {
131-
repositories {
132-
mavenDeployer {
132+
publishing {
133+
publications {
134+
mavenJava(MavenPublication) {
133135
if (sonatype_publish) {
134-
beforeDeployment {
135-
MavenDeployment deployment -> signing.signPom(deployment)
136-
}
137-
138-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
139-
authentication(userName: ossrhUsername, password: ossrhPassword)
140-
}
141-
142-
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots") {
143-
authentication(userName: ossrhUsername, password: ossrhPassword)
136+
beforeDeployment {
137+
signing {
138+
sign deployment
139+
}
144140
}
145141

146142
pom.project {
@@ -171,22 +167,45 @@ subprojects {
171167
}
172168
}
173169
}
174-
} else {
175-
// uniqueVersion = false // publish non unique snapshots to local repository
176-
repository(url: "file://${sharedDir}")
177170
}
178171
}
179172
}
180-
doFirst { sharedDir.mkdirs() }
173+
174+
repositories {
175+
if (sonatype_publish) {
176+
maven {
177+
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
178+
credentials {
179+
username = ossrhUsername
180+
password = ossrhPassword
181+
}
182+
}
183+
maven {
184+
url = "https://oss.sonatype.org/content/repositories/snapshots"
185+
credentials {
186+
username = ossrhUsername
187+
password = ossrhPassword
188+
}
189+
}
190+
} else {
191+
// uniqueVersion = false // publish non unique snapshots to local repository
192+
sharedDir.mkdirs()
193+
maven {
194+
url = "file://${sharedDir}"
195+
}
196+
}
197+
}
181198
}
182199

183-
task sourcesJar(type: Jar, dependsOn: classes) {
184-
classifier = 'sources'
200+
tasks.register('sourcesJar', Jar) {
201+
dependsOn classes
202+
archiveClassifier = 'sources'
185203
from sourceSets.main.allSource
186204
}
187205

188-
task javadocJar(type: Jar, dependsOn: classes) {
189-
classifier = 'javadoc'
206+
tasks.register('javadocJar', Jar) {
207+
dependsOn classes
208+
archiveClassifier = 'javadoc'
190209
from javadoc
191210
}
192211

gradle.properties

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#/******************************************************************************
2-
#* Copyright 2009-2018 Exactpro (Exactpro Systems Limited)
2+
#* Copyright 2009-2024 Exactpro (Exactpro Systems Limited)
33
#*
44
#* Licensed under the Apache License, Version 2.0 (the "License");
55
#* you may not use this file except in compliance with the License.
@@ -14,5 +14,8 @@
1414
#* limitations under the License.
1515
#******************************************************************************/
1616

17-
org.gradle.daemon true
18-
org.gradle.daemon.idletimeout 10000
17+
org.gradle.daemon=true
18+
org.gradle.daemon.idletimeout=10000
19+
20+
quickfixjPrefixVersion=1.6.0
21+
exactproVersion=12

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip

quickfixj-codegenerator/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
******************************************************************************/
1616

17-
apply plugin: 'artifactory'
17+
apply plugin: 'com.jfrog.artifactory'
1818

1919
archivesBaseName = 'quickfixj-code-generator'
2020

quickfixj-core/build.gradle

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* limitations under the License.
1515
******************************************************************************/
1616

17-
apply plugin: 'artifactory'
18-
apply plugin: 'provided-base'
17+
apply plugin: 'com.jfrog.artifactory'
18+
// apply plugin: 'provided-base'
1919

2020
ext {
2121
dictDir = file('src/main/dicts')
@@ -39,24 +39,24 @@ sourceSets {
3939

4040
dependencies {
4141
if (incremental_build) {
42-
compile 'com.exactpro.quickfixj:quickfixj-code-generator:1.6.0.1-SNAPSHOT'
42+
implementation 'com.exactpro.quickfixj:quickfixj-code-generator:1.6.0.1-SNAPSHOT'
4343
} else {
44-
compile project(':quickfixj-codegenerator')
44+
implementation project(':quickfixj-codegenerator')
4545
}
4646

47-
compile 'com.exactpro.mina:apache-mina-core:2.0.9.1'
47+
implementation 'com.exactpro.mina:apache-mina-core:2.0.9.1'
4848

49-
compile "org.slf4j:slf4j-api:${version_slf4j}"
49+
implementation "org.slf4j:slf4j-api:${version_slf4j}"
5050

51-
compile 'com.cloudhopper.proxool:proxool:0.9.1'
51+
implementation 'com.cloudhopper.proxool:proxool:0.9.1'
5252

53-
testCompile 'junit:junit:4.10'
54-
testCompile 'org.mockito:mockito-all:1.10.19'
55-
testCompile 'org.mockito:mockito-core:1.10.19'
56-
testCompile 'org.hamcrest:hamcrest-all:1.1'
57-
testCompile 'hsqldb:hsqldb:1.8.0.10'
58-
testCompile 'tyrex:tyrex:1.0.1'
59-
testCompile "org.slf4j:slf4j-jdk14:${version_slf4j}"
53+
testImplementation 'junit:junit:4.10'
54+
testImplementation 'org.mockito:mockito-all:1.10.19'
55+
testImplementation 'org.mockito:mockito-core:1.10.19'
56+
testImplementation 'org.hamcrest:hamcrest-all:1.1'
57+
testImplementation 'hsqldb:hsqldb:1.8.0.10'
58+
testImplementation 'tyrex:tyrex:1.0.1'
59+
testImplementation "org.slf4j:slf4j-jdk14:${version_slf4j}"
6060
}
6161

6262
task generateMessage {
@@ -94,5 +94,5 @@ test {
9494
/*afterTest { desc, result ->
9595
println "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}. Time: ${(result.endTime - result.startTime)/1000}s"
9696
}*/
97-
testLogging.showStandardStreams = true
97+
// testLogging.showStandardStreams = true
9898
}

0 commit comments

Comments
 (0)