Skip to content

Commit 86b440a

Browse files
committed
Merge branch 'develop' into update-from-template-merged
2 parents 7e5d51b + 3ad2168 commit 86b440a

File tree

384 files changed

+47587
-162
lines changed

Some content is hidden

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

384 files changed

+47587
-162
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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ on:
1919
- '.idea/**'
2020
- 'assets/**'
2121

22-
env:
23-
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
24-
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo
25-
2622
jobs:
2723
build:
2824
runs-on: ubuntu-latest
@@ -44,7 +40,7 @@ jobs:
4440
cache: 'maven'
4541

4642
- name: Build with Maven
47-
run: ./mvnw -B clean package
43+
run: ./mvnw -B clean package -P run-integration-tests
4844

4945
- name: Check for uncommited changes
5046
run: |
@@ -64,13 +60,27 @@ jobs:
6460
exit 1
6561
fi
6662
67-
- name: Upload demo files
63+
- name: Upload standalone server JAR
6864
uses: actions/upload-artifact@v4
6965
with:
70-
name: demo-files-java-${{ matrix.java }}
71-
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
66+
name: server-${{ matrix.java }}
67+
path: server/target/server-standalone.jar
7268
if-no-files-found: error
7369

70+
# Build docker
71+
- uses: docker/setup-qemu-action@v3
72+
73+
- uses: docker/setup-buildx-action@v3
74+
75+
- uses: docker/build-push-action@v6
76+
with:
77+
context: ./server
78+
push: false
79+
tags: mockserver-standalone:experimental
80+
platforms: linux/amd64,linux/arm64
81+
cache-from: type=gha
82+
cache-to: type=gha,mode=max
83+
7484
checkstyle:
7585
runs-on: ubuntu-latest
7686
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
@@ -118,7 +128,8 @@ jobs:
118128
run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C
119129

120130
- name: Run CPD (Copy Paste Detector)
121-
run: ./mvnw -B pmd:aggregate-cpd pmd:cpd-check -P pmd -DskipTests -T2C
131+
# Todo: Readd pmd:cpd-check - Disabled for now due to upstream code
132+
run: ./mvnw -B pmd:aggregate-cpd -P pmd -DskipTests -T2C
122133

123134
- name: Upload report
124135
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@v4
21+
22+
- name: Scan - Full
23+
uses: aquasecurity/trivy-action@0.30.0
24+
with:
25+
image-ref: ${{ env.TRIVYY_IMAGE_REF }}
26+
27+
- name: Scan - Relevant
28+
id: scan_relevant
29+
uses: aquasecurity/trivy-action@0.30.0
30+
with:
31+
image-ref: ${{ env.TRIVYY_IMAGE_REF }}
32+
exit-code: 1
33+
severity: 'HIGH,CRITICAL'
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@v5
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: 128 additions & 16 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
@@ -51,7 +48,8 @@ jobs:
5148
needs: [check-code]
5249
timeout-minutes: 10
5350
outputs:
54-
upload_url: ${{ steps.create_release.outputs.upload_url }}
51+
upload_url: ${{ steps.create-release.outputs.upload_url }}
52+
version: ${{ steps.version.outputs.release }}
5553
steps:
5654
- uses: actions/checkout@v4
5755

