-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26b5f8b
commit 9ee9b80
Showing
5 changed files
with
94 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: PR Check Tests Run | ||
on: | ||
workflow_call: | ||
inputs: | ||
repository: | ||
description: 'Repository to checkout' | ||
type: string | ||
required: true | ||
ref: | ||
description: 'Branch or tag to checkout' | ||
type: string | ||
required: true | ||
specs_path: | ||
description: 'Path of the artifact to persist to' | ||
type: string | ||
default: '' | ||
|
||
jobs: | ||
upload-specs: | ||
uses: ./.github/workflows/selfserve-checkout-and-upload.yaml | ||
with: | ||
repository: ${{ inputs.repository }} | ||
ref: "${{ github.head_ref || github.ref_name }}" | ||
artifact_key: 'specs' | ||
artifact_path: ${{ inputs.specs_path }} | ||
mock: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: specs | ||
path: specs | ||
- name: Download Latest Specmatic Executable | ||
working-directory: specs | ||
run: | | ||
curl -s https://api.github.com/repos/znsio/specmatic/releases/latest \ | ||
| grep "browser_download_url.*specmatic.jar" \ | ||
| cut -d : -f 2,3 \ | ||
| tr -d \" \ | ||
| xargs curl -L -o specmatic.jar | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.18.2 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'corretto' | ||
- name: Parse Specs | ||
working-directory: specs | ||
run: | | ||
spec=$(find . -maxdepth 1 -type f \( -name "*.yaml" -o -name "*.yml" \) | head -n 1) | ||
if [ ! -f $spec ]; then | ||
echo "Specs not found!" | ||
fi | ||
echo "spec=$spec" >> $GITHUB_ENV | ||
- name: Transform Specs | ||
working-directory: specs | ||
run: npx --yes -p @expediagroup/spec-transformer cli -i ${{ env.spec }} -o ${{ env.spec }} -to | ||
- name: Run Mock Server | ||
working-directory: specs | ||
run: java -jar specmatic.jar stub ${{ env.spec }} --port 8080 & disown | ||
- name: Wait for Mock Server to Start | ||
run: sleep 10 | ||
- name: Verify Server is Running | ||
run: | | ||
status=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/$(uuidgen)) | ||
if [ $status -e 000 ]; then | ||
echo "Server not running!" | ||
exit 1 | ||
fi | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
on: push | ||
jobs: | ||
main: | ||
uses: ./.github/workflows/selfserve-service-mock.yaml | ||
with: | ||
repository: ${{ github.repository }} | ||
ref: "${{ github.head_ref || github.ref_name }}" | ||
specs_path: 'release/rapid/src/specs.yaml' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,4 @@ class Main { | |
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters