From a8e11b9db79e95f72f0391ff29f9df867e00fae6 Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Wed, 8 Oct 2025 17:23:19 +0900 Subject: [PATCH 1/2] WIP: initial poc of publishing workflows --- .github/workflows/ci-release.yml | 91 +++++++++++++++++++++++++++++++ .github/workflows/ci-snapshot.yml | 86 +++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 .github/workflows/ci-release.yml create mode 100644 .github/workflows/ci-snapshot.yml diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml new file mode 100644 index 00000000..81dd38c2 --- /dev/null +++ b/.github/workflows/ci-release.yml @@ -0,0 +1,91 @@ +name: Release Publisher +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+(-[0-9a-z]+)?" +jobs: + build: + name: Release JDK (${{ matrix.os_version }} swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + swift_version: ['6.1.3'] + os_version: ['jammy'] + jdk_vendor: ['corretto'] + java: ['25'] + container: + image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }} + steps: + - uses: actions/checkout@v5 + - name: Check NO SNAPSHOT version suffix + run: if [[ $(cat gradle.properties | grep version= | sed 's/^version=//') =~ .*-SNAPSHOT ]]; then exit 1; else exit 0; fi + - name: Prepare CI Environment + uses: ./.github/actions/prepare_env + - name: Set up jdk:${{matrix.jdk_vendor}} ${{matrix.java}} + uses: actions/setup-java@v5 + with: + java-version: ${{ matrix.java }} + distribution: ${{ matrix.jdk_vendor }} + cache: 'gradle' + - name: Print JDK Version + run: java -version + - name: Make gradlew Executable + run: chmod +x gradlew + - name: Clean Gradle project + run: ./gradlew --parallel clean + - name: Build with Gradle + env: + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }} + run: | + # Build arguments to feed to the single gradlew publish command + FIRST_GRADLE_TARGETS=" check" + SECOND_GRADLE_TARGETS=" --no-parallel publish" + + # Execute the gradlew command to publish the build + sudo -E env "PATH=$PATH" bash -c "ulimit -l 65536 && ulimit -a && ./gradlew --no-daemon --parallel -PreleaseBuild=true$FIRST_GRADLE_TARGETS && ./gradlew --no-daemon --no-parallel -PreleaseBuild=true$SECOND_GRADLE_TARGETS" + - name: Central Portal manual Repo Close + # Details at https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuring-the-repository + env: + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }} + run: | + BEARER_TOKEN=$(printf "$SONATYPE_USER:$SONATYPE_TOKEN" | base64) + curl -i --retry 5 -H "Authorization: Bearer $BEARER_TOKEN" -X POST https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/io.servicetalk + echo '********************************************************************************************' + echo '* *' + echo "* Go to https://central.sonatype.com/publishing/deployments to finish publishing artifacts *" + echo '* *' + echo '********************************************************************************************' + - name: Publish Test Results + if: always() + uses: scacap/action-surefire-report@5609ce4db72c09db044803b344a8968fd1f315da + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + report_paths: '**/build/test-results/test/TEST-*.xml' + check_name: Test Report JDK ${{ matrix.java }} + - name: Publish Checkstyle Report + if: always() + uses: jwgmeligmeyling/checkstyle-github-action@50292990e18466f2c5d95d04ff5fab931254fa5f + with: + name: Checkstyle Report JDK ${{ matrix.java }} + path: '**/build/reports/checkstyle/*.xml' + token: ${{ secrets.GITHUB_TOKEN }} + - name: Publish PMD Report + if: always() + uses: jwgmeligmeyling/pmd-github-action@322e346bd76a0757c4d54ff9209e245965aa066d + with: + name: PMD Report JDK ${{ matrix.java }} + path: '**/build/reports/pmd/*.xml' + token: ${{ secrets.GITHUB_TOKEN }} + - name: Publish SpotBugs Report + if: always() + # v1.2 + uses: jwgmeligmeyling/spotbugs-github-action@b8e2c3523acb34c87f14e18cbcd2d87db8c8584e + with: + name: SpotBugs Report JDK ${{ matrix.java }} + path: '**/build/reports/spotbugs/*.xml' + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci-snapshot.yml b/.github/workflows/ci-snapshot.yml new file mode 100644 index 00000000..b0fdf354 --- /dev/null +++ b/.github/workflows/ci-snapshot.yml @@ -0,0 +1,86 @@ +name: Snapshot Publisher +on: + push: + branches: [ main ] + tags-ignore: + - "[0-9]+.[0-9]+.[0-9]+(-[0-9a-z]+)?" + paths-ignore: + - 'docs/**' + - 'scripts/**' + - '.github/pull_request_template.md' + - '.gitignore' + - 'gradlew' + - 'gradlew.bat' + - '**.adoc' + - '*.txt' +jobs: + build: + name: Release JDK (${{ matrix.os_version }} swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + swift_version: ['6.1.3'] + os_version: ['jammy'] + jdk_vendor: ['corretto'] + java: ['25'] + container: + image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }} + steps: + - uses: actions/checkout@v5 + - name: Check NO SNAPSHOT version suffix + run: if [[ $(cat gradle.properties | grep version= | sed 's/^version=//') =~ .*-SNAPSHOT ]]; then exit 1; else exit 0; fi + - name: Prepare CI Environment + uses: ./.github/actions/prepare_env + - name: Set up jdk:${{matrix.jdk_vendor}} ${{matrix.java}} + uses: actions/setup-java@v5 + with: + java-version: ${{ matrix.java }} + distribution: ${{ matrix.jdk_vendor }} + cache: 'gradle' + - name: Print JDK Version + run: java -version + - name: Make gradlew Executable + run: chmod +x gradlew + - name: Clean Gradle project + run: ./gradlew --parallel clean + - name: Build with Gradle + env: + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }} + run: | + FIRST_GRADLE_TARGETS=" check" + SECOND_GRADLE_TARGETS=" publish" + + # Execute the gradlew command to publish the build + sudo -E env "PATH=$PATH" bash -c "ulimit -l 65536 && ulimit -a && ./gradlew --no-daemon --parallel$FIRST_GRADLE_TARGETS && ./gradlew --no-daemon --no-parallel$SECOND_GRADLE_TARGETS" + - name: Publish Test Results + if: always() + uses: scacap/action-surefire-report@5609ce4db72c09db044803b344a8968fd1f315da + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + report_paths: '**/build/test-results/test/TEST-*.xml' + check_name: Test Report JDK ${{ matrix.java }} + - name: Publish Checkstyle Report + if: always() + uses: jwgmeligmeyling/checkstyle-github-action@50292990e18466f2c5d95d04ff5fab931254fa5f + with: + name: Checkstyle Report JDK ${{ matrix.java }} + path: '**/build/reports/checkstyle/*.xml' + token: ${{ secrets.GITHUB_TOKEN }} + - name: Publish PMD Report + if: always() + uses: jwgmeligmeyling/pmd-github-action@322e346bd76a0757c4d54ff9209e245965aa066d + with: + name: PMD Report JDK ${{ matrix.java }} + path: '**/build/reports/pmd/*.xml' + token: ${{ secrets.GITHUB_TOKEN }} + - name: Publish SpotBugs Report + if: always() + uses: jwgmeligmeyling/spotbugs-github-action@b8e2c3523acb34c87f14e18cbcd2d87db8c8584e + with: + name: SpotBugs Report JDK ${{ matrix.java }} + path: '**/build/reports/spotbugs/*.xml' + token: ${{ secrets.GITHUB_TOKEN }} From dad887e193c26e6aad5c92f89f5bb7fa5de8f708 Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Wed, 8 Oct 2025 17:25:25 +0900 Subject: [PATCH 2/2] just debugging the workflow --- .github/workflows/ci-release.yml | 4 +- .github/workflows/ci-snapshot.yml | 60 +++++++++++++----------------- .github/workflows/pull_request.yml | 9 ++++- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 81dd38c2..a6a18a30 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -1,4 +1,4 @@ -name: Release Publisher +name: 'Publish (Java): RELEASE' on: push: tags: @@ -13,7 +13,7 @@ jobs: swift_version: ['6.1.3'] os_version: ['jammy'] jdk_vendor: ['corretto'] - java: ['25'] + jdk_version: [ 24, 17 ] container: image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }} steps: diff --git a/.github/workflows/ci-snapshot.yml b/.github/workflows/ci-snapshot.yml index b0fdf354..157be178 100644 --- a/.github/workflows/ci-snapshot.yml +++ b/.github/workflows/ci-snapshot.yml @@ -1,21 +1,24 @@ -name: Snapshot Publisher +name: 'Publish (Java): SNAPSHOT' +# on: +# push: +# branches: [ main ] +# tags-ignore: +# - "[0-9]+.[0-9]+.[0-9]+(-[0-9a-z]+)?" +# paths-ignore: +# - 'docs/**' +# - 'scripts/**' +# - '.github/pull_request_template.md' +# - '.gitignore' +# - 'gradlew' +# - 'gradlew.bat' +# - '**.adoc' +# - '*.txt' on: - push: - branches: [ main ] - tags-ignore: - - "[0-9]+.[0-9]+.[0-9]+(-[0-9a-z]+)?" - paths-ignore: - - 'docs/**' - - 'scripts/**' - - '.github/pull_request_template.md' - - '.gitignore' - - 'gradlew' - - 'gradlew.bat' - - '**.adoc' - - '*.txt' + pull_request: + types: [opened, reopened, synchronize] jobs: build: - name: Release JDK (${{ matrix.os_version }} swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}}) + name: Publish Java libs (${{ matrix.os_version }} swift:${{ matrix.swift_version }} jdk:${{ matrix.jdk_vendor }}) runs-on: ubuntu-latest strategy: fail-fast: false @@ -23,7 +26,6 @@ jobs: swift_version: ['6.1.3'] os_version: ['jammy'] jdk_vendor: ['corretto'] - java: ['25'] container: image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }} steps: @@ -32,55 +34,45 @@ jobs: run: if [[ $(cat gradle.properties | grep version= | sed 's/^version=//') =~ .*-SNAPSHOT ]]; then exit 1; else exit 0; fi - name: Prepare CI Environment uses: ./.github/actions/prepare_env - - name: Set up jdk:${{matrix.jdk_vendor}} ${{matrix.java}} - uses: actions/setup-java@v5 - with: - java-version: ${{ matrix.java }} - distribution: ${{ matrix.jdk_vendor }} - cache: 'gradle' - - name: Print JDK Version - run: java -version - name: Make gradlew Executable run: chmod +x gradlew - name: Clean Gradle project run: ./gradlew --parallel clean - - name: Build with Gradle + # TODO: run tests here + - name: Publish with Gradle env: ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} SONATYPE_USER: ${{ secrets.SONATYPE_USER }} SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }} run: | - FIRST_GRADLE_TARGETS=" check" - SECOND_GRADLE_TARGETS=" publish" - - # Execute the gradlew command to publish the build - sudo -E env "PATH=$PATH" bash -c "ulimit -l 65536 && ulimit -a && ./gradlew --no-daemon --parallel$FIRST_GRADLE_TARGETS && ./gradlew --no-daemon --no-parallel$SECOND_GRADLE_TARGETS" + # Execute the gradle command to publish the project + ./gradlew --no-daemon --no-parallel publish - name: Publish Test Results if: always() uses: scacap/action-surefire-report@5609ce4db72c09db044803b344a8968fd1f315da with: github_token: ${{ secrets.GITHUB_TOKEN }} report_paths: '**/build/test-results/test/TEST-*.xml' - check_name: Test Report JDK ${{ matrix.java }} + check_name: Test Report - name: Publish Checkstyle Report if: always() uses: jwgmeligmeyling/checkstyle-github-action@50292990e18466f2c5d95d04ff5fab931254fa5f with: - name: Checkstyle Report JDK ${{ matrix.java }} + name: Checkstyle Report path: '**/build/reports/checkstyle/*.xml' token: ${{ secrets.GITHUB_TOKEN }} - name: Publish PMD Report if: always() uses: jwgmeligmeyling/pmd-github-action@322e346bd76a0757c4d54ff9209e245965aa066d with: - name: PMD Report JDK ${{ matrix.java }} + name: PMD Report path: '**/build/reports/pmd/*.xml' token: ${{ secrets.GITHUB_TOKEN }} - name: Publish SpotBugs Report if: always() uses: jwgmeligmeyling/spotbugs-github-action@b8e2c3523acb34c87f14e18cbcd2d87db8c8584e with: - name: SpotBugs Report JDK ${{ matrix.java }} + name: SpotBugs Report path: '**/build/reports/spotbugs/*.xml' token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ffc42e3c..e61aacf8 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -30,6 +30,7 @@ jobs: swift_version: ['6.1.3'] os_version: ['jammy'] jdk_vendor: ['corretto'] + jdk_version: [ 24, 17 ] steps: - uses: actions/checkout@v4 - name: Prepare CI Environment @@ -48,6 +49,7 @@ jobs: swift_version: ['6.1.3', 'nightly'] os_version: ['jammy'] jdk_vendor: ['corretto'] + jdk_version: [ 24, 17 ] container: image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }} env: @@ -74,6 +76,7 @@ jobs: swift_version: ['6.2.0'] os_version: ['macos'] jdk_vendor: ['corretto'] + jdk_version: [ 24, 17 ] env: SWIFT_JAVA_VERBOSE: true steps: @@ -98,6 +101,7 @@ jobs: swift_version: ['6.2.0'] os_version: ['jammy'] jdk_vendor: ['corretto'] + jdk_version: [ 24, 17 ] container: image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }} env: @@ -140,6 +144,7 @@ jobs: swift_version: ['6.2.0'] os_version: ['macos'] jdk_vendor: ['corretto'] + jdk_version: [ 24, 17 ] env: SWIFT_JAVA_VERBOSE: true steps: @@ -160,6 +165,7 @@ jobs: swift_version: ['6.1.3', 'nightly'] os_version: ['jammy'] jdk_vendor: ['corretto'] + jdk_version: [ 24, 17 ] sample_app: [ # TODO: use a reusable-workflow to generate those names 'JavaDependencySampleApp', 'JavaKitSampleApp', @@ -180,7 +186,7 @@ jobs: verify-samples-macos: - name: Sample ${{ matrix.sample_app }} (${{ matrix.os_version }} swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}}) + name: Sample ${{ matrix.sample_app }} (${{ matrix.os_version }} swift:${{ matrix.swift_version }} jdk:${{ matrix.jdk_version }}-${{matrix.jdk_vendor}} runs-on: [self-hosted, macos, sequoia, ARM64] strategy: fail-fast: false @@ -188,6 +194,7 @@ jobs: swift_version: ['6.2.0'] # no nightly testing on macOS os_version: ['macos'] jdk_vendor: ['corretto'] + jdk_version: [ 24, 17 ] sample_app: [ # TODO: use a reusable-workflow to generate those names 'JavaDependencySampleApp', 'JavaKitSampleApp',