Skip to content

Commit f79e1fd

Browse files
committed
Merge branch 'develop' into update-from-template-merged
2 parents 95c9943 + af00317 commit f79e1fd

File tree

325 files changed

+42727
-164
lines changed

Some content is hidden

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

325 files changed

+42727
-164
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ body:
1515
attributes:
1616
label: "Checklist"
1717
options:
18-
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
18+
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/mockserver-neolight/releases/latest)"
1919
required: true
20-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
20+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/mockserver-neolight/issues) or [closed](https://github.com/xdev-software/mockserver-neolight/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
2121
required: true
2222
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
2323
required: true

.github/ISSUE_TEMPLATE/enhancement.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ body:
1313
attributes:
1414
label: "Checklist"
1515
options:
16-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
16+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/mockserver-neolight/issues) or [closed](https://github.com/xdev-software/mockserver-neolight/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1717
required: true
1818
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
1919
required: true

.github/ISSUE_TEMPLATE/question.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/mockserver-neolight/issues) or [closed](https://github.com/xdev-software/mockserver-neolight/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
1818
required: true

.github/workflows/check-build.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ on:
1919
- '.idea/**'
2020
- 'assets/**'
2121

22-
env:
23-
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo
24-
2522
jobs:
2623
build:
2724
runs-on: ubuntu-latest
@@ -48,7 +45,7 @@ jobs:
4845
${{ runner.os }}-mvn-build-
4946
5047
- name: Build with Maven
51-
run: ./mvnw -B clean package
48+
run: ./mvnw -B clean package -P run-integration-tests
5249

5350
- name: Check for uncommited changes
5451
run: |
@@ -68,13 +65,27 @@ jobs:
6865
exit 1
6966
fi
7067
71-
- name: Upload demo files
68+
- name: Upload standalone server JAR
7269
uses: actions/upload-artifact@v4
7370
with:
74-
name: demo-files-java-${{ matrix.java }}
75-
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
71+
name: server-${{ matrix.java }}
72+
path: server/target/server-standalone.jar
7673
if-no-files-found: error
7774

75+
# Build docker
76+
- uses: docker/setup-qemu-action@v3
77+
78+
- uses: docker/setup-buildx-action@v3
79+
80+
- uses: docker/build-push-action@v6
81+
with:
82+
context: ./server
83+
push: false
84+
tags: mockserver-standalone:experimental
85+
platforms: linux/amd64,linux/arm64
86+
cache-from: type=gha
87+
cache-to: type=gha,mode=max
88+
7889
checkstyle:
7990
runs-on: ubuntu-latest
8091
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
@@ -148,7 +159,8 @@ jobs:
148159
run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C
149160

150161
- name: Run CPD (Copy Paste Detector)
151-
run: ./mvnw -B pmd:aggregate-cpd pmd:cpd-check -P pmd -DskipTests -T2C
162+
# Todo: Readd pmd:cpd-check - Disabled for now due to upstream code
163+
run: ./mvnw -B pmd:aggregate-cpd -P pmd -DskipTests -T2C
152164

153165
- name: Upload report
154166
if: always()
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Image vuln scan
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "22 7 * * 0"
7+
8+
permissions:
9+
issues: write
10+
11+
env:
12+
# Note: Use ghcr since we have no rate limiting there
13+
TRIVYY_IMAGE_REF: 'ghcr.io/xdev-software/mockserver-neolight:latest'
14+
15+
jobs:
16+
scan:
17+
runs-on: ubuntu-latest
18+
continue-on-error: true # Ignore errors, we create an issue instead
19+
steps:
20+
- uses: actions/checkout@v5
21+
22+
- name: Scan - Full
23+
uses: aquasecurity/[email protected]
24+
with:
25+
image-ref: ${{ env.TRIVYY_IMAGE_REF }}
26+
27+
- name: Scan - Relevant
28+
id: scan_relevant
29+
uses: aquasecurity/[email protected]
30+
with:
31+
image-ref: ${{ env.TRIVYY_IMAGE_REF }}
32+
exit-code: 1
33+
severity: 'HIGH,CRITICAL,UNKNOWN'
34+
output: reported.txt
35+
env:
36+
TRIVY_DISABLE_VEX_NOTICE: 1
37+
38+
- name: Find already existing issue
39+
id: find-issue
40+
if: ${{ always() }}
41+
run: |
42+
echo "number=$(gh issue list -l 'bug' -l 'automated' -L 1 -S 'in:title "Trivy Vulnerability Report"' -s 'open' --json 'number' --jq '.[].number')" >> $GITHUB_OUTPUT
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
46+
- name: Close issue if everything is fine
47+
if: ${{ success() && steps.find-issue.outputs.number != '' }}
48+
run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }}
49+
env:
50+
GH_TOKEN: ${{ github.token }}
51+
52+
- name: Reformat report
53+
if: ${{ failure() && steps.scan_relevant.conclusion == 'failure' }}
54+
run: |
55+
echo 'Trivy reported vulnerabilities that should be addressed:' > reported.md
56+
echo '```' >> reported.md
57+
cat reported.txt >> reported.md
58+
echo '```' >> reported.md
59+
cat reported.md
60+
61+
- name: Create Issue From File
62+
if: ${{ failure() && steps.scan_relevant.conclusion == 'failure' }}
63+
uses: peter-evans/create-issue-from-file@fca9117c27cdc29c6c4db3b86c48e4115a786710 # v6
64+
with:
65+
issue-number: ${{ steps.find-issue.outputs.number }}
66+
title: Trivy Vulnerability Report
67+
content-filepath: ./reported.md
68+
labels: bug, automated

