-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
168 additions
and
4 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,164 @@ | ||
name: main | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- ".github/**" | ||
- "!.github/workflows/main.yml" | ||
- "docs/**" | ||
- "*.md" | ||
- ".git*" | ||
|
||
jobs: | ||
clean: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: condaforge/mambaforge | ||
volumes: | ||
- ${{ github.workspace }}:/github/workspace | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
- name: Install dependencies | ||
run: mamba install -c fastai -c conda-forge nbdev nbstripout | ||
- name: Clean notebooks | ||
run: nbdev_clean_nbs | ||
- name: Strip notebook outputs | ||
run: find . -name "*.ipynb" | xargs nbstripout | ||
- name: Check if git status is clean | ||
run: | | ||
if [ ! -z "$(git status --porcelain)" ]; then | ||
echo "Notebooks are not cleaned! They still contain outputs and/or metadata." | ||
echo "You probably forgot to clear the notebook outputs before pushing." | ||
echo "Please make sure all pre-commit hooks are properly installed to prevent this issue." | ||
false; | ||
fi | ||
diff: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: condaforge/mambaforge | ||
volumes: | ||
- ${{ github.workspace }}:/github/workspace | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
- name: Install dependencies | ||
run: mamba install -c fastai -c conda-forge nbdev | ||
- name: Check for no diff between notebooks and library | ||
run: | | ||
if [ ! -z "$(nbdev_diff_nbs)" ]; then | ||
echo "Python library does not match backing notebooks (diff between notebooks and library detected). " | ||
echo "You probably forgot to re-generate the library before pushing." | ||
echo "Please make sure all pre-commit hooks are properly installed to prevent this issue." | ||
false; | ||
fi | ||
test: | ||
runs-on: ubuntu-latest | ||
# needs: | ||
# - docker | ||
container: | ||
image: flaport/sax | ||
volumes: | ||
- ${{ github.workspace }}:/github/workspace | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
- name: Test notebooks | ||
run: nbdev_test_nbs | tee nbdev_test_nbs.log | ||
- name: Expose 'nbdev_test_nbs.log' as artifact | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: nbdev_test_nbs.log | ||
path: /github/workspace/nbdev_test_nbs.log | ||
|
||
run: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- clean | ||
- diff | ||
# - docker | ||
container: | ||
image: flaport/sax | ||
volumes: | ||
- ${{ github.workspace }}:/github/workspace | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
- name: Run notebooks | ||
run: find . -name "*.ipynb" | grep -v ipynb_checkpoints | xargs -I {} papermill -k python3 {} {} | ||
- name: Expose 'nbs' as artifact | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: nbs | ||
path: /github/workspace/nbs | ||
- name: Expose 'examples' as artifact | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: examples | ||
path: /github/workspace/examples | ||
- name: Expose 'index.ipynb' as artifact | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: index.ipynb | ||
path: /github/workspace/index.ipynb | ||
|
||
docs: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- run | ||
container: | ||
image: flaport/sax | ||
volumes: | ||
- ${{ github.workspace }}:/github/workspace | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
- name: Download 'nbs' artifact | ||
uses: actions/download-artifact@master | ||
with: | ||
name: nbs | ||
path: ./nbs | ||
- name: Download 'examples' artifact | ||
uses: actions/download-artifact@master | ||
with: | ||
name: examples | ||
path: ./examples | ||
- name: Download 'index.ipynb' artifact | ||
uses: actions/download-artifact@master | ||
with: | ||
name: index.ipynb | ||
path: ./index.ipynb | ||
- name: Build docs | ||
run: nbdev_build_docs | ||
- name: Store artifacts | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: docs | ||
path: /github/workspace/docs | ||
|
||
pages: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- docs | ||
container: | ||
image: flaport/sax | ||
volumes: | ||
- ${{ github.workspace }}:/github/workspace | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
- name: Download 'docs' artifact | ||
uses: actions/download-artifact@master | ||
with: | ||
name: docs | ||
path: /github/workspace/docs | ||
- name: Deploy | ||
uses: JamesIves/github-pages-deploy-action@4.1.7 | ||
with: | ||
branch: pages | ||
folder: docs |
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
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