Notebook Execution and Error Check #382
Workflow file for this run
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: Notebook Execution and Error Check | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
push: | |
branches: | |
- main | |
- dev | |
workflow_dispatch: # This enables manual triggering | |
jobs: | |
execute_notebooks: | |
runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# # this line is automatically generated by the script in .github/workflows/scripts/update_notebook_matrix.sh | |
# notebook: ["bug_free_python_code.ipynb","check_for_pii.ipynb","competitors_check.ipynb","extracting_entities.ipynb","generate_structured_data.ipynb","generate_structured_data_cohere.ipynb","guardrails_with_chat_models.ipynb","input_validation.ipynb","llamaindex-output-parsing.ipynb","no_secrets_in_generated_text.ipynb","provenance.ipynb","recipe_generation.ipynb","regex_validation.ipynb","response_is_on_topic.ipynb","secrets_detection.ipynb","select_choice_based_on_action.ipynb","streaming.ipynb","syntax_error_free_sql.ipynb","text_summarization_quality.ipynb","toxic_language.ipynb","translation_to_specific_language.ipynb","translation_with_quality_check.ipynb","valid_chess_moves.ipynb","value_within_distribution.ipynb"] | |
env: | |
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
HUGGINGFACE_API_KEY: ${{ secrets.HUGGINGFACE_API_KEY }} | |
NLTK_DATA: /tmp/nltk_data | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Create .guardrailsrc | |
run: | | |
echo 'id="SYSTEM TESTING"' > ~/.guardrailsrc | |
echo 'no_metrics=false' >> ~/.guardrailsrc | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11.x | |
# - name: Poetry cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: ~/.cache/pypoetry | |
# key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }} | |
# - name: Install Poetry | |
# uses: snok/install-poetry@v1 | |
# with: | |
# virtualenvs-create: true | |
# virtualenvs-in-project: true | |
# installer-parallel: true | |
- name: Install dependencies | |
run: | | |
# Legacy run script | |
# make full; | |
# poetry add "openai>=1.2.4" jupyter nbconvert cohere==5.3.2; | |
# Setup Virtual Environment | |
python3 -m venv ./.venv | |
. .venv/bin/activate | |
echo PATH=$PATH >> $GITHUB_ENV | |
# Install the current branch | |
pip install . | |
# Install extra stuff for notebook runs | |
pip install "huggingface_hub[cli]" jupyter nbconvert cohere==5.3.2 | |
pip install nltk | |
echo "pip show nltk: $(pip show nltk)" | |
echo "which pip $(which pip)" | |
- name: Huggingface Hub Login | |
run: | | |
echo "which python: $(which python)" | |
echo "which pip $(which pip)" | |
huggingface-cli login --token $HUGGINGFACE_API_KEY | |
- name: download nltk data | |
run: | | |
echo "which pip $(which pip)" | |
echo "pip show nltk: $(pip show nltk)" | |
mkdir /tmp/nltk_data; | |
python -m nltk.downloader -d /tmp/nltk_data punkt; | |
# - name: Use venv | |
# run: source .venv/bin/activate | |
- name: Execute notebooks and check for errors | |
# run: bash ./.github/workflows/scripts/run_notebooks.sh ${{ matrix.notebook }} | |
run: bash ./.github/workflows/scripts/run_notebooks.sh bug_free_python_code.ipynb | |