Skip to content

Commit

Permalink
Merge pull request #443 from GATEOverflow/mlperf-inference
Browse files Browse the repository at this point in the history
Added github action for individual CM tests
  • Loading branch information
arjunsuresh authored Oct 30, 2024
2 parents 47f1dcb + 319876c commit 6bd76e8
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/run-individual-script-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will add/update the README.md files for any updated CM scripts
name: Readme update for CM scripts

on:
pull_request:
branches: [ "main", "mlperf-inference", "dev" ]
paths:
- 'script/**_cm.json'
- 'script/**_cm.yml'

jobs:
run-script-tests:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get changed files
id: getfile
run: |
echo "files=$(git diff --name-only ${{ github.event.before }} | xargs)" >> $GITHUB_OUTPUT
- name: RUN Script Tests
run: |
echo ${{ steps.getfile.outputs.files }}
for file in ${{ steps.getfile.outputs.files }}; do
echo $file
done
python3 -m pip install cmind
cm pull repo --url=https://github.com/${{ github.repository }} --checkout=${{ github.ref_name }}
python3 tests/script/process_tests.py ${{ steps.getfile.outputs.files }}
24 changes: 24 additions & 0 deletions tests/script/process_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import sys
import os
import cmind as cm
import check as checks
import json
import yaml

files=sys.argv[1:]

for file in files:
if not os.path.isfile(file):
continue
if not file.endswith("_cm.json") and not file.endswith("_cm.yaml"):
continue
script_path = os.path.dirname(file)
f = open(file)
if file.endswith(".json"):
data = json.load(f)
elif file.endswith(".yaml"):
data = yaml.safe_load(f)
uid = data['uid']

r = cm.access({'action':'test', 'automation':'script', 'artifact': uid, 'quiet': 'yes'})
checks.check_return(r)

0 comments on commit 6bd76e8

Please sign in to comment.