Skip to content

Commit f98bbb0

Browse files
committed
Initial commit
1 parent e323701 commit f98bbb0

File tree

59 files changed

+2764
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2764
-0
lines changed

.github/workflows/maven.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: maven-cicd
2+
3+
on:
4+
# for regular master build (after the merge)
5+
push:
6+
branches:
7+
- main
8+
# for PRs from forked repos and non forked repos
9+
# in order to write status info to the PR we require write repository token (https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/)
10+
pull_request:
11+
branches:
12+
- main
13+
types: [opened, synchronize, reopened]
14+
15+
# restrict privileges except for setting commit status, adding PR comments and writing statuses
16+
permissions:
17+
actions: read
18+
checks: write
19+
contents: read
20+
deployments: read
21+
issues: read
22+
packages: read
23+
pull-requests: write
24+
repository-projects: read
25+
security-events: read
26+
statuses: write
27+
28+
jobs:
29+
build:
30+
strategy:
31+
matrix:
32+
os: [ubuntu-latest, macos-latest, windows-latest]
33+
jdk: [11, 17, 21]
34+
include:
35+
# lengthy build steps should only be performed on linux with Java 17 (Sonarcloud analysis, deployment)
36+
- os: ubuntu-latest
37+
jdk: 17
38+
isMainBuildEnv: true
39+
namePrefix: 'Main '
40+
fail-fast: false
41+
42+
name: ${{ matrix.namePrefix }} Maven build (${{ matrix.os }}, JDK ${{ matrix.jdk }})
43+
runs-on: ${{ matrix.os }}
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
# always act on the modified source code (even for event pull_request_target)
49+
# is considered potentially unsafe (https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) but actions are only executed after approval from committers
50+
with:
51+
ref: ${{ github.event.pull_request.head.sha }}
52+
# no additional git operations after checkout triggered in workflow, no need to store credentials
53+
persist-credentials: false
54+
55+
- name: Set up JDK
56+
uses: actions/setup-java@v4
57+
with:
58+
cache: 'maven'
59+
distribution: 'temurin'
60+
java-version: ${{ matrix.jdk }}
61+
# generate settings.xml with the correct values
62+
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
63+
server-username: MAVEN_USERNAME # env variable for username in deploy
64+
server-password: MAVEN_PASSWORD # env variable for token in deploy
65+
66+
# sets environment variables to be used in subsequent steps: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
67+
- name: Set environment variables
68+
shell: bash
69+
run: |
70+
if [ "${{ matrix.isMainBuildEnv }}" = "true" ]; then
71+
echo "MVN_ADDITIONAL_OPTS=-Dsonar.projectKey=Netcentric_aem-replication-metadata-validator -Dsonar.organization=netcentric -Dsonar.host.url=https://sonarcloud.io -Pjacoco-report" >> $GITHUB_ENV
72+
if [ "${{github.ref}}" = "refs/heads/main" ] && [ "${{github.event_name}}" = "push" ]; then
73+
echo "MAVEN_USERNAME=${{ secrets.OSSRH_TOKEN_USER }}" >> $GITHUB_ENV
74+
echo "MAVEN_PASSWORD=${{ secrets.OSSRH_TOKEN_PASSWORD }}" >> $GITHUB_ENV
75+
echo "MVN_GOAL=clean deploy org.sonarsource.scanner.maven:sonar-maven-plugin:sonar" >> $GITHUB_ENV
76+
echo "STEP_NAME_SUFFIX=(Deploys to OSSRH)" >> $GITHUB_ENV
77+
else
78+
echo "MVN_GOAL=clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar" >> $GITHUB_ENV
79+
fi
80+
else
81+
echo "MVN_ADDITIONAL_OPTS=" >> $GITHUB_ENV
82+
echo "MVN_GOAL=clean verify" >> $GITHUB_ENV
83+
fi
84+
- name: ${{ matrix.namePrefix }} Build with Maven ${{ env.STEP_NAME_SUFFIX }}
85+
env:
86+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
run: mvn -e -B -V ${{ env.MVN_GOAL }} ${{ env.MVN_ADDITIONAL_OPTS }}
89+
90+
- name: Publish Test Report
91+
if: ${{ always() }} # make sure to run even if previous Maven execution failed (due to failed test)
92+
uses: EnricoMi/publish-unit-test-result-action/composite@v2
93+
with:
94+
files: |
95+
target/invoker-reports/TEST-*.xml
96+
check_name: Test report (${{ matrix.os }}, JDK ${{ matrix.jdk }})

