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

Add composite actions to AzureML test workflows #1788

Merged
merged 25 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cc83f29
add comp actiion for get test groups
pradnyeshjoshi Jul 14, 2022
1dc3946
add run on prop
pradnyeshjoshi Jul 14, 2022
e634f52
resolve syntax error
pradnyeshjoshi Jul 14, 2022
2e5f519
resolve syntax error
pradnyeshjoshi Jul 14, 2022
7e2df57
add test kind arg
pradnyeshjoshi Jul 14, 2022
c9ab2ab
add bash shell
pradnyeshjoshi Jul 14, 2022
c399dd5
resolve output err
pradnyeshjoshi Jul 14, 2022
3b55c18
resolve output err
pradnyeshjoshi Jul 14, 2022
877cd0e
resolve output err
pradnyeshjoshi Jul 14, 2022
a2beee3
resolve output err
pradnyeshjoshi Jul 14, 2022
54ed77b
add unit test action
pradnyeshjoshi Jul 14, 2022
825c574
resolve json error
pradnyeshjoshi Jul 14, 2022
fe1031a
resolve json error
pradnyeshjoshi Jul 14, 2022
7c622d0
resolve json error
pradnyeshjoshi Jul 14, 2022
5774ed9
add repo checkout
pradnyeshjoshi Jul 14, 2022
6d2934e
add shell option
pradnyeshjoshi Jul 14, 2022
e8e19c3
fix issue with comp action
pradnyeshjoshi Jul 14, 2022
b5967c0
fix issue with comp action
pradnyeshjoshi Jul 14, 2022
d02acf5
refactor env variables into args for comp actions
pradnyeshjoshi Jul 14, 2022
48caf8b
refactor env variables into args for comp actions
pradnyeshjoshi Jul 14, 2022
e63e700
remove test group typo
pradnyeshjoshi Jul 14, 2022
ddddc4b
trigger nighhtly with composite actions
pradnyeshjoshi Jul 14, 2022
175bf42
trigger nighhtly with composite actions
pradnyeshjoshi Jul 14, 2022
0a33106
add test env arg
pradnyeshjoshi Jul 15, 2022
c2d8d46
cleanup test workflow files
pradnyeshjoshi Jul 15, 2022
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
131 changes: 131 additions & 0 deletions .github/actions/azureml-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ---------------------------------------------------------

name: azureml-tests
description: "Submit experiment to AzureML cluster"
inputs:
# azureml experiment name
EXP_NAME:
required: true
type: string
# type of test - unit or nightly
TEST_KIND:
required: true
type: string
# test environment - cpu, gpu or spark
TEST_ENV:
required: false
type: string
# azureml compute credentials
AZUREML_TEST_CREDENTIALS:
required: true
type: string
# azureml compute subid
AZUREML_TEST_SUBID:
required: true
type: string
# python version
PYTHON_VERSION:
required: true
type: string
# test group name
TEST_GROUP:
required: true
type: string
# cpu cluster name
CPU_CLUSTER_NAME:
required: false
type: string
default: "cpu-cluster"
# gpu cluster name
GPU_CLUSTER_NAME:
required: false
type: string
default: "gpu-cluster"
# AzureML resource group name
RG:
required: false
type: string
default: "recommenders_project_resources"
# AzureML workspace name
WS:
required: false
type: string
default: "azureml-test-workspace"
# test logs path
TEST_LOGS_PATH:
required: false
type: string
default: '"test_logs.log"'
# pytest exit code
PYTEST_EXIT_CODE:
required: false
type: string
default: "pytest_exit_code.log"

