Skip to content

Execute training notebooks for production #44

Execute training notebooks for production

Execute training notebooks for production #44

Workflow file for this run

name: Execute training notebooks for production
on:
workflow_run:
workflows: ["Deploy docs site to production"]
types:
- completed
workflow_dispatch:
jobs:
execute:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
steps:
- name: Check out documentation repository
uses: actions/checkout@v4
# Reclaim space + create a reserve for deterministic headroom
- name: Free space + create reserve
uses: ./.github/actions/free-disk-space
with:
remove_dotnet: "true"
remove_android: "true"
remove_haskell: "true"
prune_docker: "true"
apt_cleanup: "true"
create_reserve_gb: "3"
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
check-latest: false
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: ${{ vars.QUARTO_VERSION }}
- name: Create dev.env file
id: create_dev_env
run: |
touch dev.env
echo VM_API_HOST=${{ secrets.PLATFORM_API_HOST }} >> dev.env
echo VM_API_KEY=${{ secrets.PLATFORM_API_KEY }} >> dev.env
echo VM_API_SECRET=${{ secrets.PLATFORM_API_SECRET }} >> dev.env
echo VM_API_MODEL=${{ secrets.PLATFORM_DEV_MODEL }} >> dev.env
- name: Create valid.env file
id: create_valid_env
run: |
touch valid.env
echo VM_API_HOST=${{ secrets.PLATFORM_API_HOST }} >> valid.env
echo VM_API_KEY=${{ secrets.PLATFORM_API_KEY }} >> valid.env
echo VM_API_SECRET=${{ secrets.PLATFORM_API_SECRET }} >> valid.env
echo VM_API_MODEL=${{ secrets.PLATFORM_VALID_MODEL }} >> valid.env
# Only execute the production notebooks for training if .env files are created
- name: Execute production ValidMind for model development and validation series
if: ${{ steps.create_dev_env.outcome == 'success' && steps.create_valid_env.outcome == 'success' }}
uses: ./.github/actions/prod-notebook
id: execute-prod-notebook
with:
dev_env: dev.env
valid_env: valid.env
# Prod bucket is in us-east-1
- name: Configure AWS credentials
run: aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} && aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} && aws configure set default.region us-east-1
- name: Deploy executed notebooks only
run: aws s3 sync site/_site/notebooks/EXECUTED s3://validmind-docs-prod/site/notebooks/EXECUTED --delete --exclude "installation/omnibus/*" --exclude "installation/helm-repo/*" && aws cloudfront create-invalidation --distribution-id E2BGG3USKQTR9W --paths "/site/notebooks/EXECUTED/*" --no-cli-pager
# Release headroom and shrink before final lightweight steps & post-job
- name: Release reserve & shrink
if: always()
uses: ./.github/actions/free-disk-space
with:
release_reserve: "true"
remove_paths: |
site/_source/installation
site/_source/release-notes
site/render_errors.log
site/_freeze
dev.env
valid.env
- name: Final disk usage
if: always()
run: df -hT /