add github actions

This commit is contained in:
Mark Pollack
2023-08-04 11:54:13 -04:00
parent f2b299f3da
commit 0ee86b5b5d
14 changed files with 530 additions and 0 deletions

27
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a bug report to help us improve the project
title: ''
labels: 'type: bug, status: waiting-for-triage'
assignees: ''
---
Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
**Bug description**
A clear and concise description of what the bug is about.
**Environment**
Please provide as many details as possible: Spring Batch version, Java version, which database you use if any, etc
**Steps to reproduce**
Steps to reproduce the issue.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Minimal Complete Reproducible example**
Please provide a failing test or a [minimal complete verifiable example](https://github.com/spring-projects/spring-batch/blob/main/ISSUE_REPORTING.md) that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Questions and Community Support
url: https://stackoverflow.com/questions/tagged/spring-batch
about: Please ask and answer questions on StackOverflow with the spring-batch tag

View File

@@ -0,0 +1,27 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'status: waiting-for-triage, type: feature'
assignees: ''
---
Please do a quick search on Github issues first, the feature you are about to request might have already been requested.
**Expected Behavior**
<!--- Tell us how it should work. Add a code example to explain what you think the feature should look like. This is optional, but it would help up understand your expectations. -->
**Current Behavior**
<!--- Explain the difference from current behavior and why do you need this feature (aka why it is not possible to implement the desired functionality with the current version) -->
**Context**
<!---
How has this issue affected you?
What are you trying to accomplish?
What other alternatives have you considered?
Are you aware of any workarounds?
-->

17
.github/ISSUE_TEMPLATE/miscellaneous.md vendored Normal file
View File

@@ -0,0 +1,17 @@
---
name: Miscellaneous
about: Suggest an improvement for this project
title: ''
labels: 'status: waiting-for-triage'
assignees: ''
---
For anything other than bug reports and feature requests (performance, refactoring, etc),
just go ahead and file the issue. Please provide as many details as possible.
If you have a question or a support request, please open a new discussion on [GitHub Discussions](https://github.com/spring-projects/spring-batch/discussions)
or ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/spring-batch).
Please do **not** create issues on the [Issue Tracker](https://github.com/spring-projects/spring-batch/issues) for questions or support requests.
We would like to keep the issue tracker **exclusively** for bug reports and feature requests.

12
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,12 @@
Thank you for taking time to contribute this pull request!
You might have already read the [contributor guide][1], but as a reminder, please make sure to:
* Sign the [contributor license agreement](https://cla.pivotal.io/sign/spring)
* Rebase your changes on the latest `main` branch and squash your commits
* Add/Update unit tests as needed
* Run a build and make sure all tests pass prior to submission
For more details, please check the [contributor guide][1].
Thank you upfront!
[1]: https://github.com/spring-projects/spring-batch/blob/main/CONTRIBUTING.md

28
.github/release-files-spec.json vendored Normal file
View File

@@ -0,0 +1,28 @@
{
"files": [
{
"aql": {
"items.find": {
"$and": [
{
"@build.name": "${buildname}",
"@build.number": "${buildnumber}",
"path": {"$match": "org*"}
},
{
"$or": [
{
"name": {"$match": "*.pom"}
},
{
"name": {"$match": "*.jar"}
}
]
}
]
}
},
"target": "nexus/"
}
]
}

View File

@@ -0,0 +1,38 @@
name: Artifactory Milestone Release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Milestone release version"
required: true
jobs:
build:
name: Release milestone to Artifactory
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Capture release version
run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV
- name: Update release version
run: mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$RELEASE_VERSION
- name: Enforce release rules
run: mvn org.apache.maven.plugins:maven-enforcer-plugin:enforce -Drules=requireReleaseDeps
- name: Build with Maven and deploy to Artifactory's milestone repository
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: mvn -P artifactory-milestone -s settings.xml --batch-mode -Dmaven.test.skip=true deploy

View File

@@ -0,0 +1,38 @@
name: Artifactory Staging
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Release version"
required: true
jobs:
build:
name: Stage release to Artifactory
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Capture release version
run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV
- name: Update release version
run: mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$RELEASE_VERSION
- name: Enforce release rules
run: mvn org.apache.maven.plugins:maven-enforcer-plugin:enforce -Drules=requireReleaseDeps
- name: Build with Maven and deploy to Artifactory staging repository
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: mvn -P artifactory-staging -s settings.xml --batch-mode -Dmaven.test.skip=true deploy

View File

@@ -0,0 +1,32 @@
name: Continuous inspection build
on:
schedule:
- cron: '0 10 * * *' # Once per day at 10am UTC
workflow_dispatch:
jobs:
code-quality-analysis:
name: code quality analysis report
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Analyse test coverage with Jacoco
run: mvn -P test-coverage verify
- name: Analyse code quality with Sonar
if: github.repository == 'spring-experimental/spring-ai'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_URL }}
run: mvn sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_TOKEN

View File

@@ -0,0 +1,57 @@
name: CI/CD build
on:
push:
branches: [ "main-x" ]
jobs:
build:
name: Build branch
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Build with Maven and deploy to Artifactory
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: mvn -s settings.xml --batch-mode --update-snapshots deploy
- name: Generate Java docs
run: mvn javadoc:aggregate
- name: Generate Reference docs
working-directory: spring-ai-docs
run: mvn site
- name: Capture project version
run: echo PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version --quiet -DforceStdout) >> $GITHUB_ENV
- name: Setup SSH key
env:
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }}
run: |
mkdir "$HOME/.ssh"
echo "$DOCS_SSH_KEY" > "$HOME/.ssh/key"
chmod 600 "$HOME/.ssh/key"
echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts"
- name: Deploy docs
env:
DOCS_HOST: ${{ secrets.DOCS_HOST }}
DOCS_PATH: ${{ secrets.DOCS_PATH }}
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
working-directory: spring-ai-docs
run: |
cd target && unzip spring-ai-$PROJECT_VERSION-docs.zip
scp -i $HOME/.ssh/key -r api $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$PROJECT_VERSION
scp -i $HOME/.ssh/key -r reference $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$PROJECT_VERSION