.github/workflows/release.yml

Lines changed: 145 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
push:
55
branches: [ master ]
66

7-
env:
8-
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
9-
107
permissions:
118
contents: write
129
pull-requests: write
@@ -62,6 +59,7 @@ jobs:
6259
timeout-minutes: 10
6360
outputs:
6461
upload_url: ${{ steps.create-release.outputs.upload_url }}
62+
version: ${{ steps.version.outputs.release }}
6563
steps:
6664
- uses: actions/checkout@v5
6765

@@ -76,10 +74,9 @@ jobs:
7674
- name: Get version
7775
id: version
7876
run: |
79-
version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
77+
version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
8078
echo "release=$version" >> $GITHUB_OUTPUT
8179
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
82-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
8380
8481
- name: Commit and Push
8582
run: |
@@ -101,15 +98,42 @@ jobs:
10198
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
10299
103100
## Installation
101+
102+
### BOM
103+
Note that you can also use the [BOM](https://github.com/${{ github.repository }}/tree/develop/bom) for easier dependency management.
104+
105+
### Client
106+
Add the following lines to your pom:
107+
```XML
108+
<dependency>
109+
<groupId>software.xdev.mockserver</groupId>
110+
<artifactId>client</artifactId>
111+
<version>${{ steps.version.outputs.release }}</version>
112+
</dependency>
113+
```
114+
115+
### Testcontainers Integration
104116
Add the following lines to your pom:
105117
```XML
106118
<dependency>
107-
<groupId>software.xdev</groupId>
108-
<artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
119+
<groupId>software.xdev.mockserver</groupId>
120+
<artifactId>testcontainers</artifactId>
109121
<version>${{ steps.version.outputs.release }}</version>
110122
</dependency>
111123
```
112124
125+
### Standalone/Server
126+
127+
#### Docker
128+
Download the image from
129+
* [DockerHub](https://hub.docker.com/r/xdevsoftware/mockserver/tags?name=${{ steps.version.outputs.release }})
130+
* [GitHub Packages (ghcr.io)](https://github.com/xdev-software/mockserver-neolight/pkgs/container/mockserver-neolight)
131+
132+
#### JAR
133+
If you don't like to use the docker image, the executable jar is also available
134+
* at [Maven Central](https://repo1.maven.org/maven2/software/xdev/mockserver/server/${{ steps.version.outputs.release }}/server-${{ steps.version.outputs.release }}-standalone.jar)
135+
* or in the release assets below
136+
113137
publish-maven:
114138
runs-on: ubuntu-latest
115139
needs: [prepare-release]
@@ -133,13 +157,18 @@ jobs:
133157
gpg-passphrase: MAVEN_GPG_PASSPHRASE
134158
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
135159

136-
- name: Publish to GitHub Packages Central
137-
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
138-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
160+
- name: Publish to GitHub Packages
161+
run: |
162+
modules=("bom")
163+
dependency_management_block=$(grep -ozP '<dependencyManagement>(\r|\n|.)*<\/dependencyManagement>' 'bom/pom.xml' | tr -d '\0')
164+
modules+=($(echo $dependency_management_block | grep -oP '(?<=<artifactId>)[^<]+'))
165+
printf -v modules_joined '%s,' "${modules[@]}"
166+
modules_arg=$(echo "${modules_joined%,}")
167+
./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
139168
env:
140169
PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
141170
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
142-
171+
143172
- name: Set up JDK
144173
uses: actions/setup-java@v5
145174
with: # running setup-java again overwrites the settings.xml
@@ -151,16 +180,105 @@ jobs:
151180
gpg-passphrase: MAVEN_GPG_PASSPHRASE
152181

153182
- name: Publish to Central Portal
154-
run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests
183+
run: |
184+
modules=("bom")
185+
dependency_management_block=$(grep -ozP '<dependencyManagement>(\r|\n|.)*<\/dependencyManagement>' 'bom/pom.xml' | tr -d '\0')
186+
modules+=($(echo $dependency_management_block | grep -oP '(?<=<artifactId>)[^<]+'))
187+
printf -v modules_joined '%s,' "${modules[@]}"
188+
modules_arg=$(echo "${modules_joined%,}")
189+
./mvnw -B deploy -pl "$modules_arg" -am -T2C -P publish,publish-sonatype-central-portal -DskipTests
155190
env:
156191
MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }}
157192
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }}
158193
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
159-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
194+
195+
- name: Upload server standalone JAR
196+
uses: actions/upload-artifact@v4
197+
with:
198+
name: server-standalone
199+
path: server/target/server-standalone.jar
200+
if-no-files-found: error
201+
202+
- name: Upload Release assets
203+
uses: shogo82148/actions-upload-release-asset@v1
204+
with:
205+
upload_url: ${{ needs.prepare-release.outputs.upload_url }}
206+
asset_path: server/target/server-standalone.jar
207+
208+
publish-docker:
209+
runs-on: ubuntu-latest
210+
needs: [prepare-release, publish-maven]
211+
timeout-minutes: 15
212+
permissions:
213+
packages: write
214+
contents: read
215+
attestations: write
216+
id-token: write
217+
steps:
218+
- uses: actions/checkout@v5
219+
220+
- name: Init Git and pull
221+
run: |
222+
git config --global user.email "[email protected]"
223+
git config --global user.name "GitHub Actions"
224+
git pull
225+
226+
- name: Download server JAR
227+
uses: actions/download-artifact@v5
228+
with:
229+
name: server-standalone
230+
path: server/target
231+
232+
- uses: docker/setup-qemu-action@v3
233+
234+
- uses: docker/setup-buildx-action@v3
235+
236+
- name: Login to DockerHub
237+
uses: docker/login-action@v3
238+
with:
239+
username: ${{ secrets.DOCKERHUB_USERNAME }}
240+
password: ${{ secrets.DOCKERHUB_TOKEN }}
241+
242+
- name: Login to ghcr.io
243+
uses: docker/login-action@v3
244+
with:
245+
registry: ghcr.io
246+
username: ${{ github.actor }}
247+
password: ${{ secrets.GITHUB_TOKEN }}
248+
249+
- name: Extract metadata (tags, labels) for Docker
250+
id: meta
251+
uses: docker/metadata-action@v5
252+
with:
253+
images: |
254+
${{ secrets.DOCKERHUB_USERNAME }}/mockserver
255+
ghcr.io/${{ github.repository }}
256+
tags: |
257+
type=semver,pattern={{version}},value=${{ needs.prepare-release.outputs.version }}
258+
type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare-release.outputs.version }}
259+
type=semver,pattern={{major}},value=${{ needs.prepare-release.outputs.version }}
260+
latest
261+
262+
- uses: docker/build-push-action@v6
263+
id: push
264+
with:
265+
context: ./server
266+
push: true
267+
platforms: linux/amd64,linux/arm64
268+
tags: ${{ steps.meta.outputs.tags }}
269+
labels: ${{ steps.meta.outputs.labels }}
270+
outputs: type=image,compression=zstd,force-compression=true
271+
272+
- name: Generate artifact attestation (ghcr.io)
273+
uses: actions/attest-build-provenance@v3
274+
with:
275+
subject-name: ghcr.io/${{ github.repository }}
276+
subject-digest: ${{ steps.push.outputs.digest }}
277+
push-to-registry: true
160278

