Skip to content

Commit 712356d

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 53d947b + a65e592 commit 712356d

58 files changed

Lines changed: 5326 additions & 171 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/bdd-matrix.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
files: core-bdd-coverage.txt
7272
flags: core-bdd
7373
- name: Persist core BDD coverage artifact
74-
uses: actions/upload-artifact@v4
74+
uses: actions/upload-artifact@v5
7575
with:
7676
name: core-bdd-coverage
7777
path: core-bdd-coverage.txt
@@ -132,7 +132,7 @@ jobs:
132132
flags: bdd-${{ matrix.module }}
133133
- name: Persist module BDD coverage artifact
134134
if: always()
135-
uses: actions/upload-artifact@v4
135+
uses: actions/upload-artifact@v5
136136
with:
137137
name: bdd-${{ matrix.module }}-coverage
138138
path: modules/${{ matrix.module }}/bdd-${{ matrix.module }}-coverage.txt
@@ -153,7 +153,7 @@ jobs:
153153
echo '' >> $GITHUB_STEP_SUMMARY
154154
echo 'Modules (parallel) overall result: ${{ needs.module-bdd.result }}' >> $GITHUB_STEP_SUMMARY
155155
- name: Download all coverage artifacts
156-
uses: actions/download-artifact@v5
156+
uses: actions/download-artifact@v6
157157
with:
158158
path: bdd-coverage
159159
- name: Merge BDD coverage
@@ -208,7 +208,7 @@ jobs:
208208
flags: merged-bdd
209209
- name: Persist merged BDD coverage artifact
210210
if: always()
211-
uses: actions/upload-artifact@v4
211+
uses: actions/upload-artifact@v5
212212
with:
213213
name: merged-bdd-coverage
214214
path: merged-bdd-coverage.txt

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
flags: unit
4949
- name: Upload unit coverage artifact
5050
# Make the raw Go coverage profile available for the merge job
51-
uses: actions/upload-artifact@v4
51+
uses: actions/upload-artifact@v5
5252
with:
5353
name: unit-coverage
5454
path: coverage.txt
@@ -99,7 +99,7 @@ jobs:
9999
files: cli-coverage.txt
100100
flags: cli
101101
- name: Upload CLI coverage artifact
102-
uses: actions/upload-artifact@v4
102+
uses: actions/upload-artifact@v5
103103
with:
104104
name: cli-coverage
105105
path: cmd/modcli/cli-coverage.txt
@@ -148,19 +148,19 @@ jobs:
148148
- name: Checkout code
149149
uses: actions/checkout@v5
150150
- name: Download unit coverage artifact
151-
uses: actions/download-artifact@v5
151+
uses: actions/download-artifact@v6
152152
with:
153153
name: unit-coverage
154154
path: cov-artifacts
155155
continue-on-error: true
156156
- name: Download cli coverage artifact
157-
uses: actions/download-artifact@v5
157+
uses: actions/download-artifact@v6
158158
with:
159159
name: cli-coverage
160160
path: cov-artifacts
161161
continue-on-error: true
162162
- name: Download merged BDD coverage artifact
163-
uses: actions/download-artifact@v5
163+
uses: actions/download-artifact@v6
164164
with:
165165
name: merged-bdd-coverage
166166
path: cov-artifacts
@@ -180,7 +180,7 @@ jobs:
180180
echo "Merged: ${FILES[*]}"
181181
- name: Upload merged total coverage artifact
182182
if: success() && hashFiles('total-coverage.txt') != ''
183-
uses: actions/upload-artifact@v4
183+
uses: actions/upload-artifact@v5
184184
with:
185185
name: total-coverage
186186
path: total-coverage.txt

.github/workflows/cli-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ jobs:
172172
shell: bash
173173

174174
- name: Upload artifact
175-
uses: actions/upload-artifact@v4
175+
uses: actions/upload-artifact@v5
176176
with:
177177
name: ${{ matrix.asset_name }}
178178
path: cmd/modcli/${{ matrix.artifact_name }}
@@ -224,7 +224,7 @@ jobs:
224224
cat changelog.md
225225
226226
- name: Download all artifacts
227-
uses: actions/download-artifact@v5
227+
uses: actions/download-artifact@v6
228228
with:
229229
path: ./artifacts
230230