runs:
using: "composite"
steps:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install azureml-core and azure-cli on a GitHub hosted server
shell: bash
run: pip install azureml-core azure-cli
- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{inputs.AZUREML_TEST_CREDENTIALS}}
- name: Install wheel package
shell: bash
run: pip install wheel
- name: Create wheel from setup.py
shell: bash
run: python setup.py bdist_wheel
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Submit CPU tests to AzureML
shell: bash
if: contains(inputs.TEST_GROUP, 'cpu')
run: >-
python tests/ci/azureml_tests/submit_groupwise_azureml_pytest.py --clustername ${{inputs.CPU_CLUSTER_NAME}}
--subid ${{inputs.AZUREML_TEST_SUBID}} --reponame "recommenders" --branch ${{ steps.extract_branch.outputs.branch }}
--rg ${{inputs.RG}} --wsname ${{inputs.WS}} --expname ${{inputs.EXP_NAME}}_${{inputs.TEST_GROUP}}
--testlogs ${{inputs.TEST_LOGS_PATH}} --testkind ${{inputs.TEST_KIND}}
--conda_pkg_python ${{inputs.PYTHON_VERSION}} --testgroup ${{inputs.TEST_GROUP}}
- name: Submit GPU tests to AzureML
shell: bash
if: contains(inputs.TEST_GROUP, 'gpu')
run: >-
python tests/ci/azureml_tests/submit_groupwise_azureml_pytest.py --clustername ${{inputs.GPU_CLUSTER_NAME}}
--subid ${{inputs.AZUREML_TEST_SUBID}} --reponame "recommenders" --branch ${{ steps.extract_branch.outputs.branch }}
--rg ${{inputs.RG}} --wsname ${{inputs.WS}} --expname ${{inputs.EXP_NAME}}_${{inputs.TEST_GROUP}}
--testlogs ${{inputs.TEST_LOGS_PATH}} --add_gpu_dependencies --testkind ${{inputs.TEST_KIND}}
--conda_pkg_python ${{inputs.PYTHON_VERSION}} --testgroup ${{inputs.TEST_GROUP}}
- name: Submit PySpark tests to AzureML
shell: bash
if: contains(inputs.TEST_GROUP, 'spark')
run: >-
python tests/ci/azureml_tests/submit_groupwise_azureml_pytest.py --clustername ${{inputs.CPU_CLUSTER_NAME}}
--subid ${{inputs.AZUREML_TEST_SUBID}} --reponame "recommenders" --branch ${{ steps.extract_branch.outputs.branch }}
--rg ${{inputs.RG}} --wsname ${{inputs.WS}} --expname ${{inputs.EXP_NAME}}_${{inputs.TEST_GROUP}}
--testlogs ${{inputs.TEST_LOGS_PATH}} --add_spark_dependencies --testkind ${{inputs.TEST_KIND}}
--conda_pkg_python ${{inputs.PYTHON_VERSION}} --testgroup ${{inputs.TEST_GROUP}}
- name: Print test logs
shell: bash
run: cat ${{inputs.TEST_LOGS_PATH}}
- name: Get exit status
shell: bash
id: exit_status
run: echo ::set-output name=code::$(cat ${{inputs.PYTEST_EXIT_CODE}})
- name: Check Success/Failure
if: ${{ steps.execute_tests.outputs.code != 0 }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('All tests did not pass!')
29 changes: 29 additions & 0 deletions .github/actions/get-test-groups/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: get-test-groups
description: "Get test group names from tests_groups.py"
inputs:
# type of test - unit or nightly
TEST_KIND:
required: true
type: string
# test environment - cpu, gpu or spark
TEST_ENV:
required: false
type: string
default: 'cpu'
outputs:
test_groups:
value: ${{steps.get_test_groups.outputs.test_groups}}

runs:
using: "composite"
steps:
- name: Get test group names
id: get_test_groups
shell: bash
run: |
if [[ ${{ inputs.TEST_KIND }} == "nightly" ]]; then
test_groups_str=$(python -c 'from tests.ci.azureml_tests.test_groups import nightly_test_groups; print([t for t in nightly_test_groups.keys() if "${{inputs.TEST_ENV}}" in t])')
else
test_groups_str=$(python -c 'from tests.ci.azureml_tests.test_groups import unit_test_groups; print(list(unit_test_groups.keys()))')
fi
echo ::set-output name=test_groups::$test_groups_str
45 changes: 38 additions & 7 deletions .github/workflows/azureml-cpu-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,42 @@ on:
workflow_call:

jobs:
get-test-groups:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Get test group names
id: get_test_groups
uses: ./.github/actions/get-test-groups
with:
TEST_KIND: "nightly"
TEST_ENV: "cpu"
- name: Print test group names
run: echo ${{ steps.get_test_groups.outputs.test_groups }}
shell: bash
outputs:
test_groups: ${{ steps.get_test_groups.outputs.test_groups }}

cpu-nightly-tests:
uses: ./.github/workflows/azureml-template.yml
with:
EXP_NAME: 'nightly_tests'
TEST_KIND: 'nightly'
TEST_ENV: 'cpu'
secrets: inherit
execute-tests:
needs: get-test-groups
name: ${{ join(matrix.*, ', ') }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['"python=3.7"', '"python=3.8"', '"python=3.9"']
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Execute tests
uses: ./.github/actions/azureml-test
id: execute_tests
with:
EXP_NAME: 'nightly_tests'
TEST_KIND: 'nightly'
TEST_ENV: 'cpu'
AZUREML_TEST_CREDENTIALS: ${{ secrets.AZUREML_TEST_CREDENTIALS }}
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }}
PYTHON_VERSION: ${{ matrix.python-version }}
TEST_GROUP: ${{ matrix.test-group }}
45 changes: 38 additions & 7 deletions .github/workflows/azureml-gpu-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,42 @@ on:
workflow_call:

