Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added github action for individual CM tests #443

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
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
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)
Loading