.github/workflows/contract-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
echo "has_changes=$has_changes" >> $GITHUB_OUTPUT
127127
128128
- name: Upload contract artifacts
129-
uses: actions/upload-artifact@v4
129+
uses: actions/upload-artifact@v5
130130
if: always()
131131
with:
132132
name: api-contracts-${{ github.run_number }}

.github/workflows/examples-ci.yml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- multi-engine-eventbus
3636
- nats-eventbus
3737
- logmasker-example
38+
- logger-reconfiguration
3839
steps:
3940
- name: Checkout code
4041
uses: actions/checkout@v5
@@ -283,6 +284,55 @@ jobs:
283284
exit 1
284285
fi
285286
287+
elif [ "${{ matrix.example }}" = "logger-reconfiguration" ]; then
288+
# Logger reconfiguration example demonstrates OnConfigLoaded hook
289+
echo "📝 Testing logger-reconfiguration example completion..."
290+
291+
# Run the logger reconfiguration demo and capture output
292+
timeout 30s ./example > app.log 2>&1
293+
EXIT_CODE=$?
294+
295+
# Check if the demo completed successfully
296+
if [ $EXIT_CODE -eq 0 ] && grep -q "Logger Reconfiguration Example Complete" app.log; then
297+
echo "✅ logger-reconfiguration demo completed successfully"
298+
299+
# Verify logger was reconfigured from configuration
300+
if grep -q "Logger reconfigured from configuration" app.log; then
301+
echo "✅ logger-reconfiguration logger was reconfigured based on config"
302+
else
303+
echo "❌ logger-reconfiguration logger was not reconfigured"
304+
echo "📋 Application logs:"
305+
cat app.log
306+
exit 1
307+
fi
308+
309+
# Verify modules initialized with the reconfigured logger
310+
if grep -q "LoggingModule initialized" app.log && grep -q "ServiceModule initialized" app.log; then
311+
echo "✅ logger-reconfiguration modules initialized successfully"
312+
else
313+
echo "❌ logger-reconfiguration modules did not initialize correctly"
314+
echo "📋 Application logs:"
315+
cat app.log
316+
exit 1
317+
fi
318+
319+
# Verify application completed successfully
320+
if grep -q "Application initialized successfully" app.log; then
321+
echo "✅ logger-reconfiguration application completed successfully"
322+
else
323+
echo "❌ logger-reconfiguration application did not complete successfully"
324+
echo "📋 Application logs:"
325+
cat app.log
326+
exit 1
327+
fi
328+
329+
else
330+
echo "❌ logger-reconfiguration demo failed to complete successfully"
331+
echo "📋 Application logs:"
332+
cat app.log
333+
exit 1
334+
fi
335+
286336
elif [ "${{ matrix.example }}" = "multi-engine-eventbus" ]; then
287337
# Multi-engine eventbus example - use Redis for external service demo
288338
echo "🔄 Testing multi-engine-eventbus with Redis service..."
@@ -346,7 +396,8 @@ jobs:
346396
echo "Docker available, testing with NATS service"
347397
348398
# Run the demo using the script which displays output
349-
if timeout 60s ./run-demo.sh run; then
399+
# Increased timeout to 120s to account for Docker image pull time in CI
400+
if timeout 120s ./run-demo.sh run; then
350401
echo "✅ nats-eventbus demo completed successfully with NATS"
351402
# Clean up NATS container
352403
./run-demo.sh cleanup 2>/dev/null || true

.github/workflows/module-release.yml

Lines changed: 146 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,135 @@ jobs:
245245
echo "reason=$REASON" >> $GITHUB_OUTPUT
246246
echo "Next version: ${NEXT_VERSION}, tag will be: modules/${MODULE}/${NEXT_VERSION} ($REASON)"
247247
248-
- name: Generate changelog
248+
- name: Check go.mod for major version v2+
249249
if: steps.skipcheck.outputs.changed == 'true'
250+
id: check_module_path
251+
run: |
252+
set -euo pipefail
253+
MODULE="${{ steps.version.outputs.module }}"
254+
VERSION="${{ steps.version.outputs.next_version }}"
255+
256+
# Extract major version from VERSION (e.g., v2.0.0 -> 2)
257+
MAJOR_VERSION="${VERSION#v}"
258+
MAJOR_VERSION="${MAJOR_VERSION%%.*}"
259+
260+
echo "Major version: $MAJOR_VERSION"
261+
echo "major_version=$MAJOR_VERSION" >> $GITHUB_OUTPUT
262+
263+
# Only check go.mod if major version is 2 or greater
264+
if [ "$MAJOR_VERSION" -ge 2 ]; then
265+
GO_MOD_PATH="modules/${MODULE}/go.mod"
266+
CURRENT_MODULE_PATH=$(grep "^module " "$GO_MOD_PATH" | awk '{print $2}')
267+
echo "Current module path: $CURRENT_MODULE_PATH"
268+
echo "current_module_path=$CURRENT_MODULE_PATH" >> $GITHUB_OUTPUT
269+
270+
# Check if module path already has version suffix
271+
if [[ "$CURRENT_MODULE_PATH" =~ /v[0-9]+$ ]]; then
272+
# Extract current major version from module path
273+
CURRENT_MAJOR="${CURRENT_MODULE_PATH##*/v}"
274+
echo "Current module path has version suffix: v$CURRENT_MAJOR"
275+
276+
if [ "$CURRENT_MAJOR" -ne "$MAJOR_VERSION" ]; then
277+
echo "ERROR: Module path has /v${CURRENT_MAJOR} but releasing v${MAJOR_VERSION}"
278+
echo "Please manually update module path in ${GO_MOD_PATH} to include /v${MAJOR_VERSION}"
279+
exit 1
280+
fi
281+
echo "Module path already correct for v${MAJOR_VERSION}"
282+
echo "needs_update=false" >> $GITHUB_OUTPUT
283+
else
284+
# No version suffix, need to add it
285+
echo "Module path needs v${MAJOR_VERSION} suffix"
286+
echo "needs_update=true" >> $GITHUB_OUTPUT
287+
NEW_MODULE_PATH="${CURRENT_MODULE_PATH}/v${MAJOR_VERSION}"
288+
echo "new_module_path=$NEW_MODULE_PATH" >> $GITHUB_OUTPUT
289+
fi
290+
else
291+
echo "Major version is $MAJOR_VERSION (< 2), no module path update needed"
292+
echo "needs_update=false" >> $GITHUB_OUTPUT
293+
fi
294+
295+
- name: Create PR for module path update
296+
if: steps.skipcheck.outputs.changed == 'true' && steps.check_module_path.outputs.needs_update == 'true'
297+
run: |
298+
set -euo pipefail
299+
MODULE="${{ steps.version.outputs.module }}"
300+
VERSION="${{ steps.version.outputs.next_version }}"
301+
MAJOR_VERSION="${{ steps.check_module_path.outputs.major_version }}"
302+
CURRENT_MODULE_PATH="${{ steps.check_module_path.outputs.current_module_path }}"
303+
NEW_MODULE_PATH="${{ steps.check_module_path.outputs.new_module_path }}"
304+
305+
# Create a new branch for the module path update
306+
BRANCH_NAME="chore/${MODULE}-update-module-path-v${MAJOR_VERSION}"
307+
git checkout -b "$BRANCH_NAME"
308+
309+
# Update the module path in go.mod
310+
GO_MOD_PATH="modules/${MODULE}/go.mod"
311+
sed -i "s|^module ${CURRENT_MODULE_PATH}|module ${NEW_MODULE_PATH}|" "$GO_MOD_PATH"
312+
313+
# Run go mod tidy to ensure consistency
314+
cd "modules/${MODULE}"
315+
go mod tidy
316+
cd ../..
317+
318+
# Commit the change
319+
git config user.name 'github-actions[bot]'
320+
git config user.email 'github-actions[bot]@users.noreply.github.com'
321+
git add "modules/${MODULE}/go.mod"
322+
# Add go.sum if it was modified
323+
git add "modules/${MODULE}/go.sum" 2>/dev/null || true
324+
git commit -m "chore(${MODULE}): update module path for v${MAJOR_VERSION}
325+
326+
This updates the ${MODULE} module path from:
327+
${CURRENT_MODULE_PATH}
328+
to:
329+
${NEW_MODULE_PATH}
330+
331+
This is required for releasing version ${VERSION} according to Go module versioning requirements.
332+
See https://go.dev/blog/v2-go-modules for more information."
333+
334+
# Push the branch
335+
git push origin "$BRANCH_NAME"
336+
337+
# Create the PR
338+
gh pr create \
339+
--title "chore(${MODULE}): update module path for v${MAJOR_VERSION}" \
340+
--body "## Module Path Update for ${MODULE} ${VERSION}
341+
342+
This PR updates the module path in \`modules/${MODULE}/go.mod\` to include the \`/v${MAJOR_VERSION}\` suffix as required by Go module versioning for major versions 2 and above.
343+
344+
### Changes:
345+
- **Module**: ${MODULE}
346+
- **Old module path**: \`${CURRENT_MODULE_PATH}\`
347+
- **New module path**: \`${NEW_MODULE_PATH}\`
348+
349+
### Why This Change Is Needed:
350+
According to Go module versioning requirements, when releasing a major version v2 or higher, the module path must include a version suffix. This ensures proper dependency resolution and prevents conflicts with v0/v1 versions.
351+
352+
Reference: https://go.dev/blog/v2-go-modules
353+
354+
### Next Steps:
355+
1. Review and merge this PR
356+
2. After merging, re-run the module release workflow for **${MODULE}** to complete the ${VERSION} release
357+
358+
This PR was automatically created by the module release workflow." \
359+
--base "${{ github.ref_name }}" \
360+
--head "$BRANCH_NAME"
361+
362+
echo "✓ Created PR for module path update"
363+
echo ""
364+
echo "============================================"
365+
echo "⚠️ RELEASE PAUSED"
366+
echo "============================================"
367+
echo ""
368+
echo "A PR has been created to update the module path for ${MODULE} v${MAJOR_VERSION}."
369+
echo "Please merge the PR, then re-run this release workflow to complete the release."
370+
echo ""
371+
exit 1
372+
env:
373+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
374+
375+
- name: Generate changelog
376+
if: steps.skipcheck.outputs.changed == 'true' && steps.check_module_path.outputs.needs_update != 'true'
250377
run: |
251378
MODULE=${{ steps.version.outputs.module }}
252379
TAG=${{ steps.version.outputs.tag }}
@@ -304,7 +431,7 @@ jobs:
304431
echo "Generated changelog for $MODULE"
305432
306433
- name: Create release
307-
if: steps.skipcheck.outputs.changed == 'true'
434+
if: steps.skipcheck.outputs.changed == 'true' && steps.check_module_path.outputs.needs_update != 'true'
308435
id: create_release
309436
run: |
310437
gh release create ${{ steps.version.outputs.tag }} \
@@ -334,12 +461,25 @@ jobs:
334461
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
335462

336463
- name: Announce to Go proxy
337-
if: steps.skipcheck.outputs.changed == 'true'
464+
if: steps.skipcheck.outputs.changed == 'true' && steps.check_module_path.outputs.needs_update != 'true'
338465
run: |
466+
set -euo pipefail
339467
VERSION=${{ steps.version.outputs.next_version }}
340-
MODULE_NAME="github.com/CrisisTextLine/modular/modules/${{ steps.version.outputs.module }}"
468+
MODULE="${{ steps.version.outputs.module }}"
469+
470+
# Extract major version from VERSION
471+
MAJOR_VERSION="${VERSION#v}"
472+
MAJOR_VERSION="${MAJOR_VERSION%%.*}"
473+
474+
# Construct correct module path with version suffix for v2+
475+
if [ "$MAJOR_VERSION" -ge 2 ]; then
476+
MODULE_NAME="github.com/CrisisTextLine/modular/modules/${MODULE}/v${MAJOR_VERSION}"
477+
else
478+
MODULE_NAME="github.com/CrisisTextLine/modular/modules/${MODULE}"
479+
fi
341480
342-
go get ${MODULE_NAME}@${VERSION}
481+
echo "Announcing ${MODULE_NAME}@${VERSION} to Go proxy..."
482+
GOPROXY=proxy.golang.org go list -m ${MODULE_NAME}@${VERSION}
343483
344-
echo "Announced version ${{steps.version.outputs.module}}@${VERSION} to Go proxy"
484+
echo "Announced version ${MODULE}@${VERSION} to Go proxy"
345485

0 commit comments

Comments
 (0)