Skip to content

Commit

Permalink
Merge branch 'main' into restore-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneknapp authored Jul 18, 2024
2 parents c4df253 + 99c48ba commit bcec10b
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 96 deletions.
65 changes: 33 additions & 32 deletions .github/workflows/test_changed_notebooks.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Execute Jupyter Notebooks With Changes

on:
workflow_dispatch:
workflow_dispatch:
pull_request:
branches:
- main
Expand All @@ -18,38 +18,39 @@ jobs:
password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Get changed files
id: changed-files-git
run: |
cd ${GITHUB_WORKSPACE}
ls -a
chown -R root .
git status || true
# Captures changed Jupyter notebooks between the last commit and the previous one
CHANGED_NOTEBOOKS=$(git diff --name-only HEAD^ || true)
echo "changed_files=${CHANGED_NOTEBOOKS}" >> $GITHUB_OUTPUT
- name: Get changed files
id: changed-files-git
run: |
cd ${GITHUB_WORKSPACE}
ls -a
chown -R root .
git status || true
# Captures changed Jupyter notebooks between the last commit and the
# previous one
CHANGED_NOTEBOOKS=$(git diff --name-only HEAD^ || true)
echo "changed_files=${CHANGED_NOTEBOOKS}" >> $GITHUB_OUTPUT
- name: Execute changed notebooks
if: steps.changed-files-git.outputs.changed_files
run: |
echo "Changed Notebooks: ${CHANGED_NOTEBOOKS}"
for file in $CHANGED_NOTEBOOKS; do
if [[ $file == *.ipynb ]]; then
echo "Executing notebook: $file"
jupyter nbconvert --to notebook --execute --inplace "$file" || echo "FAILED: ${file}"
fi
done
- name: Execute changed notebooks
if: steps.changed-files-git.outputs.changed_files
run: |
echo "Changed Notebooks: ${CHANGED_NOTEBOOKS}"
for file in $CHANGED_NOTEBOOKS; do
if [[ $file == *.ipynb ]]; then
echo "Executing notebook: $file"
jupyter nbconvert --to notebook --execute --inplace "$file" || echo "FAILED: ${file}"
fi
done
- name: Check for errors
run: |
for file in $CHANGED_NOTEBOOKS; do
if [[ $file == *.ipynb && -f "$file" ]]; then
if grep -q "Execution failed" "$file"; then
echo "Notebook execution failed: $file"
exit 1
- name: Check for errors
run: |
for file in $CHANGED_NOTEBOOKS; do
if [[ $file == *.ipynb && -f "$file" ]]; then
if grep -q "Execution failed" "$file"; then
echo "Notebook execution failed: $file"
exit 1
fi
fi
fi
done
done
121 changes: 60 additions & 61 deletions .github/workflows/test_notebooks.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Test Jupyter Notebooks

on:
workflow_dispatch:
workflow_dispatch:
push:
branches:
- main
Expand All @@ -19,72 +19,71 @@ jobs:
password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

#- name: Get changed notebooks
# id: changed-notebooks
# uses: tj-actions/changed-files@v44
# with:
# since_last_remote_commit: true
# files: |
# **.ipynb
#- name: Get changed notebooks
# id: changed-notebooks
# uses: tj-actions/changed-files@v44
# with:
# since_last_remote_commit: true
# files: |
# **.ipynb

