Skip to content
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

check notebooks #17

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: test

on:
zacharyburnett marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:
schedule:
# Run every Monday at 6am UTC
- cron: '0 6 * * 1'
push:
paths:
- '**/*.ipynb'
- '**/*.yml'
- '**/*.yaml'
- '**/*.py'
pull_request:
branches:
- main
paths:
- '**/*.ipynb'
- '**/*.yml'
- '**/*.yaml'
- '**/*.py'

defaults:
run:
shell: bash -l {0}

jobs:
build:
name: build environment (Python ${{ matrix.python }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: [ '3.9', '3.10' ]
os: [ ubuntu-latest, macos-latest ]
exclude:
- os: macos-latest
python: '3.10'
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}
- uses: mtkennerly/[email protected]
id: version
- run: echo "::set-output name=date::$(date +'%Y%m%d')"
id: date
- uses: actions/[email protected]
if: runner.os == 'Linux'
with:
path: |
/home/runner/conda_pkgs_dir
/usr/share/miniconda/envs/asdf-tutorial-${{ runner.os }}-py${{ matrix.python }}-latest
key: conda-${{ runner.os }}-py${{ matrix.python }}-${{ steps.date.outputs.date }}
- uses: actions/[email protected]
if: runner.os == 'MacOS'
with:
path: |
/Users/runner/conda_pkgs_dir
/usr/local/miniconda/envs/asdf-tutorial-${{ runner.os }}-py${{ matrix.python }}-latest
key: conda-${{ runner.os }}-py${{ matrix.python }}-${{ steps.date.outputs.date }}
- uses: conda-incubator/[email protected]
with:
activate-environment: asdf-tutorial-${{ runner.os }}-py${{ matrix.python }}-latest
environment-file: environment.yml
python-version: ${{ matrix.python }}.*
auto-update-conda: true
use-only-tar-bz2: true
- run: conda env export > asdf-tutorial-py${{ matrix.python }}-v${{ steps.version.outputs.version }}.yml
if: runner.os == 'Linux'
- run: cat asdf-tutorial-py${{ matrix.python }}-v${{ steps.version.outputs.version }}.yml
if: runner.os == 'Linux'
- uses: actions/[email protected]
if: runner.os == 'Linux'
with:
name: asdf-tutorial-py${{ matrix.python }}-v${{ steps.version.outputs.version }}.yml
path: asdf-tutorial-py${{ matrix.python }}-v${{ steps.version.outputs.version }}.yml
run_notebooks:
name: run notebooks (Python ${{ matrix.python }}, ${{ matrix.os }})
needs: [ build ]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python: [ '3.9', '3.10' ]
os: [ ubuntu-latest, macos-latest ]
exclude:
- os: macos-latest
python: '3.10'
steps:
- uses: actions/[email protected]
- run: echo "::set-output name=date::$(date +'%Y%m%d')"
id: date
- uses: actions/[email protected]
if: runner.os == 'Linux'
with:
path: |
/home/runner/conda_pkgs_dir
/usr/share/miniconda/envs/asdf-tutorial-${{ runner.os }}-py${{ matrix.python }}-latest
key: conda-${{ runner.os }}-py${{ matrix.python }}-${{ steps.date.outputs.date }}
- uses: actions/[email protected]
if: runner.os == 'MacOS'
with:
path: |
/Users/runner/conda_pkgs_dir
/usr/local/miniconda/envs/asdf-tutorial-${{ runner.os }}-py${{ matrix.python }}-latest
key: conda-${{ runner.os }}-py${{ matrix.python }}-${{ steps.date.outputs.date }}
- uses: conda-incubator/[email protected]
with:
activate-environment: asdf-tutorial-${{ runner.os }}-py${{ matrix.python }}-latest
environment-file: environment.yml
python-version: ${{ matrix.python }}.*
auto-update-conda: true
use-only-tar-bz2: true
- run: pip install nbcollection
- run: python -m nbcollection execute .
67 changes: 67 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-yaml
args: ["--unsafe"]
- id: check-toml
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
exclude: ".*fits"
- id: trailing-whitespace
exclude: ".*fits"

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char

- repo: https://github.com/asottile/pyupgrade
rev: v2.38.2
hooks:
- id: pyupgrade
args: ["--py38-plus"]
exclude: "asdf/extern/.*"

- repo: https://github.com/PyCQA/autoflake
rev: v1.6.1
hooks:
- id: autoflake

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black

- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
exclude: "asdf/extern/.*|docs/.*"

- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
hooks:
- id: bandit
args: ["-c", "bandit.yaml"]
14 changes: 14 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: asdf-tutorial-env

dependencies:
- jupyter
- matplotlib
- numpy
- pip
- python >= 3.9
- pip:
- asdf
- asdf-astropy
- asdf-standard
- astropy
- gwcs