Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/defect-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Defect Report
about: Create a report to help us improve
title: "[DEFECT]"
labels: bug, security
assignees: ''

---

## Issue

### Description
[Description of the issue]

### Steps to Reproduce
[Steps to reproduce the issue]

### Expected Behavior
[What you expected to happen]

### Actual Behavior
[What actually happened]

### Screenshots
[If applicable, add screenshots to help explain your problem.]

### OpenSensorHub Config File
[If applicable, attach the config.json in use when issue occurred.]

### OpenSensorHub Data Store File(s)
[If applicable, attach the datastore files in use when issue occurred.]

### Additional Information
[Add any other context about the problem here.]
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/driver-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Driver Request
about: Describe driver to be built
title: "[DRIVER]"
labels: driver
assignees: ''

---

## Driver Request

### Description
[Description of the enhancement/feature request]

#### Interface Documentation
[Attach documents, links, or information on how to connect to source of truth data, if available]

### Use Case
[What is the use case for this enhancement/feature request?]

### Additional Information
[Add any other context about the enhancement/feature request here.]
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[ENHANCEMENT]"
labels: enhancement
assignees: ''

---

## Enhancement/Feature Request

### Description
[Description of the enhancement/feature request]

### Use Case
[What is the use case for this enhancement/feature request?]

### Expected Behavior
[What you expect to happen after this enhancement/feature is implemented]

### Current Behavior
[What currently happens without this enhancement/feature]

### Additional Information
[Add any other context about the enhancement/feature request here.]
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/process-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Process Request
about: Describe process to be built
title: "[PROCESS]"
labels: process
assignees: ''

---

## Process Request

### Description
[Description of the enhancement/feature request]

### Use Case
[What is the use case for this enhancement/feature request?]

#### Inputs
[What are the inputs for this process]

#### Outputs
[What are the outputs for this process]

### Additional Information
[Add any other context about the enhancement/feature request here.]
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/security-vulnerability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Security Vulnerability
about: Describe the security vulnerability
title: "[SECURITY]"
labels: security
assignees: ''

---

## Issue

### Description
[Description of the issue]

### Steps to Reproduce
[Steps to reproduce the issue]

### Expected Behavior
[What you expected to happen]

### Actual Behavior
[What actually happened]

### Screenshots
[If applicable, add screenshots to help explain your problem.]

### OpenSensorHub Config File
[If applicable, attach the config.json in use when issue occurred.]

### OpenSensorHub Data Store File(s)
[If applicable, attach the datastore files in use when issue occurred.]

### Additional Information
[Add any other context about the problem here.]
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/service-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Service Request
about: Describe service to be built
title: "[SERVICE]"
labels: service
assignees: ''

---

## Service Request

### Description
[Description of the enhancement/feature request]

### Use Case
[What is the use case for this enhancement/feature request?]

### Additional Information
[Add any other context about the enhancement/feature request here.]
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Task
about: Describes a task related to SOCOM customer that does not require code changes.
title: "[TASK] "
labels: task
assignees: ''

---

## Task

### Description
[Description of the work to be performed]

### Additional Information
[Add any other context about the enhancement/feature request here.]
174 changes: 174 additions & 0 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: GitFlow CI

permissions:
contents: write

on:
push:
branches:
- main
- develop
- 'release/*'
- 'hotfix/*'
- 'feature/*'
pull_request:

jobs:
gitflow-ci:
runs-on: ubuntu-latest

env:
NEXUS_ACTOR: ${{ secrets.NEXUS_ACTOR }}
NEXUS_TOKEN: ${{ secrets.NEXUS_TOKEN }}
NEXUS_REPO_URL: ${{ vars.NEXUS_REPO_URL }}
NEXUS_REPO_SNAPSHOT: ${{ vars.NEXUS_REPO_SNAPSHOT }}
NEXUS_REPO_RELEASE: ${{ vars.NEXUS_REPO_RELEASE }}
OSH_CORE_VERSION: ${{ vars.OSH_CORE_VERSION }}

# FIXED: Uses github.ref_name to safely detect true target branches on both PUSH and PR events
SNAPSHOT: ${{ github.ref_name == 'develop' }}
RELEASE: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release/') || startsWith(github.ref_name, 'hotfix/') }}

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

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

- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}

# FIXED: Prevents "Permission Denied" crashes when calling the wrapper
- name: Make Gradle Wrapper Executable
run: chmod +x gradlew

# ---------------------------------------------------------
# Detect changed modules
# ---------------------------------------------------------
- name: Detect changed modules
id: changed
run: |
echo "Detecting changed modules..."

