mirror of
https://github.com/Hestia-Homes/ML.git
synced 2026-06-08 11:17:25 +00:00
117 lines
3.5 KiB
YAML
117 lines
3.5 KiB
YAML
name: Build and test model using a dummy prediction pipeline
|
|
|
|
on:
|
|
# push:
|
|
# branches:
|
|
# - "model-**"
|
|
pull_request:
|
|
branches: ["sap-dev", "heat-dev", "carbon-dev"]
|
|
label:
|
|
types: ["created", "edited"]
|
|
|
|
permissions: write-all
|
|
|
|
jobs:
|
|
|
|
Check-Label:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: yogevbd/enforce-label-action@2.1.0
|
|
with:
|
|
REQUIRED_LABELS_ANY: "major,minor,patch"
|
|
REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['major','minor','patch']"
|
|
BANNED_LABELS: "banned"
|
|
|
|
# No-Label:
|
|
# if: ${{ github.event.label.name != 'major' }} || ${{ github.event.label.name != 'minor' }} || ${{ github.event.label.name != 'patch' }}
|
|
# runs-on: ubuntu-latest
|
|
|
|
# steps:
|
|
# - name: No label associated with PR
|
|
# run: |
|
|
# echo "Please choose one of these tags: 'major', 'major', 'patch'"
|
|
# exit(1)
|
|
|
|
Verify-Model:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install packages to retrieve artifacts
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
|
run: |
|
|
pip install --upgrade pip
|
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
|
|
|
- name: Retrieve artifacts (dvc.lock)
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
|
run: |
|
|
cd modules/ml-pipeline/src/pipeline
|
|
dvc pull -r experiments
|
|
|
|
- name: Build Prediction docker Image
|
|
run: |
|
|
cd modules/ml-pipeline/src/
|
|
docker build . --file Prediction.Dockerfile --tag prediction_test
|
|
|
|
- name: Run Prediction docker container
|
|
run: |
|
|
docker run prediction_test
|
|
|
|
Trigger-CML:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install packages to retrieve artifacts
|
|
run: |
|
|
pip install --upgrade pip
|
|
pip install -r modules/ml-pipeline/src/pipeline/requirements/version_control/requirements.txt
|
|
|
|
- name: Retrieve artifacts (dvc.lock)
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
|
run: |
|
|
cd modules/ml-pipeline/src/pipeline
|
|
dvc pull -r experiments
|
|
|
|
- uses: actions/setup-python@v4
|
|
- uses: iterative/setup-cml@v1
|
|
- name: Generate report
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
|
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TARGET_BRANCH: ${{ github.base_ref }}
|
|
run: |
|
|
cd modules/ml-pipeline/src/pipeline
|
|
echo "## Model metrics" > report.md
|
|
|
|
# Compare metrics to master
|
|
git fetch --depth=1 origin ${TARGET_BRANCH}:${TARGET_BRANCH}
|
|
dvc metrics diff --md --all ${TARGET_BRANCH} >> report.md
|
|
|
|
echo "## Scenario comparison" >> report.md
|
|
|
|
cat metrics/scenario_table.md >> report.md
|
|
|
|
echo "" >> report.md
|
|
|
|
echo "## Scenario metrics" >> report.md
|
|
|
|
cat metrics/scenario_metrics.md >> report.md
|
|
|
|
cml comment create report.md
|
|
|
|
# echo "## Residuals plot from model" >> report.md
|
|
# metrics_location=$(find . -maxdepth 10 -name "residuals.png")
|
|
# echo $metrics_location
|
|
# cd $metric_location
|
|
# echo "" >> report.md
|