Skip to content

Merge staging into prod #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/ai_explain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ permissions:

on:
pull_request:
types: [opened, synchronize]
types: [review_requested]

jobs:
explain-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Python
Expand All @@ -32,4 +32,4 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF: ${{ github.ref }}
run: python .github/workflows/ai_explain.py
run: python .github/workflows/ai_explain.py
2 changes: 1 addition & 1 deletion .github/workflows/delete-pr-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
run: aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} && aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} && aws configure set default.region us-east-1

- name: Delete PR preview
run: aws s3 rm s3://${{ vars.S3_BUCKET_DEMO }}/site/pr_previews/${{ github.head_ref }}/ --recursive && aws cloudfront create-invalidation --distribution-id E38AINJY5CYN6P --paths "/*" --no-cli-pager > /dev/null
run: aws s3 rm s3://docs-ci-cd-demo/site/pr_previews/${{ github.head_ref }}/ --recursive && aws cloudfront create-invalidation --distribution-id E38AINJY5CYN6P --paths "/*" --no-cli-pager > /dev/null
30 changes: 25 additions & 5 deletions .github/workflows/deploy-docs-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Deploy our docs site to S3 whenever we push a commit to the main branch

name: Deploy to S3 production bucket
name: Deploy docs site to production

on:
push:
Expand All @@ -12,13 +12,33 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
- name: Check out repository
uses: actions/checkout@v2

- name: Get latest Quarto release URL
id: get-quarto-url
run: |
API_URL="https://api.github.com/repos/quarto-dev/quarto-cli/releases/latest"
DOWNLOAD_URL=$(curl -s $API_URL | jq -r '.assets[] | select(.name | endswith("linux-amd64.deb")).browser_download_url')
echo "DOWNLOAD_URL=$DOWNLOAD_URL" >> $GITHUB_ENV

- name: Download and install Quarto
run: |
wget ${{ env.DOWNLOAD_URL }} -O quarto-latest-linux-amd64.deb
sudo dpkg -i quarto-latest-linux-amd64.deb

- name: Render docs site
run: |
cd site
quarto render &> render_errors.log || {
echo "Quarto render failed immediately";
cat render_errors.log;
exit 1;
}

# Prod bucket is in us-east-1
- name: Configure AWS credentials
run: aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} && aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} && aws configure set default.region us-east-1

- name: Sync to S3
run:
aws s3 sync site/_site s3://${{ vars.S3_BUCKET_PROD }}/site --delete && aws cloudfront create-invalidation --distribution-id E2I9R40IH01NW3 --paths "/*" --no-cli-pager
- name: Deploy docs site
run: aws s3 sync site/_site s3://docs-ci-cd-prod/site --delete && aws cloudfront create-invalidation --distribution-id E2I9R40IH01NW3 --paths "/*" --no-cli-pager
44 changes: 44 additions & 0 deletions .github/workflows/deploy-docs-staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Deploy our docs site to S3 whenever we push a commit to the main branch

name: Deploy docs site to staging

on:
push:
branches:
- staging

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Get latest Quarto release URL
id: get-quarto-url
run: |
API_URL="https://api.github.com/repos/quarto-dev/quarto-cli/releases/latest"
DOWNLOAD_URL=$(curl -s $API_URL | jq -r '.assets[] | select(.name | endswith("linux-amd64.deb")).browser_download_url')
echo "DOWNLOAD_URL=$DOWNLOAD_URL" >> $GITHUB_ENV

- name: Download and install Quarto
run: |
wget ${{ env.DOWNLOAD_URL }} -O quarto-latest-linux-amd64.deb
sudo dpkg -i quarto-latest-linux-amd64.deb

- name: Render docs site
run: |
cd site
quarto render &> render_errors.log || {
echo "Quarto render failed immediately";
cat render_errors.log;
exit 1;
}

# Staging bucket is in us-west-2
- 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-west-2

- name: Deploy docs site
run: aws s3 sync site/_site s3://docs-ci-cd-staging/site --delete && aws cloudfront create-invalidation --distribution-id E2FB73KGY63MV6 --paths "/*" --no-cli-pager
2 changes: 1 addition & 1 deletion .github/workflows/release_notes_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: github.event.pull_request.draft == false

steps:
- name: Checkout repository
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Python
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/validate-docs-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
if: github.event.pull_request.draft == false

steps:
- name: Checkout repository
- name: Check out repository
uses: actions/checkout@v2

- name: Get latest Quarto release URL
Expand All @@ -31,7 +31,7 @@ jobs:

- name: Render site
run: |
cd ./site
cd site
quarto render &> render_errors.log || {
echo "Quarto render failed immediately";
cat render_errors.log;
Expand All @@ -48,11 +48,12 @@ jobs:
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 }} && aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} && aws configure set default.region us-east-1

- name: Deploy PR preview
run: aws s3 sync site/_site s3://${{ vars.S3_BUCKET_DEMO }}/site/pr_previews/${{ github.head_ref }} --delete && aws cloudfront create-invalidation --distribution-id E38AINJY5CYN6P --paths "/*" --no-cli-pager
run: aws s3 sync site/_site s3://docs-ci-cd-demo/site/pr_previews/${{ github.head_ref }} --delete && aws cloudfront create-invalidation --distribution-id E38AINJY5CYN6P --paths "/*" --no-cli-pager

