Skip to content

Commit d066e27

Browse files
Audit Log NG CAP Java plugin (#1)
* Init version of auditlog ng CAP Plugin * Update .gitignore
1 parent cef2e41 commit d066e27

28 files changed

+3115
-1
lines changed

.github/actions/build/action.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Maven Build
2+
description: "Builds a Maven project."
3+
4+
inputs:
5+
java-version:
6+
description: "The Java version the build shall run with."
7+
required: true
8+
maven-version:
9+
description: "The Maven version the build shall run with."
10+
required: true
11+
mutation-testing:
12+
description: "Whether to run mutation testing."
13+
default: 'true'
14+
required: false
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Set up Java ${{ inputs.java-version }}
20+
uses: actions/setup-java@v4
21+
with:
22+
java-version: ${{ inputs.java-version }}
23+
distribution: sapmachine
24+
cache: maven
25+
26+
- name: Setup Maven ${{ inputs.maven-version }}
27+
uses: stCarolas/setup-maven@v5
28+
with:
29+
maven-version: ${{ inputs.maven-version }}
30+
31+
- name: Piper Maven build
32+
uses: SAP/project-piper-action@main
33+
with:
34+
step-name: mavenBuild
35+
36+
#- name: Mutation Testing
37+
# if: ${{ inputs.mutation-testing == 'true' }}
38+
# run: mvn org.pitest:pitest-maven:mutationCoverage -f cds-feature-auditlog-ng/pom.xml -ntp -B
39+
# shell: bash
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Deploy Release to Maven Central
2+
description: "Deploys released artifacts to Maven Central repository."
3+
4+
inputs:
5+
user:
6+
description: "The user used for the upload (technical user for maven central upload)"
7+
required: true
8+
password:
9+
description: "The password used for the upload (technical user for maven central upload)"
10+
required: true
11+
profile:
12+
description: "The profile id"
13+
required: true
14+
pgp-pub-key:
15+
description: "The public pgp key ID"
16+
required: true
17+
pgp-private-key:
18+
description: "The private pgp key"
19+
required: true
20+
pgp-passphrase:
21+
description: "The passphrase for pgp"
22+
required: true
23+
revision:
24+
description: "The revision of cds-feature-auditlog-ng"
25+
required: true
26+
maven-version:
27+
description: "The Maven version the build shall run with."
28+
required: true
29+
30+
runs:
31+
using: composite
32+
steps:
33+
- name: Echo Inputs
34+
run: |
35+
echo "user: ${{ inputs.user }}"
36+
echo "profile: ${{ inputs.profile }}"
37+
echo "revision: ${{ inputs.revision }}"
38+
shell: bash
39+
40+
- name: Set up Java
41+
uses: actions/setup-java@v4
42+
with:
43+
distribution: sapmachine
44+
java-version: '17'
45+
cache: maven
46+
server-id: ossrh
47+
server-username: MAVEN_CENTRAL_USER
48+
server-password: MAVEN_CENTRAL_PASSWORD
49+
50+
- name: Set up Maven ${{ inputs.maven-version }}
51+
uses: stCarolas/setup-maven@v5
52+
with:
53+
maven-version: ${{ inputs.maven-version }}
54+
55+
- name: Import GPG Key
56+
run: |
57+
echo "${{ inputs.pgp-private-key }}" | gpg --batch --passphrase "$PASSPHRASE" --import
58+
shell: bash
59+
env:
60+
PASSPHRASE: ${{ inputs.pgp-passphrase }}
61+
62+
- name: Deploy Locally
63+
run: >
64+
mvn -B -ntp -fae --show-version
65+
-Durl=file:./temp_local_repo
66+
-Dmaven.install.skip=true
67+
-Dmaven.test.skip=true
68+
-Dgpg.passphrase="$GPG_PASSPHRASE"
69+
-Dgpg.keyname="$GPG_PUB_KEY"
70+
-Drevision="${{ inputs.revision }}"
71+
deploy
72+
working-directory: ./deploy-oss
73+
shell: bash
74+
env:
75+
MAVEN_CENTRAL_USER: ${{ inputs.user }}
76+
MAVEN_CENTRAL_PASSWORD: ${{ inputs.password }}
77+
GPG_PASSPHRASE: ${{ inputs.pgp-passphrase }}
78+
GPG_PUB_KEY: ${{ inputs.pgp-pub-key }}
79+
80+
- name: Deploy Staging
81+
run: >
82+
mvn -B -ntp -fae --show-version
83+
org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy-staged-repository
84+
-DserverId=ossrh
85+
-DnexusUrl=https://oss.sonatype.org
86+
-DrepositoryDirectory=./temp_local_repo
87+
-DstagingProfileId="$MAVEN_CENTRAL_PROFILE_ID"
88+
-Drevision="${{ inputs.revision }}"
89+
working-directory: ./deploy-oss
90+
shell: bash
91+
env:
92+
MAVEN_CENTRAL_USER: ${{ inputs.user }}
93+
MAVEN_CENTRAL_PASSWORD: ${{ inputs.password }}
94+
MAVEN_CENTRAL_PROFILE_ID: ${{ inputs.profile }}

.github/actions/deploy/action.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy to artifactory
2+
description: "Deploys artifacts to artifactory."
3+
4+
inputs:
5+
repository-url:
6+
description: "The URL of the repository to upload to."
7+
required: true
8+
server-id:
9+
description: "The service id of the repository to upload to."
10+
required: true
11+
user:
12+
description: "The user used for the upload."
13+
required: true
14+
password:
15+
description: "The password used for the upload."
16+
required: true
17+
pom-file:
18+
description: "The path to the POM file."
19+
required: false
20+
default: "pom.xml"
21+
maven-version:
22+
description: "The Maven version the build shall run with."
23+
required: true
24+
25+
runs:
26+
using: composite
27+
steps:
28+
- name: Echo Inputs
29+
run: |
30+
echo "repository-url: ${{ inputs.repository-url }}"
31+
echo "user: ${{ inputs.user }}"
32+
echo "password: ${{ inputs.password }}"
33+
echo "pom-file: ${{ inputs.pom-file }}"
34+
echo "altDeploymentRepository: ${{inputs.server-id}}::${{inputs.repository-url}}"
35+
shell: bash
36+
37+
- name: Setup Java 17
38+
uses: actions/setup-java@v4
39+
with:
40+
distribution: sapmachine
41+
java-version: '17'
42+
server-id: ${{ inputs.server-id }}
43+
server-username: DEPLOYMENT_USER
44+
server-password: DEPLOYMENT_PASS
45+
46+
- name: Setup Maven ${{ inputs.maven-version }}
47+
uses: stCarolas/setup-maven@v5
48+
with:
49+
maven-version: ${{ inputs.maven-version }}
50+
51+
- name: Deploy
52+
run: >
53+
mvn -B -ntp -fae --show-version
54+
-DaltDeploymentRepository=${{inputs.server-id}}::${{inputs.repository-url}}
55+
-Dmaven.install.skip=true
56+
-Dmaven.test.skip=true
57+
-f ${{ inputs.pom-file }}
58+
deploy
59+
env:
60+
DEPLOYMENT_USER: ${{ inputs.user }}
61+
DEPLOYMENT_PASS: ${{ inputs.password }}
62+
shell: bash
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Update POM with new release
2+
description: Updates the revision property in the POM file with the new release version.
3+
4+
inputs:
5+
java-version:
6+
description: "The Java version the build shall run with."
7+
required: true
8+
maven-version:
9+
description: "The Maven version the build shall run with."
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Set up Java ${{ inputs.java-version }}
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: ${{ inputs.java-version }}
19+
distribution: sapmachine
20+
cache: maven
21+
22+
- name: Setup Maven ${{ inputs.maven-version }}
23+
uses: stCarolas/setup-maven@v5
24+
with:
25+
maven-version: ${{ inputs.maven-version }}
26+
27+
- name: Update version
28+
run: |
29+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
30+
mvn --no-transfer-progress versions:set-property -Dproperty=revision -DnewVersion=$VERSION
31+
git config --global user.name 'github-actions[bot]'
32+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
33+
git checkout -b main
34+
git commit -am "Update version to $VERSION"
35+
git push --set-upstream origin main
36+
shell: bash
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Scan with BlackDuck"
2+
description: "Scans the project with BlackDuck"
3+
4+
inputs:
5+
blackduck_token:
6+
description: "The token to use for BlackDuck authentication"
7+
required: true
8+
github_token:
9+
description: "The token to use for GitHub authentication"
10+
required: true
11+
java-version:
12+
description: "The version of Java to use"
13+
default: '17'
14+
required: false
15+
maven-version:
16+
description: "The Maven version the build shall run with."
17+
required: true
18+
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Set up Java ${{ inputs.java-version }}
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: ${{ inputs.java-version }}
26+
distribution: sapmachine
27+
cache: maven
28+
29+
- name: Setup Maven ${{ inputs.maven-version }}
30+
uses: stCarolas/setup-maven@v5
31+
with:
32+
maven-version: ${{ inputs.maven-version }}
33+
34+
- name: Get Major Version
35+
id: get-major-version
36+
run: |
37+
echo "REVISION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)" >> $GITHUB_OUTPUT
38+
shell: bash
39+
40+
- name: Print Version Number
41+
run: echo "${{ steps.get-major-version.outputs.REVISION }}"
42+
shell: bash
43+
44+
- name: BlackDuck Scan
45+
uses: SAP/project-piper-action@main
46+
with:
47+
step-name: detectExecuteScan
48+
flags: \
49+
--githubToken=$GITHUB_token \
50+
--version=${{ steps.get-major-version.outputs.REVISION }}
51+
env:
52+
PIPER_token: ${{ inputs.blackduck_token }}
53+
GITHUB_token: ${{ inputs.github_token }}
54+
SCAN_MODE: FULL
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Scan with SonarQube
2+
description: Scans the project with SonarQube
3+
4+
inputs:
5+
sonarq-token:
6+
description: The token to use for SonarQube authentication
7+
required: true
8+
github-token:
9+
description: The token to use for GitHub authentication
10+
required: true
11+
java-version:
12+
description: The version of Java to use
13+
required: true
14+
maven-version:
15+
description: The version of Maven to use
16+
required: true
17+
18+
runs:
19+
using: composite
20+
21+
steps:
22+
- name: Set up Java ${{inputs.java-version}}
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: ${{inputs.java-version}}
26+
distribution: sapmachine
27+
cache: maven
28+
29+
- name: Set up Maven ${{inputs.maven-version}}
30+
uses: stCarolas/setup-maven@v5
31+
with:
32+
maven-version: ${{inputs.maven-version}}
33+
34+
- name: Get Revision
35+
id: get-revision
36+
run: |
37+
echo "REVISION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout)" >> $GITHUB_OUTPUT
38+
shell: bash
39+
40+
- name: Print Revision
41+
run: echo "${{steps.get-revision.outputs.REVISION}}"
42+
shell: bash
43+
44+
- name: SonarQube Scan
45+
uses: SAP/project-piper-action@main
46+
with:
47+
step-name: sonarExecuteScan
48+
flags: --token=${{inputs.sonarq-token}} --githubToken=${{inputs.github-token}} --version=${{steps.get-revision.outputs.REVISION}} --inferJavaBinaries=true

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: maven
4+
directories:
5+
- "/**/*"
6+
schedule:
7+
interval: daily
8+
open-pull-requests-limit: 10
9+
- package-ecosystem: github-actions
10+
directory: "/"
11+
schedule:
12+
interval: daily

0 commit comments

Comments
 (0)