- name: Set WORKSPACE_DIR
id: set-variables
run: |
echo GITHUB_WORKSPACE: $GITHUB_WORKSPACE
ls -a ${GITHUB_WORKSPACE}
- name: Set WORKSPACE_DIR
id: set-variables
run: |
echo GITHUB_WORKSPACE: $GITHUB_WORKSPACE
ls -a ${GITHUB_WORKSPACE}
REPO_FULL_NAME="${{ github.repository }}"
echo REPO_FULL_NAME="${REPO_FULL_NAME}"
REPO_NAME="${REPO_FULL_NAME#*/}"
echo REPO_NAME="${REPO_NAME}"
WORKSPACE_DIR="/__w/${REPO_NAME}/${REPO_NAME}"
echo "WORKSPACE_DIR=${WORKSPACE_DIR}" >> $GITHUB_ENV
REPO_FULL_NAME="${{ github.repository }}"
echo REPO_FULL_NAME="${REPO_FULL_NAME}"
REPO_NAME="${REPO_FULL_NAME#*/}"
echo REPO_NAME="${REPO_NAME}"
WORKSPACE_DIR="/__w/${REPO_NAME}/${REPO_NAME}"
echo "WORKSPACE_DIR=${WORKSPACE_DIR}" >> $GITHUB_ENV
ls -a ${WORKSPACE_DIR}
ls -a ${WORKSPACE_DIR}
- name: Add debugging
run: |
echo "pwd: " `pwd`
echo ============================
echo "ls -a"
ls -a
echo ============================
echo "ls -a ${WORKSPACE_DIR}"
ls -a ${WORKSPACE_DIR}
echo ============================
- name: Add debugging
run: |
echo "pwd: " `pwd`
echo ============================
echo "ls -a"
ls -a
echo ============================
echo "ls -a ${WORKSPACE_DIR}"
ls -a ${WORKSPACE_DIR}
echo ============================
- name: Execute notebooks
shell: bash
run: |
ls -a
for file in test_notebooks/* ; do
echo "Converting: '${file}'"
if [ ! -f "${file}" ]; then continue ; fi
jupyter nbconvert --to notebook --execute --inplace "$file" || echo FAILED: "${file}"
done
- name: Execute notebooks
shell: bash
run: |
ls -a
for file in test_notebooks/* ; do
echo "Converting: '${file}'"
if [ ! -f "${file}" ]; then continue ; fi
jupyter nbconvert --to notebook --execute --inplace "$file" || echo FAILED: "${file}"
done
- name: Check for errors
shell: bash
run: |
cd $WORKSPACE_DIR
for file in test_notebooks/* ; do
if [ ! -f "${file}" ]; then continue ; fi
if grep -q "Execution failed" "$file"; then
echo "Notebook execution failed: $file"
#exit 1
fi
done
- name: Check for errors
shell: bash
run: |
cd $WORKSPACE_DIR
for file in test_notebooks/* ; do
if [ ! -f "${file}" ]; then continue ; fi
if grep -q "Execution failed" "$file"; then
echo "Notebook execution failed: $file"
#exit 1
fi
done
- name: Get changed files
id: changed-files-git
run: |
cd ${GITHUB_WORKSPACE}
ls -a
git status || true
CHANGED_NOTEBOOKS=$(git diff --name-only HEAD^ || true)
echo "changed_files=${CHANGED_NOTEBOOKS}" >> $GITHUB_OUTPUT
- name: Get changed files
id: changed-files-git
run: |
cd ${GITHUB_WORKSPACE}
ls -a
git status || true
CHANGED_NOTEBOOKS=$(git diff --name-only HEAD^ || true)
echo "changed_files=${CHANGED_NOTEBOOKS}" >> $GITHUB_OUTPUT
46 changes: 46 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This config represents running the command `yamllint -d relaxed .` with the
# following extra rules:
#
# new-line-at-end-of-file:
# level: warning
# trailing-spaces:
# level: warning
#
# We also ignore the cookiecutter directories as these often contain
# jinja-style templating functions that yamllint doesn't play nicely with
#
# cribbed from https://github.com/2i2c-org/infrastructure/blob/main/.yamllint.yaml
---
extends: default

ignore: |
**/template/**
**/templates/**
rules:
braces:
level: warning
max-spaces-inside: 1
brackets:
level: warning
max-spaces-inside: 1
colons:
level: warning
commas:
level: warning
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
level: warning
hyphens:
level: warning
indentation:
level: warning
indent-sequences: consistent
line-length: disable
new-line-at-end-of-file:
level: warning
trailing-spaces:
level: warning
truthy: disable
6 changes: 3 additions & 3 deletions scripts/query_courseid.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def getCourseInformation(term_id, class_name, page_number=1, page_size=100):

headersinput = {
"app_id": "13eb564e",
"app_key": "74e1f260b527e7655628220a5de615c6",
"app_key": "",
}

response = requests.get(full_url, headers = headersinput)
Expand All @@ -106,7 +106,7 @@ def getCourseInformation(term_id, class_name, page_number=1, page_size=100):

headersinput = {
"app_id": "13eb564e",
"app_key": " ",
"app_key": "",
}
response = requests.get(full_url, headers = headersinput)

Expand Down Expand Up @@ -147,4 +147,4 @@ def getCourseInformation(term_id, class_name, page_number=1, page_size=100):
# STAT C131A has an A at the end
#get instructor name

# add instructor name to the json output
# add instructor name to the json output

0 comments on commit bcec10b

Please sign in to comment.