if [ "${{ github.event_name }}" = "pull_request" ]; then
# Ensure the PR base branch commit tracking metadata is pulled locally
git fetch origin ${{ github.base_ref }} --depth=100
BASE_SHA="${{ github.event.pull_request.base.sha }}"
else
BASE_SHA="${{ github.event.before }}"
fi

# Fallback if it is a brand new branch with no previous tracking history
if [ -z "$BASE_SHA" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then
git fetch origin main --depth=1
BASE_SHA=$(git rev-parse origin/main)
fi

echo "Base SHA determined: $BASE_SHA"
echo "base_sha=$BASE_SHA" >> $GITHUB_OUTPUT

git diff --name-only $BASE_SHA HEAD > changed_files.txt
echo "--- Changed Files ---"
cat changed_files.txt
echo "---------------------"

MODULES=""
while IFS= read -r FILE; do
[ -z "$FILE" ] && continue
DIR=$(dirname "$FILE")

while [ "$DIR" != "." ] && [ "$DIR" != "/" ]; do
if [ -f "$DIR/build.gradle" ] || [ -f "$DIR/build.gradle.kts" ]; then
MODULES="$MODULES $DIR"
break
fi
DIR=$(dirname "$DIR")
done
done < changed_files.txt

UNIQUE_MODULES=$(echo "$MODULES" | xargs -n1 2>/dev/null | sort -u | xargs)

echo "Detected Gradle Modules: $UNIQUE_MODULES"
echo "modules=$UNIQUE_MODULES" >> $GITHUB_OUTPUT

# ---------------------------------------------------------
# Enforce version bumps
# ---------------------------------------------------------
- name: Enforce version bumps
if: steps.changed.outputs.modules != ''
run: |
FAILED=0
BASE_SHA="${{ steps.changed.outputs.base_sha }}"

for DIR in ${{ steps.changed.outputs.modules }}; do
echo "Checking version bump for module: $DIR"

# FIXED: Added logic to verify if commit references are readable to prevent Git object crashes
if git show "$BASE_SHA:$DIR/build.gradle" >/dev/null 2>&1; then
OLD_VER=$(git show "$BASE_SHA:$DIR/build.gradle" | grep -E "version\s*=" | head -1 | sed "s/.*=//; s/[\"']//g; s/ //g")
elif git show "$BASE_SHA:$DIR/build.gradle.kts" >/dev/null 2>&1; then
OLD_VER=$(git show "$BASE_SHA:$DIR/build.gradle.kts" | grep -E "version\s*=" | head -1 | sed "s/.*=//; s/[\"']//g; s/ //g")
else
OLD_VER="NEW_MODULE"
fi

if [ -f "$DIR/build.gradle" ]; then
NEW_VER=$(grep -E "version\s*=" "$DIR/build.gradle" | head -1 | sed "s/.*=//; s/[\"']//g; s/ //g")
else
NEW_VER=$(grep -E "version\s*=" "$DIR/build.gradle.kts" | head -1 | sed "s/.*=//; s/[\"']//g; s/ //g")
fi

echo " -> Old version: $OLD_VER"
echo " -> New version: $NEW_VER"

if [ "$OLD_VER" = "NEW_MODULE" ]; then
echo " -> OK: New module detected."
elif [ "$OLD_VER" = "$NEW_VER" ] || [ -z "$NEW_VER" ]; then
echo " -> ERROR: Version was not bumped or is missing in $DIR!"
FAILED=1
else
echo " -> OK: Version bumped successfully."
fi
done

exit $FAILED

# ---------------------------------------------------------
# Build & Test
# ---------------------------------------------------------
- name: Build & Test
run: ./gradlew clean build --no-daemon -Psnapshot=$SNAPSHOT

# ---------------------------------------------------------
# Publish ONLY changed modules
# ---------------------------------------------------------
- name: Publish
# FIXED: Env checks match string literal conditions perfectly across branches
if: steps.changed.outputs.modules != '' && (env.SNAPSHOT == 'true' || env.RELEASE == 'true')
run: |
GRADLE_TASKS=""

for DIR in ${{ steps.changed.outputs.modules }}; do
if [ -f "$DIR/build.gradle" ] || [ -f "$DIR/build.gradle.kts" ]; then
GRADLE_TASKS="$GRADLE_TASKS :$(basename "$DIR"):publish"
fi
done

if [ -z "$GRADLE_TASKS" ]; then
echo "No deployable submodules detected for publication."
exit 0
fi

echo "Executing targeted publication for:$GRADLE_TASKS"
./gradlew $GRADLE_TASKS -Psnapshot=$SNAPSHOT --no-daemon
Loading
Loading