Skip to content

Commit cacd506

Browse files
MelSardesFirebender
andcommitted
feat(infra): add CI/CD workflows and comprehensive project documentation
Add GitHub Actions workflows for automated building, testing, publishing, and semantic releases. Include extensive project documentation covering architecture guides, implementation assessments, enhancement summaries, recommendations, and project roadmap. ? Generated with [Firebender](https://firebender.com) Co-Authored-By: Firebender <help@firebender.com>
1 parent 03093fc commit cacd506

File tree

11 files changed

+2900
-0
lines changed

11 files changed

+2900
-0
lines changed

.github/workflows/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# GitHub Actions Workflows - Currently Disabled
2+
3+
## Status
4+
5+
All workflows are currently **disabled** (renamed with `.disabled` extension).
6+
7+
## Disabled Workflows
8+
9+
- `ci.yml.disabled` - Continuous Integration (build, test, code quality)
10+
- `publish.yml.disabled` - Publish to GitHub Packages
11+
- `release.yml.disabled` - Semantic Release automation
12+
13+
## Reason
14+
15+
The library is currently distributed via manual build and local Maven installation (`publishToMavenLocal`). GitHub Actions will be re-enabled once the publishing infrastructure is properly configured.
16+
17+
## Manual Installation
18+
19+
Users should build and install the library locally:
20+
21+
```bash
22+
git clone https://github.com/melsardes/structus-kotlin.git
23+
cd structus-kotlin
24+
./gradlew build publishToMavenLocal
25+
```
26+
27+
## Re-enabling Workflows
28+
29+
To re-enable the workflows in the future, simply remove the `.disabled` extension:
30+
31+
```bash
32+
mv ci.yml ci.yml
33+
mv publish.yml publish.yml
34+
mv release.yml release.yml
35+
```

.github/workflows/ci.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
workflow_dispatch:
9+
workflow_call: # Allow other workflows to call this one
10+
11+
permissions:
12+
contents: read
13+
checks: write
14+
15+
jobs:
16+
build:
17+
name: Build and Test
18+
runs-on: ${{ matrix.os }}
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ ubuntu-latest, macos-latest, windows-latest ]
24+
java-version: [ 21, 23 ]
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0 # Full history for better analysis
31+
32+
- name: Set up JDK ${{ matrix.java-version }}
33+
uses: actions/setup-java@v4
34+
with:
35+
java-version: ${{ matrix.java-version }}
36+
distribution: 'temurin'
37+
cache: 'gradle'
38+
39+
- name: Setup Gradle
40+
uses: gradle/actions/setup-gradle@v3
41+
with:
42+
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
43+
44+
- name: Grant execute permission for gradlew
45+
if: runner.os != 'Windows'
46+
run: chmod +x gradlew
47+
48+
- name: Build with Gradle
49+
run: ./gradlew build --no-daemon --stacktrace
50+
51+
- name: Run tests with coverage
52+
run: ./gradlew test jacocoTestReport --no-daemon --stacktrace
53+
54+
- name: Verify code coverage
55+
run: ./gradlew jacocoTestCoverageVerification --no-daemon
56+
57+
- name: Upload test results
58+
if: always()
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: test-results-${{ matrix.os }}-jdk-${{ matrix.java-version }}
62+
path: |
63+
lib/build/reports/tests/
64+
lib/build/test-results/
65+
66+
- name: Upload coverage reports
67+
if: matrix.os == 'ubuntu-latest' && matrix.java-version == '21'
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: coverage-report
71+
path: |
72+
lib/build/reports/jacoco/
73+
74+
- name: Check code style
75+
run: ./gradlew check --no-daemon
76+
77+
- name: Upload build artifacts
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: build-artifacts-${{ matrix.os }}-jdk-${{ matrix.java-version }}
81+
path: |
82+
lib/build/libs/
83+
retention-days: 7
84+
85+
code-quality:
86+
name: Code Quality Analysis
87+
runs-on: ubuntu-latest
88+
needs: build
89+
90+
steps:
91+
- name: Checkout code
92+
uses: actions/checkout@v4
93+
with:
94+
fetch-depth: 0
95+
96+
- name: Set up JDK 21
97+
uses: actions/setup-java@v4
98+
with:
99+
java-version: 21
100+
distribution: 'temurin'
101+
cache: 'gradle'
102+
103+
- name: Grant execute permission for gradlew
104+
run: chmod +x gradlew
105+
106+
- name: Run code quality checks
107+
run: ./gradlew check --no-daemon
108+
109+
dependency-check:
110+
name: Dependency Security Check
111+
runs-on: ubuntu-latest
112+
needs: build
113+
114+
steps:
115+
- name: Checkout code
116+
uses: actions/checkout@v4
117+
118+
- name: Set up JDK 21
119+
uses: actions/setup-java@v4
120+
with:
121+
java-version: 21
122+
distribution: 'temurin'
123+
cache: 'gradle'
124+
125+
- name: Grant execute permission for gradlew
126+
run: chmod +x gradlew
127+
128+
- name: Check dependencies
129+
run: ./gradlew dependencies --no-daemon
130+
131+
build-status:
132+
name: Build Status
133+
runs-on: ubuntu-latest
134+
needs: [ build, code-quality, dependency-check ]
135+
if: always()
136+
137+
steps:
138+
- name: Check build status
139+
run: |
140+
if [ "${{ needs.build.result }}" != "success" ]; then
141+
echo "Build failed!"
142+
exit 1
143+
fi
144+
if [ "${{ needs.code-quality.result }}" != "success" ]; then
145+
echo "Code quality checks failed!"
146+
exit 1
147+
fi
148+
if [ "${{ needs.dependency-check.result }}" != "success" ]; then
149+
echo "Dependency check failed!"
150+
exit 1
151+
fi
152+
echo "All checks passed!"

