Skip to content

Commit b704c42

Browse files
Merge pull request #1792 from microsoft/staging
Staging to main, prepare for release 1.1.1
2 parents 7a50dd0 + 3824e9e commit b704c42

11 files changed

+400
-167
lines changed
+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# ---------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License.
4+
# ---------------------------------------------------------
5+
6+
name: azureml-tests
7+
description: "Submit experiment to AzureML cluster"
8+
inputs:
9+
# azureml experiment name
10+
EXP_NAME:
11+
required: true
12+
type: string
13+
# type of test - unit or nightly
14+
TEST_KIND:
15+
required: true
16+
type: string
17+
# test environment - cpu, gpu or spark
18+
TEST_ENV:
19+
required: false
20+
type: string
21+
# azureml compute credentials
22+
AZUREML_TEST_CREDENTIALS:
23+
required: true
24+
type: string
25+
# azureml compute subid
26+
AZUREML_TEST_SUBID:
27+
required: true
28+
type: string
29+
# python version
30+
PYTHON_VERSION:
31+
required: true
32+
type: string
33+
# test group name
34+
TEST_GROUP:
35+
required: true
36+
type: string
37+
# cpu cluster name
38+
CPU_CLUSTER_NAME:
39+
required: false
40+
type: string
41+
default: "cpu-cluster"
42+
# gpu cluster name
43+
GPU_CLUSTER_NAME:
44+
required: false
45+
type: string
46+
default: "gpu-cluster"
47+
# AzureML resource group name
48+
RG:
49+
required: false
50+
type: string
51+
default: "recommenders_project_resources"
52+
# AzureML workspace name
53+
WS:
54+
required: false
55+
type: string
56+
default: "azureml-test-workspace"
57+
# test logs path
58+
TEST_LOGS_PATH:
59+
required: false
60+
type: string
61+
default: '"test_logs.log"'
62+
# pytest exit code
63+
PYTEST_EXIT_CODE:
64+
required: false
65+
type: string
66+
default: "pytest_exit_code.log"
67+
68+
runs:
69+
using: "composite"
70+
steps:
71+
- name: Setup python
72+
uses: actions/setup-python@v2
73+
with:
74+
python-version: "3.8"
75+
- name: Install azureml-core and azure-cli on a GitHub hosted server
76+
shell: bash
77+
run: pip install azureml-core azure-cli
78+
- name: Log in to Azure
79+
uses: azure/login@v1
80+
with:
81+
creds: ${{inputs.AZUREML_TEST_CREDENTIALS}}
82+
- name: Install wheel package
83+
shell: bash
84+
run: pip install wheel
85+
- name: Create wheel from setup.py
86+
shell: bash
87+
run: python setup.py bdist_wheel
88+
- name: Extract branch name
89+
shell: bash
90+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
91+
id: extract_branch
92+
- name: Submit CPU tests to AzureML
93+
shell: bash
94+
if: contains(inputs.TEST_GROUP, 'cpu')
95+
run: >-
96+
python tests/ci/azureml_tests/submit_groupwise_azureml_pytest.py --clustername ${{inputs.CPU_CLUSTER_NAME}}
97+
--subid ${{inputs.AZUREML_TEST_SUBID}} --reponame "recommenders" --branch ${{ steps.extract_branch.outputs.branch }}
98+
--rg ${{inputs.RG}} --wsname ${{inputs.WS}} --expname ${{inputs.EXP_NAME}}_${{inputs.TEST_GROUP}}
99+
--testlogs ${{inputs.TEST_LOGS_PATH}} --testkind ${{inputs.TEST_KIND}}
100+
--conda_pkg_python ${{inputs.PYTHON_VERSION}} --testgroup ${{inputs.TEST_GROUP}}
101+
- name: Submit GPU tests to AzureML
102+
shell: bash
103+
if: contains(inputs.TEST_GROUP, 'gpu')
104+
run: >-
105+
python tests/ci/azureml_tests/submit_groupwise_azureml_pytest.py --clustername ${{inputs.GPU_CLUSTER_NAME}}
106+
--subid ${{inputs.AZUREML_TEST_SUBID}} --reponame "recommenders" --branch ${{ steps.extract_branch.outputs.branch }}
107+
--rg ${{inputs.RG}} --wsname ${{inputs.WS}} --expname ${{inputs.EXP_NAME}}_${{inputs.TEST_GROUP}}
108+
--testlogs ${{inputs.TEST_LOGS_PATH}} --add_gpu_dependencies --testkind ${{inputs.TEST_KIND}}
109+
--conda_pkg_python ${{inputs.PYTHON_VERSION}} --testgroup ${{inputs.TEST_GROUP}}
110+
- name: Submit PySpark tests to AzureML
111+
shell: bash
112+
if: contains(inputs.TEST_GROUP, 'spark')
113+
run: >-
114+
python tests/ci/azureml_tests/submit_groupwise_azureml_pytest.py --clustername ${{inputs.CPU_CLUSTER_NAME}}
115+
--subid ${{inputs.AZUREML_TEST_SUBID}} --reponame "recommenders" --branch ${{ steps.extract_branch.outputs.branch }}
116+
--rg ${{inputs.RG}} --wsname ${{inputs.WS}} --expname ${{inputs.EXP_NAME}}_${{inputs.TEST_GROUP}}
117+
--testlogs ${{inputs.TEST_LOGS_PATH}} --add_spark_dependencies --testkind ${{inputs.TEST_KIND}}
118+
--conda_pkg_python ${{inputs.PYTHON_VERSION}} --testgroup ${{inputs.TEST_GROUP}}
119+
- name: Print test logs
120+
shell: bash
121+
run: cat ${{inputs.TEST_LOGS_PATH}}
122+
- name: Get exit status
123+
shell: bash
124+
id: exit_status
125+
run: echo ::set-output name=code::$(cat ${{inputs.PYTEST_EXIT_CODE}})
126+
- name: Check Success/Failure
127+
if: ${{ steps.execute_tests.outputs.code != 0 }}
128+
uses: actions/github-script@v3
129+
with:
130+
script: |
131+
core.setFailed('All tests did not pass!')
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: get-test-groups
2+
description: "Get test group names from tests_groups.py"
3+
inputs:
4+
# type of test - unit or nightly
5+
TEST_KIND:
6+
required: true
7+
type: string
8+
# test environment - cpu, gpu or spark
9+
TEST_ENV:
10+
required: false
11+
type: string
12+
default: 'cpu'
13+
outputs:
14+
test_groups:
15+
value: ${{steps.get_test_groups.outputs.test_groups}}
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Get test group names
21+
id: get_test_groups
22+
shell: bash
23+
run: |
24+
if [[ ${{ inputs.TEST_KIND }} == "nightly" ]]; then
25+
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])')
26+
else
27+
test_groups_str=$(python -c 'from tests.ci.azureml_tests.test_groups import unit_test_groups; print(list(unit_test_groups.keys()))')
28+
fi
29+
echo ::set-output name=test_groups::$test_groups_str