jobs:
get-test-groups:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Get test group names
id: get_test_groups
uses: ./.github/actions/get-test-groups
with:
TEST_KIND: "nightly"
TEST_ENV: "gpu"
- name: Print test group names
run: echo ${{ steps.get_test_groups.outputs.test_groups }}
shell: bash
outputs:
test_groups: ${{ steps.get_test_groups.outputs.test_groups }}

gpu-nightly-tests:
uses: ./.github/workflows/azureml-template.yml
with:
EXP_NAME: 'nightly_tests'
TEST_KIND: 'nightly'
TEST_ENV: 'gpu'
secrets: inherit
execute-tests:
needs: get-test-groups
name: ${{ join(matrix.*, ', ') }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['"python=3.7"', '"python=3.8"', '"python=3.9"']
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Execute tests
uses: ./.github/actions/azureml-test
id: execute_tests
with:
EXP_NAME: 'nightly_tests'
TEST_KIND: 'nightly'
TEST_ENV: 'gpu'
AZUREML_TEST_CREDENTIALS: ${{ secrets.AZUREML_TEST_CREDENTIALS }}
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }}
PYTHON_VERSION: ${{ matrix.python-version }}
TEST_GROUP: ${{ matrix.test-group }}
45 changes: 38 additions & 7 deletions .github/workflows/azureml-spark-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,42 @@ on:
workflow_call:

jobs:
get-test-groups:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Get test group names
id: get_test_groups
uses: ./.github/actions/get-test-groups
with:
TEST_KIND: "nightly"
TEST_ENV: "spark"
- name: Print test group names
run: echo ${{ steps.get_test_groups.outputs.test_groups }}
shell: bash
outputs:
test_groups: ${{ steps.get_test_groups.outputs.test_groups }}

spark-nightly-tests:
uses: ./.github/workflows/azureml-template.yml
with:
EXP_NAME: 'nightly_tests'
TEST_KIND: 'nightly'
TEST_ENV: 'spark'
secrets: inherit
execute-tests:
needs: get-test-groups
name: ${{ join(matrix.*, ', ') }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['"python=3.7"', '"python=3.8"', '"python=3.9"']
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Execute tests
uses: ./.github/actions/azureml-test
id: execute_tests
with:
EXP_NAME: 'nightly_tests'
TEST_KIND: 'nightly'
TEST_ENV: 'spark'
AZUREML_TEST_CREDENTIALS: ${{ secrets.AZUREML_TEST_CREDENTIALS }}
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }}
PYTHON_VERSION: ${{ matrix.python-version }}
TEST_GROUP: ${{ matrix.test-group }}
Loading