161279
publish-pages:
162280
runs-on: ubuntu-latest
163-
needs: [prepare-release]
281+
needs: [publish-maven]
164282
timeout-minutes: 15
165283
steps:
166284
- uses: actions/checkout@v5
@@ -187,19 +305,28 @@ jobs:
187305
${{ runner.os }}-mvn-build-
188306
189307
- name: Build site
190-
run: ../mvnw -B compile site -DskipTests -T2C
191-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
308+
run: ./mvnw -B compile site -DskipTests -T2C
309+
310+
- name: Aggregate site
311+
run: |
312+
modules=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
313+
for m in "${modules[@]}"
314+
do
315+
echo "$m/target/site -> ./target/$m"
316+
mkdir -p ./target/$m
317+
cp -r $m/target/site ./target/$m
318+
done
192319
193320
- name: Deploy to Github pages
194321
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
195322
with:
196323
github_token: ${{ secrets.GITHUB_TOKEN }}
197-
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
324+
publish_dir: ./target/site
198325
force_orphan: true
199326

200327
after-release:
201328
runs-on: ubuntu-latest
202-
needs: [publish-maven]
329+
needs: [publish-maven, publish-docker]
203330
timeout-minutes: 10
204331
steps:
205332
- uses: actions/checkout@v5

0 commit comments

Comments
 (0)