- name: Post comment with preview URL
uses: actions/github-script@v6
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@ make get-source

After you pull in the changes, commit them to this repo as part of the release notes process.

<!-- Aug 2024: Need to mention rendered Python `.html` docs and generated `.md` test descriptions -->
<!-- September 2024: Need to mention rendered Python `.html` docs and generated `.md` test descriptions -->
25 changes: 25 additions & 0 deletions internal/templates/_single-source.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- REPLACE WITH YOUR ACTUAL INSTRUCTIONS -->


<!-- VISIBLE IN USER GUIDES ONlY -->

:::: {.content-visible unless-format="revealjs"}
1. In the left sidebar, click **Model Inventory**.

1. Select a model by clicking on it or find your model by applying a filter or searching for it.^[[Working with the model inventory](/guide/model-inventory/working-with-model-inventory.qmd#search-filter-and-sort-models)]

1. In the expanded sidebar that appears for your model, click **Model Activity**.

::::


<!-- VISIBLE IN TRAINING SLIDES ONLY -->

:::: {.content-hidden unless-format="revealjs"}
1. In the left sidebar, click **Model Inventory**.

1. Select a model by clicking on it or [find your model by applying a filter or searching for it](/guide/model-inventory/working-with-model-inventory.qmd#search-filter-and-sort-models).

1. In the expanded sidebar that appears for your model, click **Model Activity**.

::::
29 changes: 21 additions & 8 deletions site/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Define source and destination directories
SRC_DIR := _source/developer-framework
DEST_DIR_NB := notebooks
SRC_DIR_PYTHON := python-docs
DEST_DIR_PYTHON := _site/validmind
DEST_DIR_TESTS := tests
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)

# Define .PHONY target for help section
.PHONY: help clean clone notebooks python-docs docs-site deploy-demo deploy-demo-branch delete-demo-branch deploy-prod release-notes
.PHONY: help clean clone notebooks python-docs docs-site deploy-demo deploy-demo-branch delete-demo-branch deploy-prod deploy-staging release-notes

# Help section
help:
Expand All @@ -21,6 +22,7 @@ help:
@echo " deploy-demo-branch Deploy docs demo site to s3://docs-ci-cd-demo/site/pr_previews/$(GIT_BRANCH)/"
@echo " delete-demo-branch Delete docs demo site in s3://docs-ci-cd-demo/site/pr_previews/$(GIT_BRANCH)/"
@echo " deploy-prod Deploy docs prod site to s3://docs-ci-cd-prod/site/"
@echo " deploy-staging Deploy docs staging site to s3://docs-ci-cd-staging/site/"
@echo " help Display this help message (default target)"
@echo " release-notes Generate release notes from pull requests since latest tag and update _quarto.yml"

Expand Down Expand Up @@ -54,13 +56,14 @@ notebooks:
python-docs:
@if [ -d "$(SRC_DIR)/docs/_build/" ]; then \
echo "\nUpdating Python documentation ..."; \
rm -rf $(DEST_DIR_PYTHON); \
mkdir -p $(DEST_DIR_PYTHON); \
cp -r $(SRC_DIR)/docs/_build/. $(DEST_DIR_PYTHON); \
else \
echo "\nNo updated Python documentation available locally, skipping step ..."; \
fi

rm -rf $(SRC_DIR_PYTHON); \
mkdir -p $(SRC_DIR_PYTHON); \
cp -r $(SRC_DIR)/docs/_build/. $(SRC_DIR_PYTHON); \
fi; \
echo "Copying Python documentation into docs site ..."; \
rm -rf $(DEST_DIR_PYTHON); \
mkdir -p $(DEST_DIR_PYTHON); \
cp -r $(SRC_DIR_PYTHON)/. $(DEST_DIR_PYTHON);

test-descriptions:
@echo "\nUpdating test descriptions source ..."
Expand Down Expand Up @@ -107,6 +110,16 @@ deploy-prod:
quarto render && aws s3 sync ./_site s3://docs-ci-cd-prod/site/ --delete && aws cloudfront create-invalidation --distribution-id E2I9R40IH01NW3 --paths "/*" --no-cli-pager > /dev/null; \
fi

# Deployment to https://docs.validmind.ai/
# TO DO Fix Cloudfront distribution ID
deploy-staging:
@if [ "`git rev-parse --abbrev-ref HEAD`" != "nrichers/sc-6277/deploy-staging-docs-site-workflow" ]; then \
echo "You're not on the staging branch, no action taken."; \
else \
echo "\nDeploying staging site ..."; \
quarto render && aws s3 sync ./_site s3://docs-ci-cd-staging/site/ --delete && aws cloudfront create-invalidation --distribution-id E2FB73KGY63MV6 --paths "/*" --no-cli-pager > /dev/null; \
fi

# Generate release notes
release-notes:
@python ../release-scripts/generate_release_objects.py
1 change: 1 addition & 0 deletions site/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ website:
- text: "---"
- text: "RELEASES"
# MAKE-RELEASE-NOTES-EMBED-MARKER
- releases/2024-sep-09/release-notes.qmd
- releases/2024-aug-13/release-notes.qmd
- releases/2024-jul-22/release-notes.qmd
- releases/2024-jun-10/release-notes.qmd
Expand Down
Loading
Loading