Skip to content

Commit 77f9bd3

Browse files
authored
chore: add GitHub Actions workflows for CI, snapshots, and releases (#5)
1 parent aa82f38 commit 77f9bd3

11 files changed

Lines changed: 232 additions & 37 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Main Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Java
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '25'
19+
distribution: 'zulu'
20+
cache: 'maven'
21+
22+
- name: Build and Test
23+
run: ./mvnw clean install
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Snapshot
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Java
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '25'
20+
distribution: 'zulu'
21+
cache: 'maven'
22+
server-id: central
23+
server-username: MAVEN_USERNAME
24+
server-password: MAVEN_PASSWORD
25+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
26+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
27+
28+
- name: Publish Snapshot
29+
run: ./mvnw clean deploy
30+
env:
31+
MAVEN_PUBLISH: "true"
32+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
33+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
34+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/release.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-version:
7+
description: 'Release version (e.g. 1.0.0) — leave blank to use current POM version without -SNAPSHOT'
8+
required: false
9+
next-version:
10+
description: 'Next development version (e.g. 1.0.1-SNAPSHOT) — leave blank to use incremented patch version with -SNAPSHOT'
11+
required: false
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
jobs:
18+
release:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Java
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: '25'
29+
distribution: 'zulu'
30+
cache: 'maven'
31+
server-id: central
32+
server-username: MAVEN_USERNAME
33+
server-password: MAVEN_PASSWORD
34+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
35+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
36+
37+
- name: Determine Versions
38+
id: versions
39+
run: |
40+
CURRENT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
41+
42+
RELEASE_VERSION="${{ inputs.release-version }}"
43+
if [ -z "$RELEASE_VERSION" ]; then
44+
RELEASE_VERSION="${CURRENT_VERSION/-SNAPSHOT/}"
45+
fi
46+
47+
NEXT_VERSION="${{ inputs.next-version }}"
48+
if [ -z "$NEXT_VERSION" ]; then
49+
PATCH=$(echo "$RELEASE_VERSION" | cut -d. -f3)
50+
NEXT_PATCH=$((PATCH + 1))
51+
NEXT_VERSION=$(echo "$RELEASE_VERSION" | sed "s/\.[0-9]*$/.${NEXT_PATCH}-SNAPSHOT/")
52+
fi
53+
54+
echo "release-version=$RELEASE_VERSION" >> $GITHUB_OUTPUT
55+
echo "next-version=$NEXT_VERSION" >> $GITHUB_OUTPUT
56+
57+
- name: Configure Git
58+
run: |
59+
git config user.name "github-actions[bot]"
60+
git config user.email "github-actions[bot]@users.noreply.github.com"
61+
62+
- name: Create Release Branch
63+
run: git checkout -b release-${{ steps.versions.outputs.release-version }}
64+
65+
- name: Set Release Version
66+
run: |
67+
./mvnw versions:set-property \
68+
-Dproperty=revision \
69+
-DnewVersion=${{ steps.versions.outputs.release-version }} \
70+
-DgenerateBackupPoms=false
71+
72+
- name: Build and Deploy Release
73+
run: ./mvnw clean deploy
74+
env:
75+
MAVEN_PUBLISH: "true"
76+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
77+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
78+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
79+
80+
- name: Commit and Tag Release
81+
run: |
82+
git add pom.xml
83+
git commit -m "Release ${{ steps.versions.outputs.release-version }}"
84+
git tag -a v${{ steps.versions.outputs.release-version }} -m "Release ${{ steps.versions.outputs.release-version }}"
85+
86+
- name: Set Next Development Version
87+
run: |
88+
./mvnw versions:set-property \
89+
-Dproperty=revision \
90+
-DnewVersion=${{ steps.versions.outputs.next-version }} \
91+
-DgenerateBackupPoms=false
92+
93+
- name: Commit Next Development Version
94+
run: |
95+
git add pom.xml
96+
git commit -m "Prepare for next development iteration ${{ steps.versions.outputs.next-version }}"
97+
98+
- name: Push Release Branch and Tag
99+
run: git push --follow-tags origin release-${{ steps.versions.outputs.release-version }}
100+
101+
- name: Open and Merge PR to main
102+
env:
103+
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
104+
run: |
105+
PR_URL=$(gh pr create \
106+
--base main \
107+
--head release-${{ steps.versions.outputs.release-version }} \
108+
--title "Prepare for development of ${{ steps.versions.outputs.next-version }}" \
109+
--body "Prepares next development iteration **${{ steps.versions.outputs.next-version }}**.")
110+
111+
gh pr merge "$PR_URL" --squash

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
`codemodel.build` is a language-agnostic Java code model framework (Workday, Inc.) that provides a structured, serializable representation of software systems. A `CodeModel` can be populated from compiled classes (via reflection) or `.java` source files (via javac), then enriched, validated, and compiled through a plugin pipeline. It is the foundation for annotation processors and code generation tools.
66

7-
**Stack:** Java 25 (preview features required), Maven multi-module, Jakarta Inject, custom marshalling framework, Pratt-parser expression engine, JSR-330 DI implementation.
7+
**Stack:** Java 25, Maven multi-module, Jakarta Inject, custom marshalling framework, Pratt-parser expression engine, JSR-330 DI implementation.
88

99
**Structure:**
1010
- `codemodel-foundation` — core `TypeDescriptor`/`TypeUsage`/`Trait` system + naming + marshalling

codemodel-foundation/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<dependency>
5656
<groupId>com.fasterxml.jackson.core</groupId>
5757
<artifactId>jackson-core</artifactId>
58-
<version>${jackson.version}</version>
58+
<version>${jackson-core.version}</version>
5959
<scope>test</scope>
6060
</dependency>
6161

docs/CODEBASE_MAP.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ total_modules: 11
1212

1313
`codemodel.build` is a **language-agnostic, paradigm-neutral Java code model framework** built by Workday, Inc. It provides a structured, serializable representation of software systems that can be inspected, enriched, and transformed. The framework can populate a code model from either compiled classes (via reflection) or `.java` source files (via javac). Downstream consumers use it to build annotation processors, code generators, and static analysis tools.
1414

15-
**Stack:** Java 25 (preview features enabled), Jakarta Inject, Maven, custom marshalling framework, Pratt-parser, JSR-330 DI
15+
**Stack:** Java 25, Jakarta Inject, Maven, custom marshalling framework, Pratt-parser, JSR-330 DI
1616

1717
```mermaid
1818
graph TB
@@ -562,7 +562,7 @@ All model types use `static Type.of(...)` factories with private constructors. N
562562
| `UnsatisfiedDependencyException(Dependency, String, Throwable)` silently drops the `cause` arg | `dependency-injection` |
563563
| Trait class registration metadata is JVM-global static and never cleared | `codemodel-foundation` |
564564
| `level()` on `HierarchicalTypeDescriptor` has no cycle detection — circular hierarchies → `StackOverflowError` | `hierarchical-codemodel` |
565-
| Java 25 + `--enable-preview` required — build fails on JDK < 25 | all modules |
565+
| Java 25 — build fails on JDK < 25 | all modules |
566566
| `AnnotationProcessor.getSupportedAnnotationTypes()` returns empty set before `init()` | `jdk-annotation-processor` |
567567

568568
---

expression-codemodel/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<dependency>
6565
<groupId>com.fasterxml.jackson.core</groupId>
6666
<artifactId>jackson-core</artifactId>
67-
<version>${jackson.version}</version>
67+
<version>${jackson-core.version}</version>
6868
<scope>test</scope>
6969
</dependency>
7070

imperative-codemodel/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<dependency>
4646
<groupId>com.fasterxml.jackson.core</groupId>
4747
<artifactId>jackson-core</artifactId>
48-
<version>${jackson.version}</version>
48+
<version>${jackson-core.version}</version>
4949
<scope>test</scope>
5050
</dependency>
5151

jdk-codemodel/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<dependency>
8989
<groupId>com.fasterxml.jackson.core</groupId>
9090
<artifactId>jackson-core</artifactId>
91-
<version>${jackson.version}</version>
91+
<version>${jackson-core.version}</version>
9292
<scope>test</scope>
9393
</dependency>
9494

objectoriented-codemodel/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<dependency>
7777
<groupId>com.fasterxml.jackson.core</groupId>
7878
<artifactId>jackson-core</artifactId>
79-
<version>${jackson.version}</version>
79+
<version>${jackson-core.version}</version>
8080
<scope>test</scope>
8181
</dependency>
8282

0 commit comments

Comments
 (0)