diff --git a/.github/actions/send-notification/action.yml b/.github/actions/send-notification/action.yml new file mode 100644 index 0000000..0d28e65 --- /dev/null +++ b/.github/actions/send-notification/action.yml @@ -0,0 +1,30 @@ +name: Send notification +description: Sends a Google Chat message as a notification of the job's outcome +inputs: + webhook-url: + description: 'Google Chat Webhook URL' + required: true + status: + description: 'Status of the job' + required: true + run-name: + description: 'Name of the run to include in the notification' + default: ${{ format('{0} {1}', github.ref_name, github.job) }} +runs: + using: composite + steps: + - shell: bash + run: | + echo "RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> "$GITHUB_ENV" + - shell: bash + if: ${{ inputs.status == 'success' }} + run: | + curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was successful"}' || true + - shell: bash + if: ${{ inputs.status == 'failure' }} + run: | + curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: " *<${{ env.RUN_URL }}|${{ inputs.run-name }}> failed* "}' || true + - shell: bash + if: ${{ inputs.status == 'cancelled' }} + run: | + curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was cancelled"}' || true diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml new file mode 100644 index 0000000..b99b71d --- /dev/null +++ b/.github/workflows/build-pull-request.yml @@ -0,0 +1,22 @@ +name: Build Pull Request +on: pull_request + +permissions: + contents: read + +jobs: + build: + name: Build pull request + runs-on: ubuntu-latest + if: ${{ github.repository == 'spring-projects/spring-ws-samples' }} + steps: + - name: Check out + uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'liberica' + cache: 'maven' + - name: Build with Maven + run: ./mvnw --batch-mode --update-snapshots verify diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..024fd7d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build Samples +on: + push: + branches: + - main +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} +jobs: + build-samples: + name: Build Samples + if: ${{ github.repository == 'spring-projects/spring-ws-samples' }} + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - name: Check out + uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'liberica' + cache: 'maven' + - name: Build + run: ./mvnw --no-transfer-progress --batch-mode --update-snapshots verify + - name: Send notification + uses: ./.github/actions/send-notification + if: always() + with: + webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }} + status: ${{ job.status }} + run-name: ${{ format('Spring WS Samples | {0} | {1}', github.ref_name, matrix.runner.name) }} diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 6c0f642..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,79 +0,0 @@ -pipeline { - agent none - - triggers { - pollSCM 'H/10 * * * *' - } - - options { - disableConcurrentBuilds() - buildDiscarder(logRotator(numToKeepStr: '14')) - } - - stages { - stage("Test: baseline (jdk17)") { - agent { - docker { - image 'eclipse-temurin:17-jdk' - args '-v $HOME/.m2:/root/.m2' - } - } - environment { - ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') - } - steps { - sh "PROFILES=none ci/test.sh" - } - } - - stage("Test other configurations") { - parallel { - stage("Test: snapshots") { - agent { - docker { - image 'eclipse-temurin:17-jdk' - args '-v $HOME/.m2:/root/.m2' - } - } - environment { - ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') - } - steps { - sh "PROFILES=snapshots ci/test.sh" - } - } - - stage("Test: baseline (jdk19)") { - agent { - docker { - image 'eclipse-temurin:19-jdk' - args '-v $HOME/.m2:/root/.m2' - } - } - environment { - ARTIFACTORY = credentials('02bd1690-b54f-4c9f-819d-a77cb7a9822c') - } - steps { - sh "PROFILES=none ci/test.sh" - } - } - } - } - } - - post { - changed { - script { - slackSend( - color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger', - channel: '#spring-ws', - message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}") - emailext( - subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}", - mimeType: 'text/html', - recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']], - body: "${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}") - } - } - } -} diff --git a/ci/test.sh b/ci/test.sh deleted file mode 100755 index 18cb3e6..0000000 --- a/ci/test.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -x - -set -euo pipefail - -MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" \ - ./mvnw -s settings.xml clean dependency:list test -Dsort -B -P${PROFILES} diff --git a/ci/version.sh b/ci/version.sh deleted file mode 100755 index 3e9fb1b..0000000 --- a/ci/version.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -RAW_VERSION=`MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \ - org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \ - -Dexpression=project.version -q -DforceStdout` - -# Split things up -VERSION_PARTS=($RAW_VERSION) - -# Grab the last part, which is the actual version number. -echo ${VERSION_PARTS[${#VERSION_PARTS[@]}-1]} - diff --git a/settings.xml b/settings.xml deleted file mode 100644 index d312f72..0000000 --- a/settings.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - sonatype - ${env.USERNAME} - ${env.PASSWORD} - - - spring-plugins-release - ${env.ARTIFACTORY_USR} - ${env.ARTIFACTORY_PSW} - - - spring-libs-snapshot - ${env.ARTIFACTORY_USR} - ${env.ARTIFACTORY_PSW} - - - spring-libs-milestone - ${env.ARTIFACTORY_USR} - ${env.ARTIFACTORY_PSW} - - - spring-libs-release - ${env.ARTIFACTORY_USR} - ${env.ARTIFACTORY_PSW} - - - - \ No newline at end of file