View File

@@ -0,0 +1,56 @@
name: Documentation Upload
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Release version"
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Capture release version
run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Generate Java docs
run: mvn javadoc:aggregate
- name: Generate Reference docs
working-directory: spring-ai-docs
run: mvn site
- name: Setup SSH key
env:
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }}
run: |
mkdir "$HOME/.ssh"
echo "$DOCS_SSH_KEY" > "$HOME/.ssh/key"
chmod 600 "$HOME/.ssh/key"
echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts"
- name: Deploy docs
env:
DOCS_HOST: ${{ secrets.DOCS_HOST }}
DOCS_PATH: ${{ secrets.DOCS_PATH }}
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
working-directory: spring-ai-docs/target
run: |
unzip spring-ai-$RELEASE_VERSION-docs.zip
ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST cd $DOCS_PATH && mkdir $RELEASE_VERSION
scp -i $HOME/.ssh/key -r api reference $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$RELEASE_VERSION
ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST rm current && ln -s $RELEASE_VERSION current

View File

@@ -0,0 +1,81 @@
name: Maven Central Release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Release version"
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Capture release version
run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV
- name: Prepare directory structure
run: |
mkdir -p nexus/org/springframework/batch/spring-batch-bom/$RELEASE_VERSION
mkdir -p nexus/org/springframework/batch/spring-batch-infrastructure/$RELEASE_VERSION
mkdir -p nexus/org/springframework/batch/spring-batch-core/$RELEASE_VERSION
mkdir -p nexus/org/springframework/batch/spring-batch-test/$RELEASE_VERSION
mkdir -p nexus/org/springframework/batch/spring-batch-integration/$RELEASE_VERSION
- name: Download release files from Artifactory
env:
ARTIFACTORY_URL: "https://repo.spring.io/libs-staging-local/org/springframework/batch"
run: |
echo "Downloading BOM artifacts"
cd nexus/org/springframework/batch/spring-batch-bom/$RELEASE_VERSION
wget $ARTIFACTORY_URL/spring-batch-bom/$RELEASE_VERSION/spring-batch-bom-$RELEASE_VERSION.pom
echo "Downloading infrastructure artifacts"
cd ../../../../../..
cd nexus/org/springframework/batch/spring-batch-infrastructure/$RELEASE_VERSION
wget $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION.pom
wget $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION.jar
wget $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION-javadoc.jar
wget $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION-sources.jar
echo "Downloading core artifacts"
cd ../../../../../..
cd nexus/org/springframework/batch/spring-batch-core/$RELEASE_VERSION
wget $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION.pom
wget $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION.jar
wget $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION-javadoc.jar
wget $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION-sources.jar
echo "Downloading test artifacts"
cd ../../../../../..
cd nexus/org/springframework/batch/spring-batch-test/$RELEASE_VERSION
wget $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION.pom
wget $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION.jar
wget $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION-javadoc.jar
wget $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION-sources.jar
echo "Downloading integration artifacts"
cd ../../../../../..
cd nexus/org/springframework/batch/spring-batch-integration/$RELEASE_VERSION
wget $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION.pom
wget $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION.jar
wget $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION-javadoc.jar
wget $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION-sources.jar
- name: Sign artifacts and release them to Maven Central
uses: jvalkeal/nexus-sync@v0
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
close: true
release: true
generate-checksums: true
pgp-sign: true
pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }}
pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }}

View File

@@ -0,0 +1,58 @@
name: Maven Central Staging
on:
workflow_dispatch:
inputs:
buildName:
description: "Artifactory build name"
required: true
buildNumber:
description: "Artifactory build number"
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
# to get spec file in .github
- uses: actions/checkout@v2
# Setup jfrog cli
- uses: jfrog/setup-jfrog-cli@v1
with:
version: 1.43.2
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
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
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 }}

View File

@@ -0,0 +1,54 @@
name: Generate Release notes
on:
workflow_dispatch:
inputs:
milestoneNumber:
description: "Milestone title"
required: true
generatorVersion:
description: "Changelog Generator version"
required: true
jobs:
build:
name: Generate release notes
runs-on: ubuntu-latest
steps:
- name: Capture milestone number and generator version
run: |
echo MILESTONE_NUMBER=${{ github.event.inputs.milestoneNumber }} >> $GITHUB_ENV
echo GENERATOR_VERSION=${{ github.event.inputs.generatorVersion }} >> $GITHUB_ENV
- name: Download changelog generator
run: wget https://github.com/spring-io/github-changelog-generator/releases/download/v$GENERATOR_VERSION/github-changelog-generator.jar
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Prepare configuration file
run: |
cat << EOF > application.yml
changelog:
repository: spring-exprimental/spring-ai
sections:
- title: ":star: New features"
labels: [ "type: feature" ]
- title: ":rocket: Enhancements"
labels: [ "type: enhancement" ]
- title: ":lady_beetle: Bug fixes"
labels: [ "type: bug" ]
- title: ":notebook_with_decorative_cover: Documentation"
labels: [ "in: documentation" ]
- title: ":hammer: Tasks"
labels: [ "type: task" ]
EOF
- name: Generate release notes
run: java -jar github-changelog-generator.jar $MILESTONE_NUMBER release-notes.md
- name: Print release notes
run: cat release-notes.md