Skip to content

Commit

Permalink
CUST-110209: do maven release on push and use the new SDK in smoke test.
Browse files Browse the repository at this point in the history
  • Loading branch information
cleverchuk committed Aug 20, 2024
1 parent 1dc2c0b commit 4b69e70
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ jobs:
java-version: '17'
distribution: 'temurin'

- name: Set agent version env
run: |
./gradlew build -x test
echo "AGENT_VERSION=$(cd agent/build/libs && unzip -p solarwinds-apm-agent.jar META-INF/MANIFEST.MF | grep Implementation-Version | awk '{ print $2 }' | sed 's/[^a-z0-9.-]//g')" >> $GITHUB_ENV
- name: Run application
working-directory: smoke-tests
run: |
Expand Down Expand Up @@ -430,6 +435,8 @@ jobs:

maven_staging_release:
runs-on: ubuntu-latest
env:
SNAPSHOT_BUILD: true
steps:
- uses: actions/checkout@v4

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: Release
on:
workflow_dispatch:
inputs:
run_maven_release:
type: boolean
default: false
required: false
description: Choose whether to do maven release
run_github_release:
type: boolean
default: false
Expand All @@ -29,6 +34,31 @@ env:
PROD_BUCKET: ${{ secrets.PROD_BUCKET }}

jobs:
maven_release:
if: inputs.run_maven_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

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

- name: Publish
run: ./gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The secrets are for publishing the build artifacts to the Maven Central.
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}

github_release:
if: inputs.run_github_release
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions smoke-tests/netty-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ repositories {
}
}

val sdkVersion = System.getenv("AGENT_VERSION") ?: "2.6.0"
dependencies {
implementation("io.netty:netty-common:4.1.94.Final")
implementation("io.github.appoptics:solarwinds-otel-sdk:2.6.0")
implementation("io.github.appoptics:solarwinds-otel-sdk:$sdkVersion-SNAPSHOT")
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
Expand All @@ -48,7 +49,6 @@ tasks.test {
}

val swoAgentPath = project.buildDir.toString() + "/swo/solarwinds-apm-agent.jar"

fun getAgentPath(downloadPath: String) = if (System.getenv("AGENT_PATH") == null) downloadPath
else System.getenv("AGENT_PATH")

Expand Down
23 changes: 9 additions & 14 deletions solarwinds-otel-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,26 @@ publishing {
name = 'Apache License, Version 2.0'
}
}

groupId = 'io.github.appoptics'
artifactId = "${archivesBaseName}"
version = "${versions.agent}-SNAPSHOT"
version = Boolean.parseBoolean(System.getenv("SNAPSHOT_BUILD")) ? "${versions.agent}-SNAPSHOT" : "${versions.agent}"

from components.java
artifact sourcesJar
artifact javadocJar
}
}
publishToMavenLocal
}

repositories {
// maven {
// name = "OSSRH"
// url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
// credentials {
// username = System.getenv("SONATYPE_USERNAME")
// password = System.getenv("SONATYPE_TOKEN")
// }
// }
maven {
name = "OSSRH-SNAPSHOT"
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
name = "OSSRH"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"

url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_TOKEN")
Expand All @@ -113,8 +111,6 @@ publishing {
}
}



signing {
setRequired {
gradle.taskGraph.allTasks.any { (it.getClass() == PublishToMavenRepository.class) }
Expand All @@ -125,7 +121,6 @@ signing {
sign publishing.publications.mavenJava
}


test {
useJUnitPlatform()
testLogging {
Expand Down

0 comments on commit 4b69e70

Please sign in to comment.