mirror of
https://github.com/Hestia-Homes/ML.git
synced 2026-06-08 11:17:25 +00:00
203 lines
6.7 KiB
YAML
203 lines
6.7 KiB
YAML
name: Register the model for the given pipeline branch
|
|
|
|
# on:
|
|
# push:
|
|
# branches:
|
|
# - "model-**"
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- closed
|
|
branches:
|
|
- "master"
|
|
|
|
permissions: write-all
|
|
|
|
jobs:
|
|
Register-Major-Model-Dev:
|
|
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'major')) }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install packages to register model
|
|
run: |
|
|
pip install --upgrade pip
|
|
pip install -r modules/ml-pipeline/src/pipeline/src/requirements/version_control/requirements.txt
|
|
|
|
- name: Register Model
|
|
run: |
|
|
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
|
|
|
git config user.name "Github-Bot"
|
|
git config user.email "Github-Bot@no-reply.com"
|
|
|
|
# gto register test --repo https://github.com/Hestia-Homes/ML/
|
|
# echo "chicken" >> test.md
|
|
|
|
# gto register ${REGISTER_MODEL_NAME} --bump-major
|
|
# gto assign regression --stage dev
|
|
# gto show >> Model_Register.md
|
|
|
|
Register-Minor-Model-Dev:
|
|
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'minor')) }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install packages to register model
|
|
run: |
|
|
pip install --upgrade pip
|
|
pip install -r modules/ml-pipeline/src/pipeline/src/requirements/version_control/requirements.txt
|
|
|
|
- name: Register Model
|
|
run: |
|
|
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
|
|
|
git config user.name "Github-Bot"
|
|
git config user.email "Github-Bot@no-reply.com"
|
|
|
|
# gto register test --repo https://github.com/Hestia-Homes/ML/
|
|
# echo "chicken" >> test.md
|
|
|
|
# gto register ${REGISTER_MODEL_NAME} --bump-minor
|
|
# gto assign regression --stage dev
|
|
# gto show >> Model_Register.md
|
|
|
|
Register-Patch-Model-Dev:
|
|
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'patch')) }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install packages to register model
|
|
run: |
|
|
pip install --upgrade pip
|
|
pip install -r modules/ml-pipeline/src/pipeline/src/requirements/version_control/requirements.txt
|
|
|
|
- name: Register Model
|
|
run: |
|
|
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
|
|
|
git config user.name "Github-Bot"
|
|
git config user.email "Github-Bot@no-reply.com"
|
|
|
|
# gto register test --repo https://github.com/Hestia-Homes/ML/
|
|
# echo "chicken" >> test.md
|
|
|
|
# gto register ${REGISTER_MODEL_NAME} --bump-major
|
|
# gto assign regression --stage dev
|
|
# gto show >> Model_Register.md
|
|
|
|
Promote-Artefacts-To-Dev:
|
|
if: github.event.pull_request.merged == true
|
|
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/src/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/src
|
|
dvc pull -r experiments
|
|
|
|
- name: Push artifacts to Dev
|
|
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/src
|
|
dvc push -r dev
|
|
|
|
|
|
# Register-New-Model-Dev:
|
|
# if: github.event.pull_request.merged == true
|
|
# runs-on: ubuntu-latest
|
|
# steps:
|
|
# - uses: actions/checkout@v4
|
|
# with:
|
|
# fetch-depth: 0
|
|
|
|
# - name: Install packages to register model
|
|
# 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/src/requirements/version_control/requirements.txt
|
|
|
|
# - name: Register Model
|
|
# env:
|
|
# AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
|
# AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
|
# run: |
|
|
|
|
# # REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
|
# REGISTER_MODEL_NAME=$(echo ${{github.ref_name}} | awk -F"-" '{print $1}')
|
|
|
|
# git config user.name "Github-Bot"
|
|
# git config user.email "Github-Bot@no-reply.com"
|
|
|
|
# # git tag model@v0.0.1
|
|
# # git push origin model@v0.0.1
|
|
|
|
# # gto register test --repo https://github.com/Hestia-Homes/ML/
|
|
# # echo "chicken" >> test.md
|
|
|
|
# # gto -v register ${REGISTER_MODEL_NAME}
|
|
# # gto assign regression --stage dev
|
|
# # gto show
|
|
|
|
Register-Prediction-Image-Dev:
|
|
needs: Promote-Artefacts-To-Dev
|
|
# needs: [Promote-Artefacts-To-Dev, Register-New-Model-Dev] WILL ADD BACK ONCE REGISTER WORKS
|
|
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/src/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/src
|
|
dvc pull -r dev
|
|
|
|
- name: Build Prediction docker image (TODO - NEED LAMBDA IMAGE, need to add version from gto registry)
|
|
run: |
|
|
cd modules/ml-pipeline/src/pipeline/
|
|
REGISTER_MODEL_NAME=$(echo ${{ github.event.pull_request.head.ref }} | awk -F"-" '{print $1}')
|
|
docker build . --file Prediction.Dockerfile --tag ${REGISTER_MODEL_NAME}
|
|
|
|
- name: ECR Login - Dev
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
|
run: |
|
|
echo "LOGIN TO ECR"
|
|
|
|
- name: Push Prediction image to ECR - Dev
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}
|
|
run: |
|
|
echo "PUSH TO ECR"
|