Use managed identity with OpenID Connect for Azure login #781
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------------- | |
# Copyright (c) Recommenders contributors. | |
# Licensed under the MIT License. | |
# --------------------------------------------------------- | |
name: azureml-unit-tests | |
on: | |
pull_request: | |
branches: | |
- 'staging' | |
- 'main' | |
paths: | |
# Tests will be run only when there are changes in the code: | |
- examples/** | |
- '!examples/**/*.md' | |
- recommenders/** | |
- '!recommenders/**/*.md' | |
- tests/** | |
- '!tests/**/*.md' | |
- setup.py | |
types: [opened, synchronize, reopened, ready_for_review] | |
# Enable manual trigger | |
workflow_dispatch: | |
inputs: | |
tags: | |
description: 'Tags to label this manual run (optional)' | |
default: 'Manual trigger' | |
# Make this workflow reusable | |
workflow_call: | |
jobs: | |
get-test-groups: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Get test group names | |
id: get_test_groups | |
uses: ./.github/actions/get-test-groups | |
with: | |
TEST_KIND: "unit" | |
- 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 }} | |
if: github.event.pull_request.draft == false | |
execute-tests: | |
needs: get-test-groups | |
name: ${{ join(matrix.*, ', ') }} | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
strategy: | |
max-parallel: 50 # Usage limits: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
test-group: ${{ fromJSON(needs.get-test-groups.outputs.test_groups) }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Execute tests | |
uses: ./.github/actions/azureml-test | |
id: execute_tests | |
with: | |
EXP_NAME: recommenders-unit-${{ matrix.test-group }}-python${{ matrix.python-version }}-${{ github.sha }} | |
ENV_NAME: recommenders-${{ github.sha }}-python${{ matrix.python-version }}${{ contains(matrix.test-group, 'gpu') && '-gpu' || '' }}${{ contains(matrix.test-group, 'spark') && '-spark' || '' }} | |
TEST_KIND: 'unit' | |
AZUREML_TEST_UMI_CLIENT_ID: ${{ secrets.AZUREML_TEST_UMI_CLIENT_ID }} | |
AZUREML_TEST_UMI_TENANT_ID: ${{ secrets.AZUREML_TEST_UMI_TENANT_ID }} | |
AZUREML_TEST_UMI_SUB_ID: ${{ secrets.AZUREML_TEST_UMI_SUB_ID }} | |
AZUREML_TEST_SUBID: ${{ secrets.AZUREML_TEST_SUBID }} | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
TEST_GROUP: ${{ matrix.test-group }} | |
if: github.event.pull_request.draft == false |