Files

100 lines
3.9 KiB
YAML

name: Smoke Test
on:
workflow_call:
inputs:
project:
required: true
type: string
task:
required: true
type: string
type:
required: true
type: string
checkout_repository:
required: true
type: string
checkout_ref:
required: true
type: string
expected_to_fail:
required: false
type: boolean
default: false
graal_version:
required: false
type: string
default: '17'
java_version:
required: false
type: string
default: '17'
jobs:
smoke_test:
name: ${{ inputs.task }}
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
with:
repository: ${{ inputs.checkout_repository }}
ref: ${{ inputs.checkout_ref }}
- name: Set up GraalVM
uses: graalvm/setup-graalvm@2f25c0caae5b220866f732832d5e3e29ff493338 # v1.2.1
if: ${{ inputs.type == 'native' }}
with:
java-version: ${{ inputs.graal_version }}
distribution: 'liberica'
- name: Set up Java
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: ${{ inputs.java_version }}
distribution: 'liberica'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
with:
cache-read-only: true
- name: Configure Gradle user.name
run: |
mkdir -p ~/.gradle
echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
- name: Build
id: build
env:
COMPOSE_PARALLEL_LIMIT: 1
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
REPO_SPRING_IO_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
REPO_SPRING_IO_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
run: ./gradlew ${{ inputs.type == 'jvm' && '-x collectReachabilityMetadata' || '' }} ${{ inputs.project }}:${{ inputs.task }}
continue-on-error: ${{ inputs.expected_to_fail }}
- name: Check out send notification action
uses: actions/checkout@v4
if: ${{ (failure() && steps.build.conclusion == 'failure') || (steps.build.outcome == 'success' && inputs.expected_to_fail) }}
with:
path: ci
ref: ci
sparse-checkout: .github/actions/send-notification
- name: Determine owner ID secret names
if: ${{ (failure() && steps.build.conclusion == 'failure') || (steps.build.outcome == 'success' && inputs.expected_to_fail) }}
run: |
projectName=$(echo ${{ inputs.project }} | tr '[:lower:]:-' '[:upper:]__')
groupName=$(echo $projectName | awk '{print substr($1, 0, index($1, "_") - 1)}')
echo SECRET_NAME_OWNER_IDS_PROJECT=OWNER_IDS_${projectName} >> $GITHUB_ENV
echo SECRET_NAME_OWNER_IDS_GROUP=OWNER_IDS_${groupName} >> $GITHUB_ENV
- name: Upload hs_err_pid files
if: failure()
uses: actions/upload-artifact@v4
with:
name: hs-err-pid-files
path: '**/build/**/hs_err_pid*.log'
- name: Send notification
uses: ./ci/.github/actions/send-notification
if: ${{ (failure() && steps.build.conclusion == 'failure') || (steps.build.outcome == 'success' && inputs.expected_to_fail) }}
with:
webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}
task: ${{ inputs.project }}:${{ inputs.task }}
owner-ids: ${{ secrets[env.SECRET_NAME_OWNER_IDS_PROJECT] || secrets[env.SECRET_NAME_OWNER_IDS_GROUP]}}
branch: ${{ inputs.checkout_ref }}
failure-url: ${{ steps.build.outputs.build-scan-url || format('{0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id) }}
outcome-description: ${{ inputs.expected_to_fail && 'passed unexpectedly' || 'failed' }}