Skip to content

Commit

Permalink
fixing yamllint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneknapp committed Jul 8, 2024
1 parent b0b4be4 commit 1da0b5b
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 93 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

0 comments on commit 1da0b5b

Please sign in to comment.