.github/dependabot.yml

-12
This file was deleted.

.github/workflows/azureml-cpu-nightly.yml

+58-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@ on:
2222
# to ensure we are running the build on the staging branch, we can add push policy for it
2323
branches: [staging]
2424

25+
# pull_request_target allows execution of workflows in the context
26+
# of a base repository. When a PR is raised from a forked repo, it
27+
# gives the workflow access to AZUREML_TEST_CREDENTIALS, stored as
28+
# a repo level secret, which is needed to trigger execution of unit
29+
# tests on AzureML compute.
30+
pull_request_target:
31+
types:
32+
- opened
33+
- reopened
34+
- synchronize
35+
branches:
36+
- 'main'
37+
paths:
38+
# Unit tests will be run only when there are changes in the
39+
# unit tests related code including:
40+
- examples/**
41+
- recommenders/**
42+
- tests/**
43+
- setup.py
44+
2545
# enable manual trigger
2646
workflow_dispatch:
2747
input:
@@ -33,11 +53,42 @@ on:
3353
workflow_call:
3454

3555
jobs:
56+
get-test-groups:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Check out repository code
60+
uses: actions/checkout@v2
61+
- name: Get test group names
62+
id: get_test_groups
63+
uses: ./.github/actions/get-test-groups
64+
with:
65+
TEST_KIND: "nightly"
66+
TEST_ENV: "cpu"
67+
- name: Print test group names
68+
run: echo ${{ steps.get_test_groups.outputs.test_groups }}
69+
shell: bash
70+
outputs:
71+
test_groups: ${{ steps.get_test_groups.outputs.test_groups }}
3672

37-
cpu-nightly-tests:
38-
uses: ./.github/workflows/azureml-template.yml
39-
with:
40-
EXP_NAME: 'nightly_tests'
41-
TEST_KIND: 'nightly'
42-
TEST_ENV: 'cpu'
43-
secrets: inherit
73+
execute-tests:
74+
needs: get-test-groups
75+
name: ${{ join(matrix.*, ', ') }}
76+
runs-on: ubuntu-latest
77+
strategy:
78+
matrix:
79+
python-version: ['"python=3.7"', '"python=3.8"', '"python=3.9"']
80+
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }}
81+
steps:
82+
- name: Check out repository code
83+
uses: actions/checkout@v2
84+
- name: Execute tests
85+
uses: ./.github/actions/azureml-test
86+
id: execute_tests
87+
with:
88+
EXP_NAME: 'nightly_tests'
89+
TEST_KIND: 'nightly'
90+
TEST_ENV: 'cpu'
91+
AZUREML_TEST_CREDENTIALS: ${{ secrets.AZUREML_TEST_CREDENTIALS }}
92+
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }}
93+
PYTHON_VERSION: ${{ matrix.python-version }}
94+
TEST_GROUP: ${{ matrix.test-group }}

.github/workflows/azureml-gpu-nightly.yml

+58-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@ on:
2222
# to ensure we are running the build on the staging branch, we can add push policy for it
2323
branches: [staging]
2424

25+
# pull_request_target allows execution of workflows in the context
26+
# of a base repository. When a PR is raised from a forked repo, it
27+
# gives the workflow access to AZUREML_TEST_CREDENTIALS, stored as
28+
# a repo level secret, which is needed to trigger execution of unit
29+
# tests on AzureML compute.
30+
pull_request_target:
31+
types:
32+
- opened
33+
- reopened
34+
- synchronize
35+
branches:
36+
- 'main'
37+
paths:
38+
# Unit tests will be run only when there are changes in the
39+
# unit tests related code including:
40+
- examples/**
41+
- recommenders/**
42+
- tests/**
43+
- setup.py
44+
2545
# enable manual trigger
2646
workflow_dispatch:
2747
input:
@@ -33,11 +53,42 @@ on:
3353
workflow_call:
3454

3555
jobs:
56+
get-test-groups:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Check out repository code
60+
uses: actions/checkout@v2
61+
- name: Get test group names
62+
id: get_test_groups
63+
uses: ./.github/actions/get-test-groups
64+
with:
65+
TEST_KIND: "nightly"
66+
TEST_ENV: "gpu"
67+
- name: Print test group names
68+
run: echo ${{ steps.get_test_groups.outputs.test_groups }}
69+
shell: bash
70+
outputs:
71+
test_groups: ${{ steps.get_test_groups.outputs.test_groups }}
3672

37-
gpu-nightly-tests:
38-
uses: ./.github/workflows/azureml-template.yml
39-
with:
40-
EXP_NAME: 'nightly_tests'
41-
TEST_KIND: 'nightly'
42-
TEST_ENV: 'gpu'
43-
secrets: inherit
73+
execute-tests:
74+
needs: get-test-groups
75+
name: ${{ join(matrix.*, ', ') }}
76+
runs-on: ubuntu-latest
77+
strategy:
78+
matrix:
79+
python-version: ['"python=3.7"', '"python=3.8"', '"python=3.9"']
80+
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }}
81+
steps:
82+
- name: Check out repository code
83+
uses: actions/checkout@v2
84+
- name: Execute tests
85+
uses: ./.github/actions/azureml-test
86+
id: execute_tests
87+
with:
88+
EXP_NAME: 'nightly_tests'
89+
TEST_KIND: 'nightly'
90+
TEST_ENV: 'gpu'
91+
AZUREML_TEST_CREDENTIALS: ${{ secrets.AZUREML_TEST_CREDENTIALS }}
92+
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }}
93+
PYTHON_VERSION: ${{ matrix.python-version }}
94+
TEST_GROUP: ${{ matrix.test-group }}

0 commit comments

Comments
 (0)