Skip to content

Documentation for monitoring thresholds and alert notifications #1594

Documentation for monitoring thresholds and alert notifications

Documentation for monitoring thresholds and alert notifications #1594

name: Validate docs site (render, test, and deploy)
on:
pull_request:
types: [opened, synchronize, ready_for_review]
permissions:
issues: write
pull-requests: write
jobs:
validate:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Check out installation repository
uses: actions/checkout@v4
with:
repository: validmind/installation
path: site/_source/installation
token: ${{ secrets.INSTALLATION_RO_PAT }}
- name: Check out release-notes repository
uses: actions/checkout@v4
with:
repository: validmind/release-notes
path: site/_source/release-notes
token: ${{ secrets.RELEASE_NOTES_RO_PAT }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Setup R environment
uses: ./.github/actions/setup-r
- name: Populate installation
run: cp -r site/_source/installation/site/installation site/installation
- name: Populate release notes
run: |
cp -r site/_source/release-notes/releases/validmind-library site/releases/validmind-library
cp -r site/_source/release-notes/releases/frontend site/releases/frontend
cp -r site/_source/release-notes/releases/documentation site/releases/documentation
cp -r site/_source/release-notes/releases/cmvm site/installation/releases
- name: Render demo docs site
run: |
cd site
quarto render --profile development 2>&1 | tee render_errors.log || {
echo "Quarto render failed immediately";
cat render_errors.log;
exit 1;
}
make generate-sitemap
# See if site/notebooks/ has updates
# Checks the current PR branch against the target branch
- name: Filter changed files
uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ github.event.pull_request.base_ref }}
ref: ${{ github.head_ref }}
filters: |
notebooks:
- 'site/notebooks/EXECUTED/**'
# If yes then create the dev.env file for use in execution step
- name: Create dev.env file
if: steps.filter.outputs.notebooks == 'true'
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
cat dev.env
# If yes then create the valid.env file for use in execution step
- name: Create valid.env file
if: steps.filter.outputs.notebooks == 'true'
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
cat valid.env
# Only execute the demo notebooks for training if .env files are created
- name: Execute demo ValidMind for model development and validation series
if: ${{ vars.ENABLE_DEMO_NOTEBOOK == 'true' && steps.create_dev_env.outcome == 'success' && steps.create_valid_env.outcome == 'success' }}
uses: ./.github/actions/demo-notebook
id: execute-demo-notebook
with:
dev_env: dev.env
valid_env: valid.env
- name: Test for warnings or errors
run: |
if grep -q 'WARN:\|ERROR:' site/render_errors.log; then
echo "Warnings or errors detected during Quarto render"
cat site/render_errors.log
exit 1
else
echo "No warnings or errors detected during Quarto render"
fi
# Demo bucket is in us-east-1
- name: Configure AWS credentials
run: aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }} && aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }} && aws configure set default.region us-east-1
- name: Deploy PR preview
run: aws s3 sync site/_site s3://validmind-docs-staging/site/pr_previews/${{ github.head_ref }} --delete && aws cloudfront create-invalidation --distribution-id ESWVTZYFL873V --paths "/*" --no-cli-pager
- name: Post comment with preview URL
uses: actions/github-script@v6
with:
script: |
const previewUrl = `https://docs-staging.validmind.ai/pr_previews/${{ github.head_ref }}/index.html`;
// Delete old preview comments
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
for (const comment of comments) {
if (comment.user.login === 'github-actions[bot]' && comment.body.includes('## Validate docs site')) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
});
}
}
let comment = `## Validate docs site\n\n`;
comment += `✓ INFO: A live preview of the docs site is available — [Open the preview](${previewUrl})\n\n`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment
});