Skip to content

Commit

Permalink
Merge branch 'develop' into update-from-template-merged
Browse files Browse the repository at this point in the history
  • Loading branch information
xdev-gh-bot committed Sep 9, 2024
2 parents 75f839e + afebc2d commit 5e664dc
Show file tree
Hide file tree
Showing 383 changed files with 47,451 additions and 162 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ body:
attributes:
label: "Checklist"
options:
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/mockserver-neolight/releases/latest)"
required: true
- 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."
- 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."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/enhancement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- 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."
- 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."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
attributes:
label: "Checklist"
options:
- 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."
- 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."
required: true
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
required: true
Expand Down
29 changes: 20 additions & 9 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ on:
- '.idea/**'
- 'assets/**'

env:
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -43,7 +39,7 @@ jobs:
cache: 'maven'

- name: Build with Maven
run: ./mvnw -B clean package
run: ./mvnw -B clean package -P run-integration-tests

- name: Check for uncommited changes
run: |
Expand All @@ -63,13 +59,27 @@ jobs:
exit 1
fi
- name: Upload demo files
- name: Upload standalone server JAR
uses: actions/upload-artifact@v4
with:
name: demo-files-java-${{ matrix.java }}
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
name: server-${{ matrix.java }}
path: server/target/server-standalone.jar
if-no-files-found: error

# Build docker
- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- uses: docker/build-push-action@v6
with:
context: ./server
push: false
tags: mockserver-standalone:experimental
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

checkstyle:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
Expand Down Expand Up @@ -115,7 +125,8 @@ jobs:
run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C

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

- name: Upload report
if: always()
Expand Down
142 changes: 126 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches: [ master ]

env:
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}

permissions:
contents: write
pull-requests: write
Expand Down Expand Up @@ -49,7 +46,8 @@ jobs:
runs-on: ubuntu-latest
needs: [check-code]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_url: ${{ steps.create-release.outputs.upload_url }}
version: ${{ steps.version.outputs.release }}
steps:
- uses: actions/checkout@v4

Expand All @@ -72,10 +70,9 @@ jobs:
- name: Get version
id: version
run: |
version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
version=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "release=$version" >> $GITHUB_OUTPUT
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
- name: Commit and Push
run: |
Expand All @@ -86,7 +83,7 @@ jobs:
git push origin --tags
- name: Create Release
id: create_release
id: create-release
uses: shogo82148/actions-create-release@v1
with:
tag_name: v${{ steps.version.outputs.release }}
Expand All @@ -97,15 +94,39 @@ jobs:
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
## Installation
### Client
Add the following lines to your pom:
```XML
<dependency>
<groupId>software.xdev.mockserver</groupId>
<artifactId>client</artifactId>
<version>${{ steps.version.outputs.release }}</version>
</dependency>
```
### Testcontainers Integration
Add the following lines to your pom:
```XML
<dependency>
<groupId>software.xdev</groupId>
<artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
<groupId>software.xdev.mockserver</groupId>
<artifactId>testcontainers</artifactId>
<version>${{ steps.version.outputs.release }}</version>
</dependency>
```
### Standalone/Server
#### Docker
Download the image from
* [DockerHub](https://hub.docker.com/r/xdevsoftware/mockserver/tags?name=${{ steps.version.outputs.release }})
* [GitHub Packages (ghcr.io)](https://github.com/xdev-software/mockserver-neolight/pkgs/container/mockserver-neolight)
#### JAR
If you don't like to use the docker image, the executable jar is also available
* at [Maven Central](https://repo1.maven.org/maven2/software/xdev/mockserver/server/${{ steps.version.outputs.release }}/server-${{ steps.version.outputs.release }}-standalone.jar)
* or in the release assets below
publish-maven:
runs-on: ubuntu-latest
needs: [prepare-release]
Expand All @@ -130,16 +151,97 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}

- name: Publish to Apache Maven Central
run: ../mvnw -B deploy -Possrh -DskipTests
run: ./mvnw -B deploy -pl "client,server,testcontainers" -am -Possrh -DskipTests
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}

- name: Upload server standalone JAR
uses: actions/upload-artifact@v4
with:
name: server-standalone
path: server/target/server-standalone.jar
if-no-files-found: error

- name: Upload Release assets
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.prepare-release.outputs.upload_url }}
asset_path: server/target/server-standalone.jar

publish-docker:
runs-on: ubuntu-latest
needs: [prepare-release, publish-maven]
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4

- name: Init Git and pull
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git pull
- name: Download server JAR
uses: actions/download-artifact@v4
with:
name: server-standalone
path: server/target

- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/mockserver
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}},value=${{ needs.prepare-release.outputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare-release.outputs.version }}
type=semver,pattern={{major}},value=${{ needs.prepare-release.outputs.version }}
latest
- uses: docker/build-push-action@v6
id: push
with:
context: ./server
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation (ghcr.io)
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

publish-pages:
runs-on: ubuntu-latest
needs: [prepare-release]
needs: [publish-maven]
steps:
- uses: actions/checkout@v4

Expand All @@ -157,18 +259,26 @@ jobs:
cache: 'maven'

- name: Build site
run: ../mvnw -B compile site -DskipTests -T2C
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
run: ./mvnw -B compile site -DskipTests -T2C

- name: Aggregate site
run: |
modules=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0'))
for m in "${modules[@]}"
do
echo "$m/target/site -> ./target/site/$m"
cp -r $m/target/site ./target/site/$m
done
- name: Deploy to Github pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
publish_dir: ./target/site

after-release:
runs-on: ubuntu-latest
needs: [publish-maven]
needs: [publish-maven, publish-docker]
steps:
- uses: actions/checkout@v4

Expand Down
73 changes: 68 additions & 5 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: Test Deployment
on:
workflow_dispatch:

env:
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}

jobs:
publish-maven:
runs-on: ubuntu-latest
Expand All @@ -24,9 +21,75 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}

- name: Publish to OSSRH
run: ../mvnw -B deploy -Possrh -DskipTests
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
run: ./mvnw -B deploy -pl "client,server,testcontainers" -am -Possrh -DskipTests
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Upload server standalone JAR
uses: actions/upload-artifact@v4
with:
name: server-standalone
path: server/target/server-standalone.jar
if-no-files-found: error

publish-docker:
runs-on: ubuntu-latest
needs: publish-maven
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4

- name: Download server JAR
uses: actions/download-artifact@v4
with:
name: server-standalone
path: server/target

- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/mockserver
ghcr.io/${{ github.repository }}
tags: |
experimental
- uses: docker/build-push-action@v6
id: push
with:
context: ./server
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation (ghcr.io)
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
Loading

0 comments on commit 5e664dc

Please sign in to comment.