Upgrade and modernize the repo #25
This file contains hidden or 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
name: PR Flow | |
on: | |
pull_request: | |
branches: [staging, main] | |
concurrency: | |
# New commit on branch cancels running workflows of the same branch | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run-zenml-pipeline: | |
runs-on: ubuntu-latest | |
env: | |
ZENML_STORE_URL: https://11870fb5-zenml.cloudinfra.zenml.io # Replace with your workspace name | |
ZENML_STORE_API_KEY: ${{ secrets.ZENML_API_KEY }} | |
ZENML_PROJECT: Gitflow # Replace with your project name | |
ZENML_STAGING_STACK: zenml-full-gcp-stack # Replace with your staging stack name | |
ZENML_PRODUCTION_STACK: zenml-full-gcp-stack # Replace with your production stack name | |
ZENML_GITHUB_SHA: ${{ github.event.pull_request.head.sha }} | |
ZENML_GITHUB_URL_PR: ${{ github.event.pull_request._links.html.href }} | |
ZENML_DEBUG: true | |
ZENML_ANALYTICS_OPT_IN: false | |
ZENML_LOGGING_VERBOSITY: INFO | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install requirements | |
if: ${{ github.base_ref == 'staging' }} | |
run: | | |
pip install uv | |
uv pip install --system -r requirements.txt | |
zenml integration install gcp sklearn -y --uv | |
- name: Install requirements | |
if: ${{ github.base_ref == 'main' }} | |
run: | | |
pip install uv | |
uv pip install --system -r requirements.txt | |
zenml integration install gcp sklearn -y --uv | |
- name: Install wkhtmltopdf | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wkhtmltopdf | |
- name: Login to ZenML server | |
run: | | |
zenml project set gitflow | |
- name: Set stack (Staging) | |
if: ${{ github.base_ref == 'staging' }} | |
run: | | |
zenml stack set ${{ env.ZENML_STAGING_STACK }} | |
- name: Set stack (Production) | |
if: ${{ github.base_ref == 'main' }} | |
run: | | |
zenml stack set ${{ env.ZENML_PRODUCTION_STACK }} | |
- name: Run pipeline (Staging) | |
if: ${{ github.base_ref == 'staging' }} | |
run: | | |
python run.py \ | |
--environment=staging \ | |
--stack=zenml-full-gcp-stack \ | |
--name=STG_price_prediction_training_${{ env.ZENML_GITHUB_SHA }} | |
- name: Run pipeline (Production) | |
if: ${{ github.base_ref == 'main' }} | |
run: | | |
python run.py \ | |
--environment=production \ | |
--stack=zenml-full-gcp-stack \ | |
--name=PROD_price_prediction_training_${{ env.ZENML_GITHUB_SHA }} | |
# - name: Read training report | |
# id: report | |
# uses: juliangruber/read-file-action@v1 | |
# with: | |
# path: ./model_train_results.md | |
# - name: PR comment with training report | |
# uses: thollander/actions-comment-pull-request@v2 | |
# with: | |
# filePath: ./model_train_results.md | |
# comment_tag: training_report | |
# mode: recreate | |
# create_if_not_exists: true |