Skip to content

Commit f575933

Browse files
committed
Migrate CI to GitHub Actions
Closes gh-1461
1 parent b40c664 commit f575933

File tree

13 files changed

+453
-1
lines changed

13 files changed

+453
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Await HTTP Resource
2+
description: 'Waits for an HTTP resource to be available (a HEAD request succeeds)'
3+
inputs:
4+
url:
5+
description: 'URL of the resource to await'
6+
required: true
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Await HTTP resource
11+
shell: bash
12+
run: |
13+
url=${{ inputs.url }}
14+
echo "Waiting for $url"
15+
until curl --fail --head --silent ${{ inputs.url }} > /dev/null
16+
do
17+
echo "."
18+
sleep 60
19+
done
20+
echo "$url is available"

.github/actions/build/action.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: 'Build'
2+
description: 'Builds the project, optionally publishing it to a local deployment repository'
3+
inputs:
4+
develocity-access-key:
5+
description: 'Access key for authentication with ge.spring.io'
6+
required: false
7+
java-distribution:
8+
description: 'Java distribution to use'
9+
required: false
10+
default: 'liberica'
11+
java-early-access:
12+
description: 'Whether the Java version is in early access'
13+
required: false
14+
default: 'false'
15+
java-toolchain:
16+
description: 'Whether a Java toolchain should be used'
17+
required: false
18+
default: 'false'
19+
java-version:
20+
description: 'Java version to compile and test with'
21+
required: false
22+
default: '17'
23+
publish:
24+
description: 'Whether to publish artifacts ready for deployment to Artifactory'
25+
required: false
26+
default: 'false'
27+
outputs:
28+
build-scan-url:
29+
description: 'URL, if any, of the build scan produced by the build'
30+
value: ${{ (inputs.publish == 'true' && steps.publish.outputs.build-scan-url) || steps.build.outputs.build-scan-url }}
31+
version:
32+
description: 'Version that was built'
33+
value: ${{ steps.read-version.outputs.version }}
34+
runs:
35+
using: composite
36+
steps:
37+
- name: Prepare Gradle Build
38+
uses: ./.github/actions/prepare-gradle-build
39+
with:
40+
develocity-access-key: ${{ inputs.develocity-access-key }}
41+
java-distribution: ${{ inputs.java-distribution }}
42+
java-early-access: ${{ inputs.java-early-access }}
43+
java-toolchain: ${{ inputs.java-toolchain }}
44+
java-version: ${{ inputs.java-version }}
45+
- name: Build
46+
id: build
47+
if: ${{ inputs.publish == 'false' }}
48+
shell: bash
49+
run: ./gradlew check
50+
- name: Publish
51+
id: publish
52+
if: ${{ inputs.publish == 'true' }}
53+
shell: bash
54+
run: ./gradlew -PdeploymentRepository=$(pwd)/deployment-repository build publishAllPublicationsToDeploymentRepository
55+
- name: Read Version From gradle.properties
56+
id: read-version
57+
shell: bash
58+
run: |
59+
version=$(sed -n 's/version=\(.*\)/\1/p' gradle.properties)
60+
echo "Version is $version"
61+
echo "version=$version" >> $GITHUB_OUTPUT
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Create GitHub Release
2+
description: 'Create the release on GitHub with a changelog'
3+
inputs:
4+
milestone:
5+
description: 'Name of the GitHub milestone for which a release will be created'
6+
required: true
7+
pre-release:
8+
description: 'Whether the release is a pre-release (a milestone or release candidate)'
9+
required: false
10+
default: 'false'
11+
token:
12+
description: 'Token to use for authentication with GitHub'
13+
required: true
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Generate Changelog
18+
uses: spring-io/github-changelog-generator@185319ad7eaa75b0e8e72e4b6db19c8b2cb8c4c1 #v0.0.11
19+
with:
20+
config-file: .github/actions/create-github-release/changelog-generator.yml
21+
milestone: ${{ inputs.milestone }}
22+
token: ${{ inputs.token }}
23+
- name: Create GitHub Release
24+
shell: bash
25+
env:
26+
GITHUB_TOKEN: ${{ inputs.token }}
27+
run: gh release create ${{ format('v{0}', inputs.milestone) }} --notes-file changelog.md ${{ inputs.pre-release == 'true' && '--prerelease' || '' }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
changelog:
2+
repository: spring-projects/spring-ws
3+
sections:
4+
- title: ":star: New Features"
5+
labels:
6+
- "type: enhancement"
7+
- title: ":lady_beetle: Bug Fixes"
8+
labels:
9+
- "type: bug"
10+
- "type: regression"
11+
- title: ":notebook_with_decorative_cover: Documentation"
12+
labels:
13+
- "type: documentation"
14+
- title: ":hammer: Dependency Upgrades"
15+
sort: "title"
16+
labels:
17+
- "type: dependency-upgrade"
18+
contributors:
19+
exclude:
20+
names:
21+
- "snicoll"
22+
- "wilkinsona"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Prepare Gradle Build
2+
description: 'Prepares a Gradle build. Sets up Java and Gradle and configures Gradle properties'
3+
inputs:
4+
develocity-access-key:
5+
description: 'Access key for authentication with ge.spring.io'
6+
required: false
7+
java-distribution:
8+
description: 'Java distribution to use'
9+
required: false
10+
default: 'liberica'
11+
java-early-access:
12+
description: 'Whether the Java version is in early access. When true, forces java-distribution to temurin'
13+
required: false
14+
default: 'false'
15+
java-toolchain:
16+
description: 'Whether a Java toolchain should be used'
17+
required: false
18+
default: 'false'
19+
java-version:
20+
description: 'Java version to use for the build'
21+
required: false
22+
default: '17'
23+
runs:
24+
using: composite
25+
steps:
26+
- name: Set Up Java
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: ${{ inputs.java-early-access == 'true' && 'temurin' || (inputs.java-distribution || 'liberica') }}
30+
java-version: |
31+
${{ inputs.java-early-access == 'true' && format('{0}-ea', inputs.java-version) || inputs.java-version }}
32+
${{ inputs.java-toolchain == 'true' && '17' || '' }}
33+
- name: Set Up Gradle
34+
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
35+
with:
36+
cache-read-only: false
37+
develocity-access-key: ${{ inputs.develocity-access-key }}
38+
develocity-token-expiry: 4
39+
- name: Configure Gradle Properties
40+
shell: bash
41+
run: |
42+
mkdir -p $HOME/.gradle
43+
echo 'systemProp.user.name=spring-builds+github' >> $HOME/.gradle/gradle.properties
44+
echo 'systemProp.org.gradle.internal.launcher.welcomeMessageEnabled=false' >> $HOME/.gradle/gradle.properties
45+
echo 'org.gradle.daemon=false' >> $HOME/.gradle/gradle.properties
46+
echo 'org.gradle.daemon=4' >> $HOME/.gradle/gradle.properties
47+
- name: Configure Toolchain Properties
48+
if: ${{ inputs.java-toolchain == 'true' }}
49+
shell: bash
50+
run: |
51+
echo toolchainVersion=${{ inputs.java-version }} >> $HOME/.gradle/gradle.properties
52+
echo systemProp.org.gradle.java.installations.auto-detect=false >> $HOME/.gradle/gradle.properties
53+
echo systemProp.org.gradle.java.installations.auto-download=false >> $HOME/.gradle/gradle.properties
54+
echo systemProp.org.gradle.java.installations.paths=${{ format('$JAVA_HOME_{0}_X64', inputs.java-version) }} >> $HOME/.gradle/gradle.properties
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Print JVM thread dumps
2+
description: 'Prints a thread dump for all running JVMs'
3+
runs:
4+
using: composite
5+
steps:
6+
- if: ${{ runner.os == 'Linux' }}
7+
shell: bash
8+
run: |
9+
for jvm_pid in $(jps -q -J-XX:+PerfDisableSharedMem); do
10+
jcmd $jvm_pid Thread.print
11+
done
12+
- if: ${{ runner.os == 'Windows' }}
13+
shell: powershell
14+
run: |
15+
foreach ($jvm_pid in $(jps -q -J-XX:+PerfDisableSharedMem)) {
16+
jcmd $jvm_pid Thread.print
17+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Send Notification
2+
description: 'Sends a Google Chat message as a notification of the job''s outcome'
3+
inputs:
4+
build-scan-url:
5+
description: 'URL of the build scan to include in the notification'
6+
required: false
7+
run-name:
8+
description: 'Name of the run to include in the notification'
9+
required: false
10+
default: ${{ format('{0} {1}', github.ref_name, github.job) }}
11+
status:
12+
description: 'Status of the job'
13+
required: true
14+
webhook-url:
15+
description: 'Google Chat Webhook URL'
16+
required: true
17+
runs:
18+
using: composite
19+
steps:
20+
- name: Prepare Variables
21+
shell: bash
22+
run: |
23+
echo "BUILD_SCAN=${{ inputs.build-scan-url == '' && ' [build scan unavailable]' || format(' [<{0}|Build Scan>]', inputs.build-scan-url) }}" >> "$GITHUB_ENV"
24+
echo "RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> "$GITHUB_ENV"
25+
- name: Success Notification
26+
if: ${{ inputs.status == 'success' }}
27+
shell: bash
28+
run: |
29+
curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was successful ${{ env.BUILD_SCAN }}"}' || true
30+
- name: Failure Notification
31+
if: ${{ inputs.status == 'failure' }}
32+
shell: bash
33+
run: |
34+
curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<users/all> *<${{ env.RUN_URL }}|${{ inputs.run-name }}> failed* ${{ env.BUILD_SCAN }}"}' || true
35+
- name: Cancel Notification
36+
if: ${{ inputs.status == 'cancelled' }}
37+
shell: bash
38+
run: |
39+
curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was cancelled"}' || true
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Sync to Maven Central
2+
description: 'Syncs a release to Maven Central and waits for it to be available for use'
3+
inputs:
4+
jfrog-cli-config-token:
5+
description: 'Config token for the JFrog CLI'
6+
required: true
7+
ossrh-s01-staging-profile:
8+
description: 'Staging profile to use when syncing to Central'
9+
required: true
10+
ossrh-s01-token-password:
11+
description: 'Password for authentication with s01.oss.sonatype.org'
12+
required: true
13+
ossrh-s01-token-username:
14+
description: 'Username for authentication with s01.oss.sonatype.org'
15+
required: true
16+
spring-ws-version:
17+
description: 'Version of Spring Web Services that is being synced to Central'
18+
required: true
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Set Up JFrog CLI
23+
uses: jfrog/setup-jfrog-cli@f748a0599171a192a2668afee8d0497f7c1069df # v4.5.6
24+
env:
25+
JF_ENV_SPRING: ${{ inputs.jfrog-cli-config-token }}
26+
- name: Download Release Artifacts
27+
shell: bash
28+
run: jf rt download --spec ${{ format('{0}/artifacts.spec', github.action_path) }} --spec-vars 'buildName=${{ format('spring-ws-{0}', inputs.spring-ws-version) }};buildNumber=${{ github.run_number }}'
29+
- name: Sync
30+
uses: spring-io/nexus-sync-action@42477a2230a2f694f9eaa4643fa9e76b99b7ab84 # v0.0.1
31+
with:
32+
close: true
33+
create: true
34+
generate-checksums: true
35+
password: ${{ inputs.ossrh-s01-token-password }}
36+
release: true
37+
staging-profile-name: ${{ inputs.ossrh-s01-staging-profile }}
38+
upload: true
39+
username: ${{ inputs.ossrh-s01-token-username }}
40+
- name: Await
41+
uses: ./.github/actions/await-http-resource
42+
with:
43+
url: ${{ format('https://repo.maven.apache.org/maven2/org/springframework/ws/spring-ws-core/{0}/spring-ws-core-{0}.jar', inputs.spring-ws-version) }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"files": [
3+
{
4+
"aql": {
5+
"items.find": {
6+
"$and": [
7+
{
8+
"@build.name": "${buildName}",
9+
"@build.number": "${buildNumber}",
10+
"path": {
11+
"$nmatch": "org/springframework/ws/spring-ws-docs/*"
12+
}
13+
}
14+
]
15+
}
16+
},
17+
"target": "nexus/"
18+
}
19+
]
20+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and Deploy Snapshot
2+
on:
3+
push:
4+
branches:
5+
- main
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
jobs:
9+
build-and-deploy-snapshot:
10+
name: Build and Deploy Snapshot
11+
if: ${{ github.repository == 'spring-projects/spring-ws' }}
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 60
14+
steps:
15+
- name: Check Out Code
16+
uses: actions/checkout@v4
17+
- name: Build and Publish
18+
id: build-and-publish
19+
uses: ./.github/actions/build
20+
with:
21+
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
22+
publish: true
23+
- name: Deploy
24+
uses: spring-io/artifactory-deploy-action@dc1913008c0599f0c4b1fdafb6ff3c502b3565ea # v0.0.2
25+
with:
26+
artifact-properties: |
27+
/**/spring-ws-docs-*.zip::zip.type=docs,zip.name=spring-ws,zip.deployed=false
28+
build-name: 'spring-ws-4.0.x'
29+
folder: 'deployment-repository'
30+
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
31+
repository: 'libs-snapshot-local'
32+
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
33+
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
34+
uri: 'https://repo.spring.io'
35+
username: ${{ secrets.ARTIFACTORY_USERNAME }}
36+
- name: Send Notification
37+
if: always()
38+
uses: ./.github/actions/send-notification
39+
with:
40+
build-scan-url: ${{ steps.build-and-publish.outputs.build-scan-url }}
41+
run-name: ${{ format('{0} | Linux | Java 17', github.ref_name) }}
42+
status: ${{ job.status }}
43+
webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}
44+
outputs:
45+
version: ${{ steps.build-and-publish.outputs.version }}

0 commit comments

Comments
 (0)