.github/workflows/publish.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to publish (e.g., 1.0.0)'
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
jobs:
18+
publish:
19+
name: Build and Publish Artifacts
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
ref: main
27+
fetch-depth: 0
28+
29+
- name: Set up JDK 21
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: 21
33+
distribution: 'temurin'
34+
cache: 'gradle'
35+
36+
- name: Grant execute permission for gradlew
37+
run: chmod +x gradlew
38+
39+
- name: Get version from gradle.properties
40+
id: get_version
41+
run: |
42+
VERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2)
43+
echo "version=$VERSION" >> $GITHUB_OUTPUT
44+
echo "Publishing version: $VERSION"
45+
46+
- name: Override version for manual dispatch
47+
if: github.event_name == 'workflow_dispatch'
48+
run: |
49+
sed -i "s/^version=.*/version=${{ github.event.inputs.version }}/" gradle.properties
50+
echo "Overridden version to: ${{ github.event.inputs.version }}"
51+
52+
- name: Build library
53+
run: ./gradlew clean build --no-daemon --stacktrace
54+
55+
- name: Run tests with coverage
56+
run: ./gradlew test jacocoTestReport --no-daemon
57+
58+
- name: Publish to GitHub Packages
59+
run: ./gradlew publish --no-daemon
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
GITHUB_ACTOR: ${{ github.actor }}
63+
64+
- name: Upload build artifacts
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: published-artifacts-${{ steps.get_version.outputs.version }}
68+
path: |
69+
lib/build/libs/*.jar
70+
retention-days: 90
71+
72+
- name: Create publish summary
73+
run: |
74+
VERSION="${{ steps.get_version.outputs.version }}"
75+
echo "## 📦 Artifacts Published" >> $GITHUB_STEP_SUMMARY
76+
echo "" >> $GITHUB_STEP_SUMMARY
77+
echo "**Version:** $VERSION" >> $GITHUB_STEP_SUMMARY
78+
echo "**Group:** com.melsardes.libraries" >> $GITHUB_STEP_SUMMARY
79+
echo "**Artifact:** structus-kotlin" >> $GITHUB_STEP_SUMMARY
80+
echo "**Repository:** GitHub Packages" >> $GITHUB_STEP_SUMMARY
81+
echo "" >> $GITHUB_STEP_SUMMARY
82+
echo "### Installation" >> $GITHUB_STEP_SUMMARY
83+
echo "" >> $GITHUB_STEP_SUMMARY
84+
echo '```kotlin' >> $GITHUB_STEP_SUMMARY
85+
echo 'repositories {' >> $GITHUB_STEP_SUMMARY
86+
echo ' maven {' >> $GITHUB_STEP_SUMMARY
87+
echo ' url = uri("https://maven.pkg.github.com/melsardes/structus-kotlin")' >> $GITHUB_STEP_SUMMARY
88+
echo ' credentials {' >> $GITHUB_STEP_SUMMARY
89+
echo ' username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")' >> $GITHUB_STEP_SUMMARY
90+
echo ' password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")' >> $GITHUB_STEP_SUMMARY
91+
echo ' }' >> $GITHUB_STEP_SUMMARY
92+
echo ' }' >> $GITHUB_STEP_SUMMARY
93+
echo '}' >> $GITHUB_STEP_SUMMARY
94+
echo '' >> $GITHUB_STEP_SUMMARY
95+
echo 'dependencies {' >> $GITHUB_STEP_SUMMARY
96+
echo " implementation(\"com.melsardes.libraries:structus-kotlin:$VERSION\")" >> $GITHUB_STEP_SUMMARY
97+
echo '}' >> $GITHUB_STEP_SUMMARY
98+
echo '```' >> $GITHUB_STEP_SUMMARY

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- CI
7+
types:
8+
- completed
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: write
15+
issues: write
16+
pull-requests: write
17+
18+
jobs:
19+
release:
20+
name: Semantic Release
21+
runs-on: ubuntu-latest
22+
# Only run if CI was successful and on main branch
23+
if: |
24+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main') ||
25+
github.event_name == 'workflow_dispatch'
26+
27+
outputs:
28+
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
29+
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
30+
new_release_git_tag: ${{ steps.semantic.outputs.new_release_git_tag }}
31+
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
persist-credentials: false
38+
39+
- name: Semantic Release
40+
id: semantic
41+
uses: cycjimmy/semantic-release-action@v4
42+
with:
43+
semantic_version: 23
44+
extra_plugins: |
45+
@semantic-release/changelog@6
46+
@semantic-release/git@10
47+
@semantic-release/exec@6
48+
conventional-changelog-conventionalcommits@7
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
GIT_AUTHOR_NAME: github-actions[bot]
52+
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
53+
GIT_COMMITTER_NAME: github-actions[bot]
54+
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
55+
56+
- name: Create release summary
57+
if: steps.semantic.outputs.new_release_published == 'true'
58+
run: |
59+
echo "## 🎉 New Release Created" >> $GITHUB_STEP_SUMMARY
60+
echo "" >> $GITHUB_STEP_SUMMARY
61+
echo "**Version:** ${{ steps.semantic.outputs.new_release_version }}" >> $GITHUB_STEP_SUMMARY
62+
echo "**Tag:** ${{ steps.semantic.outputs.new_release_git_tag }}" >> $GITHUB_STEP_SUMMARY
63+
echo "**Group:** com.melsardes.libraries" >> $GITHUB_STEP_SUMMARY
64+
echo "**Artifact:** structus-kotlin" >> $GITHUB_STEP_SUMMARY
65+
echo "" >> $GITHUB_STEP_SUMMARY
66+
echo "### 📦 Next Step" >> $GITHUB_STEP_SUMMARY
67+
echo "The publish workflow will now build and publish the artifacts to GitHub Packages." >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)