Skip to content

Test SimBank

Test SimBank #238

Workflow file for this run

#
# Copyright contributors to the Galasa project
#
# SPDX-License-Identifier: EPL-2.0
#
name: Test SimBank
on:
# This workflow_dispatch is used in the release process.
workflow_dispatch:
# This workflow_call is used after the Main Build of Simplatform.
workflow_call:
schedule:
- cron: "0 6 * * *" # Daily at 06:00
env:
NAMESPACE: ${{ github.repository_owner }}
jobs:
get-galasa-version:
name: Get Galasa Version
# Use the build.properties file in the galasa repo to source the galasa-version output variable.
# This variable can be referenced by other jobs in this flow using ${{ needs.get-galasa-version.outputs.galasa-version }}
runs-on: macos-latest
steps:
- name: Checkout 'galasa' repository
uses: actions/checkout@v4
with:
repository: ${{ env.NAMESPACE }}/galasa
path: ${{ github.workspace }}/galasa
sparse-checkout: |
build.properties
- name: Get Galasa Version from build.properties file
id: get-galasa-version
run: |
cat ${{ github.workspace }}/galasa/build.properties | grep "=" >> $GITHUB_OUTPUT
outputs:
galasa-version: ${{ steps.get-galasa-version.outputs.GALASA_VERSION }}
build-and-run-simbank-tests:
name: Build and Run SimBank Tests
runs-on: macos-latest
needs: [get-galasa-version]
env:
GALASA_HOME: ${{ github.workspace }}/.galasa
steps:
#----------------------------------------------------------------------------------
- name: Checkout the Simplatform repository
uses: actions/checkout@v4
with:
repository: ${{ env.NAMESPACE }}/simplatform
#----------------------------------------------------------------------------------
# Set up pre-requesite technology (Java, Gradle and galasactl)
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'semeru'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 9.0.0
cache-disabled: true
- name: Install galasactl with Homebrew
run: |
brew tap galasa-dev/tap
brew install --no-quarantine galasactl
#----------------------------------------------------------------------------------
# Set up Galasa environment
- name: Initialise local Galasa environment to create remaining files and folders
run: |
galasactl local init --log -
#----------------------------------------------------------------------------------
# Download or build the Simplatform application that the tests connect to
# If this workflow was called after a Main build, it will share the github.event_name
# with the calling workflow, which is 'push'. Download the artifacts from that build.
- name: Ensure local Maven repo exists
env:
HOME: /Users/runner
run: mkdir -p ${{ env.HOME }}/.m2/repository
- name: Download SimBank from Main Build
if: ${{ github.event_name == 'push' }}
uses: actions/download-artifact@v4
env:
HOME: /Users/runner
with:
name: simplatform
path: ${{ env.HOME }}/.m2/repository
# If this workflow was called by the daily regression test run or the release, build the code.
- name: Build SimBank using local build script
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
./build-locally.sh --skip-docker --skip-secrets
#----------------------------------------------------------------------------------
# Run the Simplatform application
- name: Start the Simplatform application
env:
GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }}
run: |
echo "Starting SimBank application..."
java -jar /Users/runner/.m2/repository/dev/galasa/galasa-simplatform/${GALASA_VERSION}/galasa-simplatform-${GALASA_VERSION}.jar &
#----------------------------------------------------------------------------------
# Run the Simbank tests
- name: Run the SimBankIVT
env:
GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }}
run: |
galasactl runs submit local \
--obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.SimBankIVT \
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
--reportjson ${{ github.workspace }}/.galasa/test-1.json \
--log -
- name: Run the BasicAccountCreditTest
env:
GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }}
run: |
galasactl runs submit local \
--obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.BasicAccountCreditTest \
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
--reportjson ${{ github.workspace }}/.galasa/test-2.json \
--log -
- name: Run the ProvisionedAccountCreditTests
env:
GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }}
run: |
galasactl runs submit local \
--obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \
--obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \
--class dev.galasa.simbank.tests/dev.galasa.simbank.tests.ProvisionedAccountCreditTests \
--remoteMaven https://development.galasa.dev/main/maven-repo/obr \
--reportjson ${{ github.workspace }}/.galasa/test-3.json \
--log -
#----------------------------------------------------------------------------------
# Combine test reports and report to Slack channel
# Skip these steps for forks. Only report results if this workflow was
# called from a regression run as Main builds run multiple times a day.
- name: Combine test reports
if: ${{ github.repository_owner == 'galasa-dev' && github.event_name == 'schedule' }}
run: |
jq -s '{ tests: map(.tests[]) }' ${{ github.workspace }}/.galasa/test-1.json ${{ github.workspace }}/.galasa/test-2.json ${{ github.workspace }}/.galasa/test-3.json > ${{ github.workspace }}/.galasa/tests.json
# The test report must be sent to Slack in the next job that uses the ubuntu-latest runner.
# We need to run a Docker image to communicate with the Slack webhook and the macos-latest
# runner does not have `docker` installed. Upload the report and download in the next job.
- name: Upload combined test report
if: ${{ github.repository_owner == 'galasa-dev' && github.event_name == 'schedule' }}
uses: actions/upload-artifact@v4
with:
name: tests.json
path: ${{ github.workspace }}/.galasa/tests.json
report-simbank-test-results:
name: Report Simbank Test results into Slack
runs-on: ubuntu-latest
# Skip this job for forks. Only report results if this workflow was
# called from a regression run as Main builds run multiple times a day.
if: ${{ github.repository_owner == 'galasa-dev' && github.event_name == 'schedule' }}
needs: [build-and-run-simbank-tests]
steps:
- name: Download Test Report
uses: actions/download-artifact@v4
with:
name: tests.json
path: ${{ github.workspace }}/.galasa
- name: Report results into Slack channel
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
run: |
docker run --rm \
--env SLACK_WEBHOOK=${{ env.SLACK_WEBHOOK }} \
-v ${{ github.workspace }}/.galasa:/galasa \
ghcr.io/${{ env.NAMESPACE }}/galasabld-ibm:main \
slackpost tests \
--path /galasa/tests.json \
--name "Simbank" \
--desc "Tests running locally on GitHub Actions" \
--hook ${{ env.SLACK_WEBHOOK }}