-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from spacetelescope/dulude-patch-2
Create all_notebooks_pep8check.yml
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
## This workflow performs PEP8 style checks on the python code in notebook code cells. | ||
## This workflow scans all notebooks in a repository, not just those modified in a pull request. | ||
name: PEP8 Notebook Style Check Execution | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
python-version: | ||
required: true | ||
type: string | ||
jobs: | ||
gather-notebooks: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: set-matrix | ||
run: echo "matrix=$(find notebooks -name "*.ipynb" | jq -cnR '[inputs | select(length>0)]')" >> $GITHUB_OUTPUT | ||
notebook-style-checks: | ||
needs: gather-notebooks | ||
environment: ci_env | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
notebooks: ${{ fromJson(needs.gather-notebooks.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v5 ## needed for caching | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
cache: 'pip' | ||
- name: Add conda to system path | ||
run: | | ||
# $CONDA is an environment variable pointing to the root of the miniconda directory | ||
echo $CONDA/bin >> $GITHUB_PATH | ||
- name: Install dependencies | ||
run: | | ||
pip install flake8 | ||
pip install numpy | ||
pip install pytz | ||
- name: Check-out notebook-ci-actions repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: spacetelescope/notebook-ci-actions | ||
path: temp_pep8checker | ||
ref: v3 | ||
- name: Run PEP8 style check | ||
run: | | ||
python temp_pep8checker/.github/helpers/pep8_nb_style_checker.py ${{ matrix.notebooks }} |