Upgrade and modernize the repo #8
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_WORKSPACE: https://08694463-zenml.cloudinfra.zenml.io # Replace with your workspace name | |
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_API_KEY: ${{ secrets.ZENML_API_KEY }} # Setup the API key in the repository secrets | |
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 mlflow deepchecks -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 mlflow deepchecks -y --uv | |
- name: Install wkhtmltopdf | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wkhtmltopdf | |
- name: Login to ZenML server | |
run: | | |
zenml login $ZENML_WORKSPACE --api-key $ZENML_API_KEY | |
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 \ | |
--pipeline train \ | |
--dataset staging \ | |
--version ${{ env.ZENML_GITHUB_SHA }} \ | |
--github-pr-url ${{ env.ZENML_GITHUB_URL_PR }} \ | |
-o ${{ secrets.ZENML_ORG_ID }} \ | |
-t ${{ secrets.ZENML_TENANT_ID }} | |
- name: Run pipeline (Production) | |
if: ${{ github.base_ref == 'main' }} | |
run: | | |
python run.py \ | |
--pipeline end-to-end \ | |
--dataset production \ | |
--version ${{ env.ZENML_GITHUB_SHA }} \ | |
--github-pr-url ${{ env.ZENML_GITHUB_URL_PR }} \ | |
-o ${{ secrets.ZENML_ORG_ID }} \ | |
-t ${{ secrets.ZENML_TENANT_ID }} | |
- 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 |