From 504212592ecfc62a985da28e696015a2622ad4bd Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 1 Dec 2023 16:40:40 -0500 Subject: [PATCH] Migrate CI/CD to GitHub Actions * Remove JFrog plugin since it is supplied from CI/CD by Gradle init script * Remove Sonar and Jacoco since we don't manage those service anymore --- .github/release-files-spec.json | 39 ------------- .github/workflows/central-sync-close.yml | 23 -------- .github/workflows/central-sync-create.yml | 57 ------------------- .github/workflows/central-sync-release.yml | 23 -------- .github/workflows/ci-snapshot.yml | 17 ++++-- .github/workflows/pr-build-workflow.yml | 47 --------------- .github/workflows/pr-build.yml | 10 ++++ .github/workflows/release.yml | 26 +++++++++ .github/workflows/verify-staged-artifacts.yml | 43 ++++++++++++++ build.gradle | 38 +------------ gradle/publish-maven.gradle | 5 -- 11 files changed, 91 insertions(+), 237 deletions(-) delete mode 100644 .github/release-files-spec.json delete mode 100644 .github/workflows/central-sync-close.yml delete mode 100644 .github/workflows/central-sync-create.yml delete mode 100644 .github/workflows/central-sync-release.yml delete mode 100644 .github/workflows/pr-build-workflow.yml create mode 100644 .github/workflows/pr-build.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/verify-staged-artifacts.yml diff --git a/.github/release-files-spec.json b/.github/release-files-spec.json deleted file mode 100644 index 386c371ca7..0000000000 --- a/.github/release-files-spec.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "files": [ - { - "aql": { - "items.find": { - "$and": [ - { - "@build.name": "${buildname}", - "@build.number": "${buildnumber}", - "path": { - "$match": "org*" - } - }, - { - "$or": [ - { - "name": { - "$match": "*.pom" - } - }, - { - "name": { - "$match": "*.jar" - } - }, - { - "name": { - "$match": "*.module" - } - } - ] - } - ] - } - }, - "target": "nexus/" - } - ] -} diff --git a/.github/workflows/central-sync-close.yml b/.github/workflows/central-sync-close.yml deleted file mode 100644 index bb694ef880..0000000000 --- a/.github/workflows/central-sync-close.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Central Sync Close - -on: - workflow_dispatch: - inputs: - stagedRepositoryId: - description: "Staged repository id" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - # Request close promotion repo - - uses: jvalkeal/nexus-sync@v0.0.2 - with: - url: ${{ secrets.OSSRH_URL }} - username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} - password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} - staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} - staging-repo-id: ${{ github.event.inputs.stagedRepositoryId }} - close: true diff --git a/.github/workflows/central-sync-create.yml b/.github/workflows/central-sync-create.yml deleted file mode 100644 index d2f37f1001..0000000000 --- a/.github/workflows/central-sync-create.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Central Sync Create - -on: - workflow_dispatch: - inputs: - buildName: - description: "Artifactory build name" - required: true - buildNumber: - description: "Artifactory build number" - required: true - -jobs: - build: - runs-on: ubuntu22-8-32 - steps: - - # to get spec file in .github - - uses: actions/checkout@v3 - - # Setup jfrog cli - - uses: jfrog/setup-jfrog-cli@v3 - env: - JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} - - # Extract build id from input - - name: Extract Build Id - run: | - echo JFROG_CLI_BUILD_NAME="${{ github.event.inputs.buildName }}" >> $GITHUB_ENV - echo JFROG_CLI_BUILD_NUMBER=${{ github.event.inputs.buildNumber }} >> $GITHUB_ENV - - # Download released files - - name: Download Release Files - run: | - jfrog rt download \ - --spec .github/release-files-spec.json \ - --spec-vars "buildname=$JFROG_CLI_BUILD_NAME;buildnumber=$JFROG_CLI_BUILD_NUMBER" - - # Create checksums, signatures and create staging repo on central and upload - - uses: jvalkeal/nexus-sync@v0.0.2 - id: nexus - with: - url: ${{ secrets.OSSRH_URL }} - username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} - password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} - staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} - create: true - upload: true - generate-checksums: true - pgp-sign: true - upload-parallel: 10 - pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }} - pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - - # Print staging repo id - - name: Print Staging Repo Id - run: echo ${{ steps.nexus.outputs.staged-repository-id }} diff --git a/.github/workflows/central-sync-release.yml b/.github/workflows/central-sync-release.yml deleted file mode 100644 index 4d4d27d0d1..0000000000 --- a/.github/workflows/central-sync-release.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Central Sync Release - -on: - workflow_dispatch: - inputs: - stagedRepositoryId: - description: "Staged repository id" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - # Request release promotion repo - - uses: jvalkeal/nexus-sync@v0.0.2 - with: - url: ${{ secrets.OSSRH_URL }} - username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} - password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} - staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} - staging-repo-id: ${{ github.event.inputs.stagedRepositoryId }} - release: true diff --git a/.github/workflows/ci-snapshot.yml b/.github/workflows/ci-snapshot.yml index 230abc8016..91b689f7d7 100644 --- a/.github/workflows/ci-snapshot.yml +++ b/.github/workflows/ci-snapshot.yml @@ -2,11 +2,16 @@ name: CI SNAPSHOT on: workflow_dispatch: -# push: -# branches: -# - main + push: + branches: + - main + - 6.1.x jobs: - build_snapshot: - uses: spring-projects/spring-integration-aws/.github/workflows/ci-snapshot.yml@main - secrets: inherit + build-snapshot: + uses: artembilan/spring-github-workflows/.github/workflows/spring-artifactory-gradle-snapshot.yml@main + secrets: + GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }} + GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} + GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} + JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} \ No newline at end of file diff --git a/.github/workflows/pr-build-workflow.yml b/.github/workflows/pr-build-workflow.yml deleted file mode 100644 index e5bf6860a2..0000000000 --- a/.github/workflows/pr-build-workflow.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Pull Request build - -on: - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - - services: - - rabbitmq: - image: rabbitmq:management - ports: - - 5672:5672 - - 15672:15672 - - steps: - - - uses: actions/checkout@v3 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17 - - - name: Run Gradle - uses: burrunan/gradle-cache-action@v1 - env: - SI_FATAL_WHEN_NO_BEANFACTORY: true - NO_REFERENCE_TASK: true - with: - debug: false - concurrent: true - gradle-build-scan-report: false - arguments: check - - - name: Capture Test Results - if: failure() - uses: actions/upload-artifact@v3 - with: - name: test-results - path: '*/build/reports/tests/**/*.*' - retention-days: 3 diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 0000000000..246f6a7f11 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,10 @@ +name: Pull Request Build + +on: + pull_request: + branches: + - main + +jobs: + build-pull-request: + uses: artembilan/spring-github-workflows/.github/workflows/spring-gradle-pull-request-build.yml@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..f2c3c9b3d0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release + +on: + workflow_dispatch: + +run-name: Release current version for branch ${{ github.ref_name }} + +jobs: + release: + permissions: + actions: write + + uses: artembilan/spring-github-workflows/.github/workflows/spring-artifactory-gradle-release.yml@main + secrets: + GH_ACTIONS_REPO_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} + GRADLE_ENTERPRISE_CACHE_USER: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }} + GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} + GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} + JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + OSSRH_URL: ${{ secrets.OSSRH_URL }} + OSSRH_S01_TOKEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} + OSSRH_S01_TOKEN_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} + OSSRH_STAGING_PROFILE_NAME: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + SPRING_RELEASE_SLACK_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/verify-staged-artifacts.yml b/.github/workflows/verify-staged-artifacts.yml new file mode 100644 index 0000000000..b7e024b11f --- /dev/null +++ b/.github/workflows/verify-staged-artifacts.yml @@ -0,0 +1,43 @@ +name: Verify Staged Artifacts + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: 'Release version like 5.0.0-M1, 5.1.0-RC1, 5.2.0 etc.' + required: true + type: string + +env: + GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }} + GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} + JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + +jobs: + verify-staged-with-samples: + runs-on: ubuntu-latest + steps: + + - name: Checkout Samples Repo + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-integration-samples + show-progress: false + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + cache: 'gradle' + + - uses: jfrog/setup-jfrog-cli@v3 + + - name: Configure JFrog Cli + run: jf gradlec --repo-resolve libs-staging-local + + - name: Verify Spring Integration Samples against staged release + run: | + sed -i "1,/springIntegrationVersion.*/s/springIntegrationVersion.*/springIntegrationVersion='${{ inputs.releaseVersion }}'/" build.gradle + jf gradle check diff --git a/build.gradle b/build.gradle index 8d0facb06a..c043970dbc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { ext.kotlinVersion = '1.9.10' - ext.isCI = System.getenv('GITHUB_ACTION') || System.getenv('bamboo_buildKey') + ext.isCI = System.getenv('GITHUB_ACTION') repositories { gradlePluginPortal() mavenCentral() @@ -16,11 +16,9 @@ buildscript { plugins { id 'base' - id 'org.sonarqube' version '4.3.1.3277' id 'io.spring.nohttp' version '0.0.11' apply false id 'org.ajoberstar.grgit' version '4.1.1' id 'io.spring.dependency-management' version '1.1.4' - id 'com.jfrog.artifactory' version '5.1.10' apply false id 'org.jetbrains.dokka' version "$kotlinVersion" id 'org.antora' version '1.0.0' id 'io.spring.antora.generate-antora-yml' version '0.0.1' @@ -190,7 +188,6 @@ configure(javaProjects) { subproject -> apply plugin: 'java-library' apply plugin: 'eclipse' apply plugin: 'idea' - apply plugin: 'jacoco' apply plugin: 'checkstyle' apply plugin: 'kotlin' apply plugin: 'kotlin-spring' @@ -218,7 +215,6 @@ configure(javaProjects) { subproject -> compileJava { options.release = 17 - options.compilerArgs << '-parameters' } compileTestJava { @@ -248,10 +244,6 @@ configure(javaProjects) { subproject -> } } - jacoco { - toolVersion = '0.8.10' - } - // dependencies that are common across all java projects dependencies { if (!(subproject.name ==~ /.*-test.*/)) { @@ -329,23 +321,9 @@ configure(javaProjects) { subproject -> compileKotlin.dependsOn updateCopyrights - jacocoTestReport { - onlyIf { System.properties['sonar.host.url'] } - dependsOn test - reports { - xml.required = true - html.required = false - } - } - - rootProject.tasks['sonarqube'].dependsOn jacocoTestReport - test { maxHeapSize = '2g' jvmArgs '-XX:+HeapDumpOnOutOfMemoryError' - jacoco { - destinationFile = file("$buildDir/jacoco.exec") - } } tasks.register('testAll', Test) { dependsOn['check'] } @@ -1101,20 +1079,6 @@ project('spring-integration-bom') { } } } - - sonar { - skipProject = true - } -} - -sonar { - properties { - property 'sonar.links.homepage', linkHomepage - property 'sonar.links.ci', linkCi - property 'sonar.links.issue', linkIssue - property 'sonar.links.scm', linkScmUrl - property 'sonar.links.scm_dev', linkScmDevConnection - } } tasks.register('api', Javadoc) { diff --git a/gradle/publish-maven.gradle b/gradle/publish-maven.gradle index 2068c80733..649f5f2b4e 100644 --- a/gradle/publish-maven.gradle +++ b/gradle/publish-maven.gradle @@ -1,5 +1,4 @@ apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.artifactory' publishing { publications { @@ -62,7 +61,3 @@ publishing { } } } - -artifactoryPublish { - publications(publishing.publications.mavenJava) -}