Skip to content

Fix for Issue #54

Fix for Issue #54 #102

name: MLC core actions test
on:
pull_request:
branches: [ "main", "dev" ]
paths:
- '.github/workflows/test-mlc-core-actions.yml'
- '**'
- '!**.md'
jobs:
test_mlc_core_actions:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.8"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
exclude:
- os: windows-latest
- os: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Configure git longpaths (Windows)
if: matrix.os == 'windows-latest'
run: |
git config --system core.longpaths true
- name: Install mlcflow from the pull request's source repository and branch
run: |
python -m pip install --upgrade pip
python -m pip install --ignore-installed --verbose pip setuptools
python -m pip install .
- name: Test 1 - pull repo - Pull a forked MLOps repository
run: |
GH_MLC_REPO_PATH_FORK="${HOME}/MLC/repos/anandhu-eng@mlperf-automations"
GH_MLC_REPO_JSON_PATH="${HOME}/MLC/repos/repos.json"
mlc pull repo anandhu-eng@mlperf-automations --checkout=dev
if [ ! -d "${GH_MLC_REPO_PATH_FORK}" ]; then
echo "Repository folder $GH_MLC_REPO_PATH_FORK not found. Exiting with failure."
exit 1
fi
if [ ! -f "$GH_MLC_REPO_JSON_PATH" ]; then
echo "File $GH_MLC_REPO_JSON_PATH does not exist. Exiting with failure."
exit 1
fi
if ! grep -q "$GH_MLC_REPO_PATH_FORK" "$GH_MLC_REPO_JSON_PATH"; then
echo "Path $GH_MLC_REPO_PATH_FORK not found in $GH_MLC_REPO_JSON_PATH. Exiting with failure."
exit 1
fi
CURRENT_BRANCH=$(git -C "$GH_MLC_REPO_PATH_FORK" rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "dev" ]; then
echo "Expected branch 'dev', but found '$CURRENT_BRANCH'. Exiting with failure."
exit 1
fi
- name: Test 2 - find repo
run: |
mlc find repo anandhu-eng@mlperf-automations
mlc find repo https://github.com/mlcommons/mlperf-automations.git
mlc find repo 9cf241afa6074c89
mlc find repo mlcommons@mlperf-automations
mlc find repo mlcommons@mlperf-automations,9cf241afa6074c89
- name: Test 3 - pull repo - Test conflicting repo scenario
run: |
GH_MLC_REPO_PATH="${HOME}/MLC/repos/mlcommons@mlperf-automations"
GH_MLC_REPO_JSON_PATH="${HOME}/MLC/repos/repos.json"
mlc pull repo mlcommons@mlperf-automations --checkout=dev
if [ ! -d "$GH_MLC_REPO_PATH" ]; then
echo "Repository folder $GH_MLC_REPO_PATH not found. Exiting with failure."
exit 1
fi
if [ ! -f "$GH_MLC_REPO_JSON_PATH" ]; then
echo "File $GH_MLC_REPO_JSON_PATH does not exist. Exiting with failure."
exit 1
fi
if ! grep -q "$GH_MLC_REPO_PATH" "$GH_MLC_REPO_JSON_PATH"; then
echo "Path $GH_MLC_REPO_PATH not found in $GH_MLC_REPO_JSON_PATH. Exiting with failure."
exit 1
fi
if ! grep -q "$GH_MLC_REPO_PATH_FORK" "$GH_MLC_REPO_JSON_PATH"; then
echo "Path $GH_MLC_REPO_PATH_FORK also found in $GH_MLC_REPO_JSON_PATH. This should have been replaced. Exiting with failure."
exit 1
fi
CURRENT_BRANCH=$(git -C "$GH_MLC_REPO_PATH" rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" != "dev" ]; then
echo "Expected branch 'dev', but found '$CURRENT_BRANCH'. Exiting with failure."
exit 1
fi
mlc pull repo
- name: Test 4 - list repo - List the existing repositories
run: |
mlc list repo
- name: Test 5 - rm repo - Remove the forked mlperf-automation repo
run: |
GH_MLC_REPO_PATH_FORK="${HOME}/MLC/repos/anandhu-eng@mlperf-automations"
mlc rm repo anandhu-eng@mlperf-automations
if [ -d "$GH_MLC_REPO_PATH_FORK" ]; then
echo "Repository folder $GH_MLC_REPO_PATH found. It should ideally be deleted. Exiting with failure."
exit 1
fi
- name: Test 6 - find cache - Cache not present
run: |
mlc find cache --tags=detect,os 2>&1 | tee test5.log
if ! grep -q "No cache entry found for the specified input:" test5.log; then
exit 1
fi
- name: Test 7 - run script - Output being used for testing mlc cache
run: |
mlc run script --tags=get,imagenet-aux --quiet
mlc run script --tags=get,imagenet-aux,_from.dropbox --quiet
- name: Test 8 - find cache - More than one cache present
run: |
mlc search cache --tags=get,imagenet-aux 2>&1 | tee test7.log
if grep -q "No cache entry found for the specified tags:" test7.log; then
exit 1
fi
- name: Test 9 - show cache - More than one cache present
run: |
mlc show cache --tags=get,imagenet-aux 2>&1 | tee test7.log
- name: Test 10 - rm cache - More than one cache present
run: |
mlc rm cache --tags=get,imagenet-aux -f
- name: Test 11 - cp script - Copy mlc script
run: |
mlc cp script detect-os my-os-detect
- name: Test 12 - add repo - Add a new MLC repo
run: |
mlc add repo my-new-repo
mlc add repo https://github.com/mlcommons/inference
mlc add repo https://mygit.com/myrepo
- name: Test 13 - rm repo where we have a corrupt entry
run: |
rm -r $HOME/MLC/repos/mlcommons@mlperf-automations
mlc rm repo mlcommons@mlperf-automations
mlc pull repo mlcommons@mlperf-automations --branch=dev
- name: Test 14 - add script - Add a new MLC script
run: |
mlc add script my-script-1 --tags=my,new-tags-1
mlc add script my-script-2 --tags=my,new-tags-2
mlc add script my-script-3 --tags=my,new-tags3 --template_tags=detect,os
mlc add script mlcommons@mlperf-automations:my-script-4 --tags=my,new-tags4 --template_tags=detect,os
- name: Test 15 - mv script - Move/rename an MLC script
run: |
mlc mv script my-script-1 moved-my-script-1
mlc mv script my-script-2 mlcommons@mlperf-automations:moved-my-script-2
- name: Test 16 - show script
run: |
mlc show script --tags=run-mlperf,inference
mlc show script 863735b7db8c44fc
mlc show script detect-os,863735b7db8c44fc
mlc show script detect-os
- name: Test 17 - find script
run: |
mlc find script --tags=run-mlperf,inference
mlc find script 863735b7db8c44fc
mlc find script detect-os,863735b7db8c44fc
mlc find script detect-os
- name: Test 18 - rm script
run: |
mlc rm script get-ipol-src -f
mlc rm script --tags=app,image,corner-detection -f
mlc rm script 63080407db4d4ac4 -f
- name: Test 19 - list script
run: |
mlc list script
- name: Test 20 - list cache
run: |
mlc list cache