Skip to content

Commit 49abb16

Browse files
committed
Initial commit
0 parents  commit 49abb16

File tree

14 files changed

+2484
-0
lines changed

14 files changed

+2484
-0
lines changed

.github/workflows/maven.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
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: [21, 25]
34+
include:
35+
# lengthy build steps should only be performed on linux with Java 17 (Sonarcloud analysis, deployment)
36+
- os: ubuntu-latest
37+
jdk: 21
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: sonatype-central-portal # 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_bundle-namespace-validators -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 "MVN_GOAL=clean deploy org.sonarsource.scanner.maven:sonar-maven-plugin:sonar" >> $GITHUB_ENV
74+
echo "STEP_NAME_SUFFIX=(Deploys to Central Portal)" >> $GITHUB_ENV
75+
else
76+
echo "MVN_GOAL=clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:5.2.0.4988:sonar" >> $GITHUB_ENV
77+
fi
78+
else
79+
echo "MVN_ADDITIONAL_OPTS=" >> $GITHUB_ENV
80+
echo "MVN_GOAL=clean verify" >> $GITHUB_ENV
81+
fi
82+
- name: Set up Maven
83+
# https://maven.apache.org/wrapper/#using-a-different-version-of-maven
84+
run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.3.4:wrapper "-Dmaven=3.9.11"
85+
86+
- name: ${{ matrix.namePrefix }} Build with Maven ${{ env.STEP_NAME_SUFFIX }}
87+
env:
88+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
MAVEN_USERNAME: ${{ secrets.SONATYPE_CENTRAL_TOKEN_USER }}
91+
MAVEN_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_TOKEN_PASSWORD }}
92+
run: ./mvnw -e -B -V ${{ env.MVN_GOAL }} ${{ env.MVN_ADDITIONAL_OPTS }}
93+
94+
- name: Upload Test Results
95+
if: always()
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: Test Results (${{ matrix.os }}, JDK ${{ matrix.jdk }}))
99+
path: |
100+
target/surefire-reports/TEST*.xml
101+
target/invoker-reports/TEST*.xml
102+
target/it/**/build.log
103+
104+
publish-test-results:
105+
name: "Publish Tests Results"
106+
needs: build
107+
runs-on: ubuntu-latest
108+
permissions:
109+
checks: write
110+
111+
# only needed unless run with comment_mode: off
112+
pull-requests: write
113+
114+
# only needed for private repository
115+
contents: read
116+
117+
# only needed for private repository
118+
issues: read
119+
if: always()
120+
121+
steps:
122+
- name: Download Artifacts
123+
uses: actions/download-artifact@v4
124+
with:
125+
path: artifacts
126+
127+
- name: Publish Test Results
128+
uses: EnricoMi/publish-unit-test-result-action@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6
129+
with:
130+
files: "artifacts/**/*.xml"

.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

.license-header.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*-
2+
* #%L
3+
* Bundle Namespace Validators Bnd Plugin
4+
* %%
5+
* Copyright (C) 2025 Cognizant Netcentric
6+
* %%
7+
* All rights reserved. This program and the accompanying materials are made available under the terms of the
8+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
9+
* https://www.eclipse.org/legal/epl-v20.html
10+
* SPDX-License-Identifier: EPL-2.0
11+
* #L%
12+
*/

0 commit comments

Comments
 (0)