Skip to content
Open
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.]
184 changes: 184 additions & 0 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
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 }}

# Snapshot flag: develop = snapshot, everything else = release
SNAPSHOT: ${{ github.ref == 'refs/heads/develop' }}
RELEASE: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release/*' || github.ref == 'refs/heads/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') }}

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

git fetch --unshallow || true
git fetch origin --prune

if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE_SHA="${{ github.event.pull_request.base.sha }}"
else
BASE_SHA=$(git merge-base HEAD origin/${{ github.ref_name }} || git merge-base HEAD origin/main)
fi

echo "Base SHA: $BASE_SHA"

git diff --name-only $BASE_SHA HEAD > changed.txt

echo "Changed files:"
cat changed.txt

MODULES=""
while read FILE; do
DIR=$(dirname "$FILE")
[ "$DIR" = "." ] && continue

if [ -f "$DIR/build.gradle" ] || [ -f "$DIR/build.gradle.kts" ]; then
MODULES="$MODULES $DIR"
fi
done < changed.txt

echo "modules=$MODULES" >> $GITHUB_OUTPUT

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

# Fallback for push events (base_ref is empty)
if [ -z "$BASE" ]; then
BASE="${{ github.ref_name }}"
fi

for DIR in ${{ steps.changed.outputs.modules }}; do
OLD_VER=$(git show origin/$BASE:$DIR/build.gradle 2>/dev/null \
| grep -E "version\s*=" \
| head -1 \
| sed "s/.*=//; s/[\"']//g; s/ //g")

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

echo "$DIR old=$OLD_VER new=$NEW_VER"

if [ "$OLD_VER" = "$NEW_VER" ]; then
FAILED=1
fi
done

exit $FAILED

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

# ---------------------------------------------------------
# Publish changed OR missing modules
# ---------------------------------------------------------
- name: Publish
if: env.SNAPSHOT == 'true' || env.RELEASE == 'true'
run: ./gradlew publish -Psnapshot=$SNAPSHOT --no-daemon

# ---------------------------------------------------------
# Tag published artifacts with OSH core version
# ---------------------------------------------------------
- name: Tag Nexus Artifacts
if: env.SNAPSHOT == 'true' || env.RELEASE == 'true'
run: |
echo "Tagging Nexus artifacts for ${GITHUB_REPOSITORY} version ${GITHUB_REF_NAME}"

# Determine repo name
if [ "${SNAPSHOT}" = "true" ]; then
REPO_NAME="${{ vars.NEXUS_REPO_SNAPSHOT_NAME }}"
else
REPO_NAME="${{ vars.NEXUS_REPO_RELEASE_NAME }}"
fi

GROUP_ID=$(./gradlew properties | grep "^group:" | awk '{print $2}')
ARTIFACT_ID=$(./gradlew properties | grep "^name:" | awk '{print $2}')
VERSION=$(./gradlew properties | grep "^version:" | awk '{print $2}')

echo "Group: $GROUP_ID"
echo "Artifact: $ARTIFACT_ID"
echo "Version: $VERSION"
echo "Repo: $REPO_NAME"

SEARCH_URL="${NEXUS_REPO_URL}/service/rest/v1/search?repository=${REPO_NAME}&group=${GROUP_ID}&name=${ARTIFACT_ID}&version=${VERSION}"

echo "Searching Nexus: $SEARCH_URL"

ITEMS=$(curl -s -u "${NEXUS_ACTOR}:${NEXUS_TOKEN}" "$SEARCH_URL" | jq -c '.items[]')

if [ -z "$ITEMS" ]; then
echo "No components found in Nexus to tag"
exit 0
fi

for ITEM in $ITEMS; do
COMPONENT_ID=$(echo "$ITEM" | jq -r '.id')
ATTR_URL="${NEXUS_REPO_URL}/service/rest/v1/components/${COMPONENT_ID}/attributes"

echo "Tagging component: $COMPONENT_ID"

PAYLOAD=$(jq -n --arg core "$OSH_CORE_VERSION" '{osh: {coreVersion: $core}}')

curl -s -X PUT \
-u "${NEXUS_ACTOR}:${NEXUS_TOKEN}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
"$ATTR_URL"

echo "Tagged $COMPONENT_ID with coreVersion=$OSH_CORE_VERSION"
done
Loading
Loading