Skip to content

Commit

Permalink
fix(CORE-893): Initial commit. Setup workflows and project.
Browse files Browse the repository at this point in the history
  • Loading branch information
thielems authored and koehlecn committed Oct 16, 2024
0 parents commit 36dc9d3
Show file tree
Hide file tree
Showing 9 changed files with 880 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<settings>
<servers>
<server>
<id>nexus</id>
<username>${REPOSITORY_USERID}</username>
<password>${REPOSITORY_CREDENTIALS}</password>
</server>
<server>
<id>maven2.releases.levigo.de</id>
<username>${REPOSITORY_RELEASE_USERID}</username>
<password>${REPOSITORY_RELEASE_CREDENTIALS}</password>
</server>
</servers>
<profiles>
<!--
Downloading all maven artifacts from a mirror some 6000 miles away does not seem reasonable.
Therefore we download only the private artifacts from Nexus3 and all publicly available artifacts from maven-central.
-->
<profile>
<id>central-nexus</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>maven-central</id>
<url>https://repo.maven.apache.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>nexus</id>
<url>${REPOSITORY_URL}</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven-central</id>
<url>https://repo.maven.apache.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>nexus</id>
<url>${REPOSITORY_URL}</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
135 changes: 135 additions & 0 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Continuous Delivery

on:
push:
branches:
- 'main'
paths-ignore:
- '.github/workflows/continuous-integration.yml'

env:
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
TAG_PREFIX: 'jadice-dss-utils-'

jobs:

build:
runs-on: ubuntu-22.04
timeout-minutes: 15

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

## compute the string of the next version
- name: Bump version and create tag
id: semanticversion
uses: mathieudutour/github-tag-action@v6.2
with:
release_branches: main
github_token: ${{ secrets.GITHUB_TOKEN }}
fetch_all_tags: true
tag_prefix: ${{ env.TAG_PREFIX }}

## check if the computed string of the next version is conform to our regex
- name: Verify and print new build number
run: |
if echo '${{ steps.semanticversion.outputs.new_tag }}' |grep -Eq '^${{ env.TAG_PREFIX }}[0-9]+[.][0-9]+[.][0-9]+$'; then
echo Tag '${{ steps.semanticversion.outputs.new_tag }}', New version '${{ steps.semanticversion.outputs.new_version }}', Changelog '${{ steps.semanticversion.outputs.changelog }}'
else
echo 'unexpected tag format - aborting'
exit -1
fi
- name: Set version and tag variables
run: |
echo "NEW_VERSION=${{ steps.semanticversion.outputs.new_version }}" >> $GITHUB_ENV \
&& echo "NEW_TAG=${{ env.TAG_PREFIX }}${{ steps.semanticversion.outputs.new_version }}" >> $GITHUB_ENV
## Configure JDK
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'

## Enable Caching
- uses: actions/cache@v3
id: cache
with:
path: |
~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
## Configure maven settings
- name: Prepare maven settings
env:
REPOSITORY_URL: ${{ vars.LEVIGO_MAVEN2_ALL_REPOSITORIES }}
REPOSITORY_USERID: ${{ secrets.LEVIGO_NEXUS_USERNAME_RO }}
REPOSITORY_CREDENTIALS: ${{ secrets.LEVIGO_NEXUS_PASSWORD_RO }}
REPOSITORY_RELEASE_USERID: ${{ secrets.LEVIGO_NEXUS_USERNAME }}
REPOSITORY_RELEASE_CREDENTIALS: ${{ secrets.LEVIGO_NEXUS_PASSWORD }}
run: |
echo NEXUS2_REPO_RELEASES ${{ secrets.NEXUS2_REPO_RELEASES }}
mkdir -p ~/.m2
envsubst < ./.github/settings.xml > ~/.m2/settings.xml
## Build with maven
- name: Set version
id: version
run: |
echo Releasing as ${{ env.NEW_VERSION }}
mvn ${{ env.MAVEN_CLI_OPTS }} versions:set -DnewVersion=${{ env.NEW_VERSION }}
- name: Perform build
run: mvn -B verify -Dmaven.test.failure.ignore=true

## Publish test report
- name: Publish Test Report for JDK 11
id: test-report
uses: scacap/action-surefire-report@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_test_failures: true
check_name: Test Report for JDK 11

## Deploy
- name: Deploy packages
run: mvn ${{ env.MAVEN_CLI_OPTS }} deploy -Dmaven.install.skip=true

## Create Release
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ env.NEW_VERSION }}
tag_name: ${{ steps.semanticversion.outputs.new_tag }}
draft: false
prerelease: false
files: |
./target/jadice-dss-utils-${{ steps.semanticversion.outputs.new_version }}.jar
./target/jadice-dss-utils-${{ steps.semanticversion.outputs.new_version }}-javadoc.jar
./target/jadice-dss-utils-${{ steps.semanticversion.outputs.new_version }}-sources.jar
## Notify developers
- name: Notify developers
uses: 8398a7/action-slack@v3
with:
username: GitHub
icon_emoji: octocat
channel: ci_docp
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref
text: Released new version `${{ env.NEW_VERSION }}` of *${{ github.repository }}*
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: failure()
88 changes: 88 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Continuous Integration

on:
push:
branches-ignore:
- 'main'
paths-ignore:
# !! Attention!! removing the following line may produce an endless loop on the build system!!
- '**/README.md'
- '.github/workflows/continuous-delivery.yml'

env:
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"

jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 15

strategy:
fail-fast: false
matrix:
jdk: [ 11 ]


steps:
- uses: actions/checkout@v4

## Configure JDK
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

## Enable Caching
# Reduce cache size by excluding artifacts with the project.groupId
- uses: actions/cache@v3
with:
path: |
~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
## Configure maven settings
- name: Prepare maven settings
env:
REPOSITORY_URL: ${{ secrets.LEVIGO_NEXUS_REPO_RELEASES }}
REPOSITORY_RELEASE_USERID: ${{ secrets.PUB_NEXUS2_USERNAME_RW }}
REPOSITORY_RELEASE_CREDENTIALS: ${{ secrets.PUB_NEXUS2_PASSWORD_RW}}
run: |
echo NEXUS2_REPO_RELEASES ${{ secrets.NEXUS2_REPO_RELEASES }}
mkdir -p ~/.m2
envsubst < ./.github/settings.xml > ~/.m2/settings.xml
## Build with maven
- name: Perform build
run: mvn ${{ env.MAVEN_CLI_OPTS }} verify -Dmaven.test.failure.ignore=true

## Publish test report
- name: Publish Test Report for JDK 11
id: test-report
uses: scacap/action-surefire-report@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_test_failures: true
check_name: Test Report for JDK 11

## Notify developers
- name: Notify developers
uses: 8398a7/action-slack@v3
with:
username: GitHub
icon_emoji: octocat
channel: ci_docp
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref
text: ${{ github.workflow }} ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: ${{ failure() &&github.actor != 'dependabot[bot]' }}
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# exclude target directories
target
**/target/
**/git.properties

release.properties
pom.xml.releaseBackup

# eclipse project files and directories
.classpath
.project
.settings
.recommenders
.metadata

# exclude IntelliJ IDEA files
.idea
**/*.iml
.run

/.expected-vs-actual/
/.failed/
Loading

0 comments on commit 36dc9d3

Please sign in to comment.