Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions .github/workflows/gradle.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
name: Run tests

run-name: ${{ inputs.orchestrator_run_suffix && format('Run tests - {0}', inputs.orchestrator_run_suffix) || github.workflow }}

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
enteprise_version:
description: Specmatic enterprise version under test
required: false
type: string
enterprise_artifact_url:
description: Specmatic enterprise jar/artifact URL under test
required: false
type: string
orchestrator_run_suffix:
description: Test Orchestrator run suffix
required: false
type: string

jobs:
test:
Expand All @@ -14,9 +30,17 @@ jobs:
runs-on: ${{ matrix.os }}
env:
CTRF_REPORT_PATH: './build/reports/specmatic/graphQL/stub/ctrf/*.json'
ENTERPRISE_VERSION: ${{ inputs.enterprise_version }}
ENTERPRISE_ARTIFACT_URL: ${{ inputs.enterprise_artifact_url }}
steps:
- uses: actions/checkout@v6

- name: Add orchestrator context to summary
if: ${{ inputs.orchestrator_run_suffix != '' }}
run: |
echo "### Orchestrator" >> "$GITHUB_STEP_SUMMARY"
echo "Run: ${{ inputs.orchestrator_run_suffix }}" >> "$GITHUB_STEP_SUMMARY"

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
Expand All @@ -31,9 +55,40 @@ jobs:
run: |
mkdir -p ~/.specmatic
echo "${{ secrets.SPECMATIC_LICENSE_KEY }}" > ~/.specmatic/specmatic-license.txt

- name: Prepare Specmatic Enterprise artifact
if: ${{ inputs.enterprise_artifact_url != '' && inputs.enterprise_version != '' }}
shell: bash
run: |
set -euo pipefail

mkdir -p ~/.specmatic

echo "Downloading Enterprise artifact from:"
echo "${ENTERPRISE_ARTIFACT_URL}"
echo "Retry configuration: 5 retries with 15 second delay"

curl -L --fail --retry 5 --retry-delay 15 \
"${ENTERPRISE_ARTIFACT_URL}" \
-o ~/.specmatic/specmatic-enterprise.jar

echo "Enterprise artifact downloaded successfully"

mvn install:install-file \
-Dfile="$HOME/.specmatic/specmatic-enterprise.jar" \
-DgroupId=io.specmatic.enterprise \
-DartifactId=executable \
-Dversion="${ENTERPRISE_VERSION}" \
-Dpackaging=jar \
-DgeneratePom=true

echo "Installed Enterprise artifact into local Maven"

- name: Build BFF project with Gradle
run: ./gradlew build
run: |
./gradlew build \
${ENTERPRISE_VERSION:+-PspecmaticEnterpriseVersion=${ENTERPRISE_VERSION}} \
${ENTERPRISE_VERSION:+-PenterpriseVersion=${ENTERPRISE_VERSION}}

- name: Upload CTRF Report
uses: actions/upload-artifact@v6
Expand All @@ -51,7 +106,7 @@ jobs:
report-path: ${{ env.CTRF_REPORT_PATH }}

- name: Publish Build Reports to Specmatic Insights
if: github.ref == 'refs/heads/main'
if: ${{ github.ref == 'refs/heads/main' && inputs.orchestrator_run_suffix == '' }}
run: |
docker run \
-v ${{ github.workspace }}:/workspace \
Expand Down
Loading