Skip to content

Commit 01b5cfb

Browse files
chore: add github workflow
1 parent 7d51318 commit 01b5cfb

File tree

107 files changed

+1292
-278
lines changed

Some content is hidden

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

107 files changed

+1292
-278
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: maven
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "21:00"
8+
open-pull-requests-limit: 10
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Dependabot auto-merge
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
dependabot:
16+
runs-on: ubuntu-latest
17+
if: github.actor == 'dependabot[bot]'
18+
steps:
19+
- name: Dependabot metadata
20+
id: metadata
21+
uses: dependabot/fetch-metadata@v1
22+
with:
23+
github-token: "${{ secrets.GITHUB_TOKEN }}"
24+
25+
- name: Check if PR is mergeable
26+
run: |
27+
MERGEABLE=$(gh pr view "$PR_URL" --json mergeable -q .mergeable)
28+
echo "Mergeable: $MERGEABLE"
29+
if [ "$MERGEABLE" != "MERGEABLE" ]; then
30+
echo "PR not mergeable. Skipping auto-merge."
31+
exit 0
32+
fi
33+
env:
34+
PR_URL: ${{ github.event.pull_request.html_url }}
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Enable auto-merge for Dependabot PRs
38+
run: gh pr merge --auto --merge "$PR_URL"
39+
env:
40+
PR_URL: ${{ github.event.pull_request.html_url }}
41+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
name: Publish Maven package
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Java
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: 'temurin'
22+
java-version: '21'
23+
cache: 'maven'
24+
server-id: central
25+
server-username: OSSRH_USERNAME
26+
server-password: OSSRH_PASSWORD
27+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
28+
29+
# Set reproducible build timestamp
30+
- name: Set build timestamp
31+
run: |
32+
# Use the commit timestamp for reproducibility
33+
COMMIT_TIMESTAMP=$(git log -1 --format=%ct)
34+
BUILD_TIMESTAMP=$(date -u -d @${COMMIT_TIMESTAMP} +"%Y-%m-%dT%H:%M:%SZ")
35+
echo "BUILD_TIMESTAMP=$BUILD_TIMESTAMP" >> $GITHUB_ENV
36+
echo "Setting build timestamp to: $BUILD_TIMESTAMP"
37+
38+
- name: Build and Test
39+
run: mvn clean verify --batch-mode -Dproject.build.outputTimestamp="${BUILD_TIMESTAMP}"
40+
41+
- name: Determine version from tag
42+
id: version
43+
run: |
44+
RAW_TAG="${GITHUB_REF##*/}"
45+
VERSION="${RAW_TAG#v}"
46+
47+
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
48+
VERSION="${VERSION}-SNAPSHOT"
49+
fi
50+
51+
echo "Resolved version: $VERSION"
52+
echo "VERSION=$VERSION" >> $GITHUB_ENV
53+
54+
- name: Set Maven version
55+
run: mvn versions:set -DnewVersion=${VERSION} -DgenerateBackupPoms=false
56+
57+
- name: Publish to Maven Central
58+
run: mvn deploy --batch-mode -Dproject.build.outputTimestamp="${BUILD_TIMESTAMP}"
59+
env:
60+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
61+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
62+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

.github/workflows/verify.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Verify
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
jobs:
8+
build:
9+
name: Verify
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Java
18+
uses: actions/setup-java@v4
19+
with:
20+
distribution: 'temurin'
21+
java-version: '21'
22+
cache: 'maven'
23+
server-id: central
24+
server-username: OSSRH_USERNAME
25+
server-password: OSSRH_PASSWORD
26+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
27+
28+
- name: Execute the verify step
29+
run: mvn -B verify

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
out/
77
TODO.md
88
.flattened-pom.xml
9-
*.snap.debug
109

1110
# Gradle and Maven with auto-import
1211
# When using Gradle or Maven with auto-import, you should exclude module files,

snapshot-testing-junit5/src/test/java/io/github/finoid/snapshots/docs/__snapshots__/CustomSnapshotContextConfigExample.snap renamed to snapshot-testing-core/src/test/java/io/github/finoid/snapshots/existing-snapshots/__snapshots__/EmptySnapshotFileTest$NestedClass.snap.debug

File renamed without changes.

snapshot-testing-junit5/src/test/java/io/github/finoid/snapshots/docs/__snapshots__/MyFirstSnapshotContextTest.snap renamed to snapshot-testing-core/src/test/java/io/github/finoid/snapshots/existing-snapshots/__snapshots__/EmptySnapshotFileTest.snap.debug

File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
io.github.finoid.snapshots.DebugSnapshotTest.createDebugFile=[
2+
Good Snapshot
3+
]
4+
5+
6+
io.github.finoid.snapshots.DebugSnapshotTest.debugFileCreatedSnapshotMatch=[
7+
Good Snapshot
8+
]
9+
10+
11+
io.github.finoid.snapshots.DebugSnapshotTest.debugFileCreatedExistingSnapshot=[
12+
Good Snapshot
13+
]

snapshot-testing-jackson2/src/main/java/io/github/finoid/snapshots/jackson/serializers/JacksonSnapshotSerializer.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

snapshot-testing-jackson2/src/main/java/io/github/finoid/snapshots/jackson/serializers/DeterministicCollectionModule.java renamed to snapshot-testing-jackson2/src/main/java/io/github/finoid/snapshots/jackson2/serializers/DeterministicCollectionModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.finoid.snapshots.jackson.serializers;
1+
package io.github.finoid.snapshots.jackson2.serializers;
22

33
import com.fasterxml.jackson.core.JsonGenerator;
44
import com.fasterxml.jackson.databind.JsonSerializer;

0 commit comments

Comments
 (0)