Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
702a760
core(hackerrank): Added implementations of SignFlipMaximizer with all…
shortthirdman May 5, 2025
0d9ff5a
core(hackerrank): Added implementation of TradingProfitCalculator alo…
shortthirdman Jun 30, 2025
0d18a48
core(hackerrank): Remediated issues in unit test cases
shortthirdman Jun 30, 2025
793d987
core(codesignal): Added coding challenge problems from CodeSignal
shortthirdman Jul 3, 2025
0d6b952
core(condesignal): Added coding challenges from Visa General Coding A…
shortthirdman Jul 13, 2025
168a9ad
core(codesignal): Removed failed test case for NewspaperFormatter
shortthirdman Jul 13, 2025
464bdf5
core(codesignal): Added coding challenges from PayPay Card on CodeSignal
shortthirdman Jul 16, 2025
00373a1
core(jacoco): Changes for documentation and JaCoCo coverage configura…
shortthirdman Jul 16, 2025
f1728d7
core(codility): Added coding challenges from NPCI using Codility
shortthirdman Jul 19, 2025
6b06506
core(hackerrank): Implemented and added test cases for `FinancialPort…
shortthirdman Sep 9, 2025
2bed083
core(hackerrank): Added and implemented TopKFrequentWords, and ValidP…
shortthirdman Sep 9, 2025
6b6adef
core(codility): Updated test cases in ChessTeamFormation, and RecentR…
shortthirdman Sep 9, 2025
4bcb64e
core(maven): Updated POM with few more plugins and configuration sett…
shortthirdman Sep 9, 2025
2f574e1
core(codesignal): Updated with failed PMD violations and test cases
shortthirdman Sep 10, 2025
85e083f
core(hackerrank): Updated with failed PMD violations and test cases
shortthirdman Sep 10, 2025
372da12
core(leetcode): Updated with failed PMD violations and test cases
shortthirdman Sep 10, 2025
32b13c2
core(codility): Updated with failed PMD violations and test cases
shortthirdman Sep 10, 2025
04e180a
core(maven): Updated plugin configurations for PMD Maven plugin
shortthirdman Sep 10, 2025
12f38d3
core(devops): Added GHA workflow configuration for release management…
shortthirdman Sep 11, 2025
0bab4f5
core(devops): Updated configuration for release workflow
shortthirdman Sep 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 21 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,7 @@ permissions:
pull-requests: write

jobs:

# gradle-build:
# name: Build with Gradle
# runs-on: ubuntu-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v4
#
# - name: Setup Java
# uses: actions/setup-java@v4
# with:
# distribution: 'temurin'
# java-version: 21
# architecture: x64
#
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@v4
# with:
# gradle-version: "8.10.2"
# validate-wrappers: false
# add-job-summary-as-pr-comment: 'always'
# add-job-summary: 'always'
#
# - name: Validate Gradle Wrapper
# uses: gradle/actions/wrapper-validation@v4
#
# - name: Build with Gradle
# run: gradle build
#
# - name: Upload build reports
# uses: actions/upload-artifact@v4
# if: always()
# with:
# name: gradle-build-reports
# path: '**/build/reports/'
# #compression-level: 9

maven-build:
build:
name: Build with Maven
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -91,4 +54,23 @@ jobs:
with:
name: maven-build-reports
path: '**/target/reports/'
compression-level: 9
compression-level: 9

# - name: Generate PMD reports
# uses: pmd/pmd-github-action@v2
# id: pmd
# with:
# version: '7.16.0'
# sourcePath: 'src/main/java'
# rulesets: 'rulesets/java/quickstart.xml,ruleset.xml'
# analyzeModifiedFilesOnly: false

# - name: Fail build if there are violations
# if: steps.pmd.outputs.violations != 0
# run: exit 1

# - name: Upload SARIF file if there are no violations
# if: steps.pmd.outputs.violations == 0
# uses: github/codeql-action/upload-sarif@v3
# with:
# sarif_file: pmd-report.sarif
279 changes: 279 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
name: Maven Release Workflow (prepare + release with individual jars + changelogs)

run-name: Artifacts Publish by @${{ github.actor }}

on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'Release version to set in pom (e.g. 1.2.3)'
required: true
developmentVersion:
description: 'Next development version after release (e.g. 1.2.4-SNAPSHOT)'
required: true
push:
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: read
statuses: write # To report GitHub Actions status checks
actions: read # Needed for detection of GitHub Actions environment.
id-token: write # Needed for provenance signing and ID.
pull-requests: write

jobs:
prepare_release:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Get branch name
run: echo "Branch name is ${{ github.head_ref }}"

- name: Checkout (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: maven

- name: Configure git user
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Set release version in POMs, tag & push
run: |
set -e
echo "Setting POMs to release version: ${{ github.event.inputs.releaseVersion }}"
mvn -B versions:set -DnewVersion=${{ github.event.inputs.releaseVersion }} -DgenerateBackupPoms=false

git add -A
if git diff --staged --quiet; then
echo "No POM changes to commit for release version."
else
git commit -m "chore(release): set version ${{ github.event.inputs.releaseVersion }}"
fi

git tag -a "v${{ github.event.inputs.releaseVersion }}" -m "Release ${{ github.event.inputs.releaseVersion }}"

git push origin HEAD
git push origin "v${{ github.event.inputs.releaseVersion }}"

- name: Bump to development version and push
run: |
set -e
echo "Bumping to next development version: ${{ github.event.inputs.developmentVersion }}"
mvn -B versions:set -DnewVersion=${{ github.event.inputs.developmentVersion }} -DgenerateBackupPoms=false

git add -A
if git diff --staged --quiet; then
echo "No POM changes to commit for development version."
else
git commit -m "chore: bump version to ${{ github.event.inputs.developmentVersion }}"
git push origin HEAD
fi

- name: Done
run: echo "Tag v${{ github.event.inputs.releaseVersion }} pushed. Tag-push workflow will run to build & release."

build_test_and_release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout (full history + tags)
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: maven

- name: Build, run tests & generate JaCoCo report
run: mvn -B clean verify jacoco:report

- name: Prepare artifacts dir and copy JARs & reports
run: |
mkdir -p artifacts
# copy jars (if any)
if compgen -G "target/*.jar" > /dev/null; then
cp target/*.jar artifacts/ || true
else
echo "No jars found in target/"
fi

# copy surefire reports
if [ -d target/surefire-reports ]; then
cp -r target/surefire-reports artifacts/surefire-reports
else
echo "::warning::No surefire-reports found"
fi

# copy jacoco site
if [ -d target/site/jacoco ]; then
cp -r target/site/jacoco artifacts/jacoco-report
else
echo "::warning::No jacoco site found"
fi

- name: Zip reports (surefire + jacoco) into reports.zip
run: |
cd artifacts
ZIP_ENTRIES=""
[ -d surefire-reports ] && ZIP_ENTRIES="$ZIP_ENTRIES surefire-reports"
[ -d jacoco-report ] && ZIP_ENTRIES="$ZIP_ENTRIES jacoco-report"
if [ -n "$ZIP_ENTRIES" ]; then
zip -r reports.zip $ZIP_ENTRIES
else
echo "No report directories to zip; creating empty reports.zip"
printf "" > reports.zip
fi
ls -lah

- name: Install Node (for conventional-changelog)
uses: actions/setup-node@v4
with:
node-version: 18

- name: Generate automated changelog (conventional-changelog) -> auto-changelog.md
run: |
mkdir -p artifacts
# Try generating a conventional changelog; continue on error (npx may fail offline or network)
if npx --yes conventional-changelog -p angular -r 0 --stdout > artifacts/auto-changelog.md 2>/dev/null; then
echo "Auto changelog generated into artifacts/auto-changelog.md"
else
echo "::warning::conventional-changelog generation failed β€” continuing. Creating placeholder."
echo "(conventional-changelog generation failed or not available in runner)" > artifacts/auto-changelog.md
fi
echo "---"
ls -lah artifacts

- name: Generate release notes (simple git log) and combine with auto-changelog
id: gen_notes
run: |
set -e
CURRENT_TAG=${GITHUB_REF#refs/tags/}
PREV_TAG=$(git tag --sort=-creatordate | grep -v "^${CURRENT_TAG}$" | head -n 1 || true)

if [ -n "$PREV_TAG" ]; then
echo "Generating simple changelog from $PREV_TAG..$CURRENT_TAG"
git --no-pager log --pretty=format:'- %s (%an)' "$PREV_TAG"..HEAD > SIMPLE_CHANGELOG.tmp || true
else
echo "No previous tag found; using latest 50 commits"
git --no-pager log --pretty=format:'- %s (%an)' -n 50 HEAD > SIMPLE_CHANGELOG.tmp || true
fi

if [ ! -s SIMPLE_CHANGELOG.tmp ]; then
echo "(No notable commits)" > SIMPLE_CHANGELOG.tmp
fi

# Prepare combined body: simple git-log summary first, then a marker, then point to auto-changelog
echo "SIMPLE CHANGELOG:" > RELEASE_BODY.tmp
cat SIMPLE_CHANGELOG.tmp >> RELEASE_BODY.tmp
echo "" >> RELEASE_BODY.tmp
echo "-----" >> RELEASE_BODY.tmp
echo "" >> RELEASE_BODY.tmp
echo "AUTOMATED CONVENTIONAL CHANGELOG (uploaded as artifact: auto-changelog.md):" >> RELEASE_BODY.tmp
echo "" >> RELEASE_BODY.tmp
# append first 200 lines of auto-changelog (to keep body reasonably sized)
if [ -s artifacts/auto-changelog.md ]; then
sed -n '1,200p' artifacts/auto-changelog.md >> RELEASE_BODY.tmp
else
echo "(no auto changelog generated)" >> RELEASE_BODY.tmp
fi

# expose as multiline output
echo "body<<EOF" >> $GITHUB_OUTPUT
cat RELEASE_BODY.tmp >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: ${{ steps.gen_notes.outputs.body }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload individual JARs to the Release (one asset per jar) using curl
if: always()
env:
UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
echo "Uploading individual JARs from artifacts/*.jar"
shopt -s nullglob
JARS=(artifacts/*.jar)
if [ ${#JARS[@]} -eq 0 ]; then
echo "No JAR files found to upload."
else
for f in "${JARS[@]}"; do
fname=$(basename "$f")
echo "Uploading $fname ..."
# Content-Type application/java-archive for .jar files
curl --fail -s -X POST "${UPLOAD_URL}?name=${fname}" \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Content-Type: application/java-archive" \
--data-binary @"${f}"
echo " -> uploaded $fname"
done
fi

- name: Upload auto-changelog.md and reports.zip to the Release (curl)
if: always()
env:
UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
# upload auto-changelog.md
if [ -f artifacts/auto-changelog.md ]; then
echo "Uploading auto-changelog.md..."
curl --fail -s -X POST "${UPLOAD_URL}?name=auto-changelog-${{ github.ref_name }}.md" \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Content-Type: text/markdown" \
--data-binary @artifacts/auto-changelog.md
echo " -> uploaded auto-changelog"
else
echo "No auto-changelog.md to upload."
fi

# upload reports.zip
if [ -f artifacts/reports.zip ]; then
echo "Uploading reports.zip..."
curl --fail -s -X POST "${UPLOAD_URL}?name=reports-${{ github.ref_name }}.zip" \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Content-Type: application/zip" \
--data-binary @artifacts/reports.zip
echo " -> uploaded reports.zip"
else
echo "No reports.zip found to upload."
fi

- name: Upload workflow artifacts (optional)
uses: actions/upload-artifact@v4
with:
name: maven-artifacts
path: artifacts/
if-no-files-found: warn
retention-days: 14
12 changes: 11 additions & 1 deletion .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
-Xss16m -Xms256m -Xmx1024m -Djava.awt.headless=true
-Xss16m -Xms256m -Xmx1024m -Djava.awt.headless=true
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
Loading