.gitignore

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
2+
# Created by https://www.gitignore.io/api/java,maven,eclipse,intellij+iml
3+
# Edit at https://www.gitignore.io/?templates=java,maven,eclipse,intellij+iml
4+
5+
### Eclipse ###
6+
.metadata
7+
bin/
8+
tmp/
9+
*.tmp
10+
*.bak
11+
*.swp
12+
*~.nib
13+
local.properties
14+
.settings/
15+
.loadpath
16+
.recommenders
17+
18+
# External tool builders
19+
.externalToolBuilders/
20+
21+
# Locally stored "Eclipse launch configurations"
22+
*.launch
23+
24+
# PyDev specific (Python IDE for Eclipse)
25+
*.pydevproject
26+
27+
# CDT-specific (C/C++ Development Tooling)
28+
.cproject
29+
30+
# CDT- autotools
31+
.autotools
32+
33+
# Java annotation processor (APT)
34+
.factorypath
35+
36+
# PDT-specific (PHP Development Tools)
37+
.buildpath
38+
39+
# sbteclipse plugin
40+
.target
41+
42+
# Tern plugin
43+
.tern-project
44+
45+
# TeXlipse plugin
46+
.texlipse
47+
48+
# STS (Spring Tool Suite)
49+
.springBeans
50+
51+
# Code Recommenders
52+
.recommenders/
53+
54+
# Annotation Processing
55+
.apt_generated/
56+
57+
# Scala IDE specific (Scala & Java development for Eclipse)
58+
.cache-main
59+
.scala_dependencies
60+
.worksheet
61+
62+
### Eclipse Patch ###
63+
# Eclipse Core
64+
.project
65+
66+
# JDT-specific (Eclipse Java Development Tools)
67+
.classpath
68+
69+
# Annotation Processing
70+
.apt_generated
71+
72+
.sts4-cache/
73+
74+
### Intellij+iml ###
75+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
76+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
77+
78+
# User-specific stuff
79+
.idea/**/workspace.xml
80+
.idea/**/tasks.xml
81+
.idea/**/usage.statistics.xml
82+
.idea/**/dictionaries
83+
.idea/**/shelf
84+
85+
# Generated files
86+
.idea/**/contentModel.xml
87+
88+
# Sensitive or high-churn files
89+
.idea/**/dataSources/
90+
.idea/**/dataSources.ids
91+
.idea/**/dataSources.local.xml
92+
.idea/**/sqlDataSources.xml
93+
.idea/**/dynamic.xml
94+
.idea/**/uiDesigner.xml
95+
.idea/**/dbnavigator.xml
96+
97+
# Gradle
98+
.idea/**/gradle.xml
99+
.idea/**/libraries
100+
101+
# Gradle and Maven with auto-import
102+
# When using Gradle or Maven with auto-import, you should exclude module files,
103+
# since they will be recreated, and may cause churn. Uncomment if using
104+
# auto-import.
105+
# .idea/modules.xml
106+
# .idea/*.iml
107+
# .idea/modules
108+
# *.iml
109+
# *.ipr
110+
111+
# CMake
112+
cmake-build-*/
113+
114+
# Mongo Explorer plugin
115+
.idea/**/mongoSettings.xml
116+
117+
# File-based project format
118+
*.iws
119+
120+
# IntelliJ
121+
out/
122+
123+
# mpeltonen/sbt-idea plugin
124+
.idea_modules/
125+
126+
# JIRA plugin
127+
atlassian-ide-plugin.xml
128+
129+
# Cursive Clojure plugin
130+
.idea/replstate.xml
131+
132+
# Crashlytics plugin (for Android Studio and IntelliJ)
133+
com_crashlytics_export_strings.xml
134+
crashlytics.properties
135+
crashlytics-build.properties
136+
fabric.properties
137+
138+
# Editor-based Rest Client
139+
.idea/httpRequests
140+
141+
# Android studio 3.1+ serialized cache file
142+
.idea/caches/build_file_checksums.ser
143+
144+
### Intellij+iml Patch ###
145+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
146+
147+
*.iml
148+
modules.xml
149+
.idea/misc.xml
150+
*.ipr
151+
152+
### Java ###
153+
# Compiled class file
154+
*.class
155+
156+
# Log file
157+
*.log
158+
159+
# BlueJ files
160+
*.ctxt
161+
162+
# Mobile Tools for Java (J2ME)
163+
.mtj.tmp/
164+
165+
# Package Files #
166+
*.war
167+
*.nar
168+
*.ear
169+
*.zip
170+
*.tar.gz
171+
*.rar
172+
173+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
174+
hs_err_pid*
175+
176+
### Maven ###
177+
target/
178+
pom.xml.tag
179+
pom.xml.releaseBackup
180+
pom.xml.versionsBackup
181+
pom.xml.next
182+
release.properties
183+
dependency-reduced-pom.xml
184+
buildNumber.properties
185+
.mvn/timing.properties
186+
.mvn/wrapper/maven-wrapper.jar
187+
.flattened-pom.xml
188+
189+
# End of https://www.gitignore.io/api/java,maven,eclipse,intellij+iml

0 commit comments

Comments
 (0)