From 9f3706a0c1ccdf3c956b3b9e0a6231c8d2dd82a1 Mon Sep 17 00:00:00 2001 From: Miguel Prieto Date: Tue, 17 Sep 2024 15:53:24 -0400 Subject: [PATCH] Initial workflows to build and publish Java client v4 --- .github/workflows/java-client-v4-build.yml | 37 ++++++++++ .../java-client-v4-integration-tests.yml | 70 +++++++++++++++++++ .../java-client-v4-publish-release.yml | 43 ++++++++++++ .../java/conductor-java-sdk/gradle.properties | 2 +- 4 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/java-client-v4-build.yml create mode 100644 .github/workflows/java-client-v4-integration-tests.yml create mode 100644 .github/workflows/java-client-v4-publish-release.yml diff --git a/.github/workflows/java-client-v4-build.yml b/.github/workflows/java-client-v4-build.yml new file mode 100644 index 000000000..c896265ac --- /dev/null +++ b/.github/workflows/java-client-v4-build.yml @@ -0,0 +1,37 @@ +name: Java Client v4 Build + +on: + push: + branches: + - main + paths: + - 'conductor-clients/java/conductor-java-sdk/**' + pull_request: + branches: + - main + paths: + - 'conductor-clients/java/conductor-java-sdk/**' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + name: Java Client v4 Build + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Zulu JDK 17 + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: "17" + - name: Build + run: | + cd conductor-clients/java/conductor-java-sdk + ./gradlew clean build -x :tests:build + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: always() + with: + report_paths: 'conductor-clients/java/**/build/test-results/test/TEST-*.xml' + diff --git a/.github/workflows/java-client-v4-integration-tests.yml b/.github/workflows/java-client-v4-integration-tests.yml new file mode 100644 index 000000000..942c3667c --- /dev/null +++ b/.github/workflows/java-client-v4-integration-tests.yml @@ -0,0 +1,70 @@ +name: Java Client v4 Integration Tests + +on: + workflow_run: + workflows: ["Java Client v4 Build"] + types: + - completed + +jobs: + integrations-tests: + runs-on: ubuntu-latest + environment: integration-tests + if: ${{ github.event.workflow_run.conclusion == 'success' }} + name: Java Client v4 Integration test + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_sha }} + repository: ${{ github.event.workflow_run.repository.full_name }} + - name: Set up Zulu JDK 17 + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: "17" + - name: Run Integration tests + run: | + cd conductor-clients/java/conductor-java-sdk + ./gradlew -p tests test + env: + CONDUCTOR_SERVER_URL: ${{ secrets.CONDUCTOR_SERVER_URL }} + CONDUCTOR_SERVER_AUTH_KEY: ${{ secrets.CONDUCTOR_SERVER_AUTH_KEY }} + CONDUCTOR_SERVER_AUTH_SECRET: ${{ secrets.CONDUCTOR_SERVER_AUTH_SECRET }} + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: always() + with: + report_paths: 'conductor-clients/java/**/build/test-results/test/TEST-*.xml' + - name: Set PR Status to Failure + if: ${{ failure() }} + uses: actions/github-script@v6 + with: + script: | + const { owner, repo } = context.repo; + const sha = context.payload.workflow_run.head_sha; + await github.rest.repos.createCommitStatus({ + owner: owner, + repo: repo, + sha: sha, + state: 'failure', + context: 'Java Client v4 Integration Tests', + description: 'Integration tests failed.', + }); + - name: Set PR Status to Success + if: ${{ success() }} + uses: actions/github-script@v6 + with: + script: | + const { owner, repo } = context.repo; + const sha = context.payload.workflow_run.head_sha; + await github.rest.repos.createCommitStatus({ + owner: owner, + repo: repo, + sha: sha, + state: 'success', + context: 'Java Client v4 Integration Tests', + description: 'Integration tests succeeded.', + }); + + diff --git a/.github/workflows/java-client-v4-publish-release.yml b/.github/workflows/java-client-v4-publish-release.yml new file mode 100644 index 000000000..63b4717bd --- /dev/null +++ b/.github/workflows/java-client-v4-publish-release.yml @@ -0,0 +1,43 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Publish Java Client v4 to Maven Central + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to publish (e.g., v1.0.0)' + required: true + maven_central: + description: 'Publish to Maven Central' + required: true + default: 'true' + +jobs: + publish: + runs-on: ubuntu-latest + environment: prod + name: Gradle Build and Publish + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Set up Zulu JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + - name: Publish + run: | + export VERSION="${{ github.event.inputs.version }}" + export CONDUCTOR_CLIENT_VERSION=`echo ${VERSION:1}` + echo Publishing version $CONDUCTOR_CLIENT_VERSION + cd conductor-clients/java/conductor-java-sdk + ./gradlew publish -Pversion=$CONDUCTOR_CLIENT_VERSION -PmavenCentral=${{ github.event.inputs.maven_central }} -Pusername=${{ secrets.SONATYPE_USERNAME }} -Ppassword=${{ secrets.SONATYPE_PASSWORD }} + env: + ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} + diff --git a/conductor-clients/java/conductor-java-sdk/gradle.properties b/conductor-clients/java/conductor-java-sdk/gradle.properties index d8cbc6bb0..2cf0dd1ea 100644 --- a/conductor-clients/java/conductor-java-sdk/gradle.properties +++ b/conductor-clients/java/conductor-java-sdk/gradle.properties @@ -1 +1 @@ -version=3.0.0-alpha16-SNAPSHOT +version=4.0.0-alpha-SNAPSHOT