Skip to content

Commit

Permalink
Use reusable workflow for running ct tests with the hms sim
Browse files Browse the repository at this point in the history
  • Loading branch information
rsjostrand-hpe committed Nov 1, 2022
1 parent 256c90e commit 5e427ad
Showing 1 changed file with 3 additions and 97 deletions.
100 changes: 3 additions & 97 deletions .github/workflows/run_ct_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,100 +2,6 @@ name: Run CT Tests
on: [push, pull_request, workflow_dispatch]
jobs:
run_ct_test:
name: Run CT Tests
runs-on: ubuntu-latest
env:
IMAGES_UNDER_TEST: |
[
{
"ImageName": "cray-bss",
"DockerComposeServices": [
"cray-bss"
]
}
]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Checkout hms-simulation-environment
uses: actions/checkout@v2
with:
# TODO check out a "stable" or "v1" tag, or somehow have it match the pointed branch that this workflow was referenced from
fetch-depth: 0
path: hms-simulation-environment
repository: Cray-HPE/hms-simulation-environment

- name: Build images under test
shell: bash
run: |
make image
- name: Update docker-compose file with images under test
shell: python
run: |
import os
import sys
import json
import subprocess
# Read in version from .version
version = None
with open('.version') as f:
version = f.readline().strip()
print('Version: ', version)
# Read in IMAGES_UNDER_TEST from the environment
images_under_test = json.loads(os.environ['IMAGES_UNDER_TEST'])
# Update docker-compose file for each service
for image_under_test in images_under_test:
for service in image_under_test["DockerComposeServices"]:
cmd = ['yq', '-i', 'e', f'.services.{service}.image = "{image_under_test["ImageName"]}:{version}"', './hms-simulation-environment/docker-compose.yaml']
print(f'Running command: {cmd}')
result = subprocess.run(cmd)
if result.returncode != 0:
sys.exit(1)
- name: Standup simulation environment
shell: bash
run: |
set -ex
cd hms-simulation-environment
# For debugging output the modified docker-compose compose file
echo "Updated docker-compose.yaml"
cat docker-compose.yaml
# Setup python virtual environment
./setup_venv.sh
. ./venv/bin/activate
./run.py configs/sls/small_mountain.json
- name: Run smoke tests
run: |
if [[ -f "runSmokeTestsWithSimulator.sh" ]]; then
./runSmokeTestsWithSimulator.sh
else
echo "Skipping"
fi
- name: Load simulation for tavern tests
run: |
if [[ -f "runTavernTestsLoadSimulator.sh" ]]; then
./runTavernTestsLoadSimulator.sh
else
echo "Skipping"
fi
- name: Run tavern tests
run: |
if [[ -f "runTavernTestsWithSimulator.sh" ]]; then
./runTavernTestsWithSimulator.sh
else
echo "Skipping"
fi
uses: Cray-HPE/hms-build-image-workflows/.github/workflows/run_ct_test_with_hms_sim.yaml@CASMHMS-5796
with:
runs-on: ubuntu-latest

0 comments on commit 5e427ad

Please sign in to comment.