@@ -74,10 +72,9 @@ jobs:
7472
- name: Get version
7573
id: version
7674
run: |
77-
version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
75+
version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
7876
echo "release=$version" >> $GITHUB_OUTPUT
7977
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
80-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
8178
8279
- name: Commit and Push
8380
run: |
@@ -88,7 +85,7 @@ jobs:
8885
git push origin --tags
8986
9087
- name: Create Release
91-
id: create_release
88+
id: create-release
9289
uses: shogo82148/actions-create-release@e5f206451d4ace2da9916d01f1aef279997f8659 # v1
9390
with:
9491
tag_name: v${{ steps.version.outputs.release }}
@@ -99,15 +96,39 @@ jobs:
9996
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
10097
10198
## Installation
99+
100+
### Client
101+
Add the following lines to your pom:
102+
```XML
103+
<dependency>
104+
<groupId>software.xdev.mockserver</groupId>
105+
<artifactId>client</artifactId>
106+
<version>${{ steps.version.outputs.release }}</version>
107+
</dependency>
108+
```
109+
110+
### Testcontainers Integration
102111
Add the following lines to your pom:
103112
```XML
104113
<dependency>
105-
<groupId>software.xdev</groupId>
106-
<artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
114+
<groupId>software.xdev.mockserver</groupId>
115+
<artifactId>testcontainers</artifactId>
107116
<version>${{ steps.version.outputs.release }}</version>
108117
</dependency>
109118
```
110119
120+
### Standalone/Server
121+
122+
#### Docker
123+
Download the image from
124+
* [DockerHub](https://hub.docker.com/r/xdevsoftware/mockserver/tags?name=${{ steps.version.outputs.release }})
125+
* [GitHub Packages (ghcr.io)](https://github.com/xdev-software/mockserver-neolight/pkgs/container/mockserver-neolight)
126+
127+
#### JAR
128+
If you don't like to use the docker image, the executable jar is also available
129+
* at [Maven Central](https://repo1.maven.org/maven2/software/xdev/mockserver/server/${{ steps.version.outputs.release }}/server-${{ steps.version.outputs.release }}-standalone.jar)
130+
* or in the release assets below
131+
111132
publish-maven:
112133
runs-on: ubuntu-latest
113134
needs: [prepare-release]
@@ -133,16 +154,99 @@ jobs:
133154
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
134155

135156
- name: Publish to OSSRH
136-
run: ../mvnw -B deploy -Possrh -DskipTests
157+
run: ./mvnw -B deploy -pl "client,server,testcontainers" -am -Possrh -DskipTests
137158
env:
138159
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
139160
MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}
140161
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
141-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
162+
163+
- name: Upload server standalone JAR
164+
uses: actions/upload-artifact@v4
165+
with:
166+
name: server-standalone
167+
path: server/target/server-standalone.jar
168+
if-no-files-found: error
169+
170+
- name: Upload Release assets
171+
uses: shogo82148/actions-upload-release-asset@v1
172+
with:
173+
upload_url: ${{ needs.prepare-release.outputs.upload_url }}
174+
asset_path: server/target/server-standalone.jar
175+
176+
publish-docker:
177+
runs-on: ubuntu-latest
178+
needs: [prepare-release, publish-maven]
179+
timeout-minutes: 15
180+
permissions:
181+
packages: write
182+
contents: read
183+
attestations: write
184+
id-token: write
185+
steps:
186+
- uses: actions/checkout@v4
187+
188+
- name: Init Git and pull
189+
run: |
190+
git config --global user.email "actions@github.com"
191+
git config --global user.name "GitHub Actions"
192+
git pull
193+
194+
- name: Download server JAR
195+
uses: actions/download-artifact@v4
196+
with:
197+
name: server-standalone
198+
path: server/target
199+
200+
- uses: docker/setup-qemu-action@v3
201+
202+
- uses: docker/setup-buildx-action@v3
203+
204+
- name: Login to DockerHub
205+
uses: docker/login-action@v3
206+
with:
207+
username: ${{ secrets.DOCKERHUB_USERNAME }}
208+
password: ${{ secrets.DOCKERHUB_TOKEN }}
209+
210+
- name: Login to ghcr.io
211+
uses: docker/login-action@v3
212+
with:
213+
registry: ghcr.io
214+
username: ${{ github.actor }}
215+
password: ${{ secrets.GITHUB_TOKEN }}
216+
217+
- name: Extract metadata (tags, labels) for Docker
218+
id: meta
219+
uses: docker/metadata-action@v5
220+
with:
221+
images: |
222+
${{ secrets.DOCKERHUB_USERNAME }}/mockserver
223+
ghcr.io/${{ github.repository }}
224+
tags: |
225+
type=semver,pattern={{version}},value=${{ needs.prepare-release.outputs.version }}
226+
type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare-release.outputs.version }}
227+
type=semver,pattern={{major}},value=${{ needs.prepare-release.outputs.version }}
228+
latest
229+
230+
- uses: docker/build-push-action@v6
231+
id: push
232+
with:
233+
context: ./server
234+
push: true
235+
platforms: linux/amd64,linux/arm64
236+
tags: ${{ steps.meta.outputs.tags }}
237+
labels: ${{ steps.meta.outputs.labels }}
238+
outputs: type=image,compression=zstd,force-compression=true
239+
240+
- name: Generate artifact attestation (ghcr.io)
241+
uses: actions/attest-build-provenance@v2
242+
with:
243+
subject-name: ghcr.io/${{ github.repository }}
244+
subject-digest: ${{ steps.push.outputs.digest }}
245+
push-to-registry: true
142246

143247
publish-pages:
144248
runs-on: ubuntu-latest
145-
needs: [prepare-release]
249+
needs: [publish-maven]
146250
timeout-minutes: 15
147251
steps:
148252
- uses: actions/checkout@v4
@@ -161,19 +265,27 @@ jobs:
161265
cache: 'maven'
162266

163267
- name: Build site
164-
run: ../mvnw -B compile site -DskipTests -T2C
165-
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
268+
run: ./mvnw -B compile site -DskipTests -T2C
269+
270+
- name: Aggregate site
271+
run: |
272+
modules=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
273+
for m in "${modules[@]}"
274+
do
275+
echo "$m/target/site -> ./target/site/$m"
276+
cp -r $m/target/site ./target/site/$m
277+
done
166278
167279
- name: Deploy to Github pages
168280
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
169281
with:
170282
github_token: ${{ secrets.GITHUB_TOKEN }}
171-
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
283+
publish_dir: ./target/site
172284
force_orphan: true
173285

174286
after-release:
175287
runs-on: ubuntu-latest
176-
needs: [publish-maven]
288+
needs: [publish-maven, publish-docker]
177289
timeout-minutes: 10
178290
steps:
179291
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)