Skip to content

Commit

Permalink
Add CI jobs to build documentation (#1876)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvesely authored Jan 14, 2021
2 parents 3770ef4 + 6086dda commit d981a64
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 34 deletions.
18 changes: 18 additions & 0 deletions .github/actions/cleanup-pip-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Cleanup pip wheels cache'
description: 'Purge pip wheels cache, keeping wheels for the installed pacakges'

runs:
using: "composite"
steps:
- name: "Cleanup old wheels"
shell: bash
run: |
pip cache info
INSTALLED=`pip list | sed 's/-/_/g' | sed 's/ */-/' | tail -n+3`
CACHED=`pip cache list | cut -f 2,3 -d- | tail -n+3`
for P in $CACHED; do
# Remove cached and not installed
if [ `echo $INSTALLED | grep -o $P | wc -l` == "0" ] ; then
pip cache remove -v $P
fi
done
78 changes: 78 additions & 0 deletions .github/workflows/pnl-ci-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: PsyNeuLink Docs CI

on: push

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7] # Doesn't work in 3.8 or 3.9
python-architecture: ['x64']
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 10

- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-architecture }}

- name: Get pip cache location
shell: bash
id: pip_cache
run: |
python -m pip install -U pip
python -m pip --version
echo ::set-output name=pip_cache_dir::$(python -m pip cache dir)
- name: Wheels cache
uses: actions/[email protected]
with:
path: ${{ steps.pip_cache.outputs.pip_cache_dir }}/wheels
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }}
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2

- name: MacOS dependencies
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install graphviz
if: startsWith(runner.os, 'macOS')

- name: Linux dependencies
run: sudo apt-get install -y graphviz
if: startsWith(runner.os, 'Linux')

- name: Windows dependencies
run: choco install --no-progress -y graphviz --version=2.38.0.20190211
if: startsWith(runner.os, 'Windows')

- name: Shared dependencies
shell: bash
run: |
# explicitly install numpy (https://github.com/pypa/pip/issues/9239)
python -m pip install --upgrade pip wheel $(grep numpy requirements.txt)
pip install -e .[doc]
- name: Windows pytorch
shell: bash
run: |
pip install $(grep -o 'torch[0-9<=\.]*' requirements.txt) -f https://download.pytorch.org/whl/cpu/torch_stable.html
if: startsWith(runner.os, 'Windows') && matrix.python-architecture != 'x86'

- name: Cleanup old wheels
uses: ./.github/actions/cleanup-pip-cache

- name: Build Documentation
run: sphinx-build -b html -aE docs/source pnl-html

- name: Upload Documentation
uses: actions/[email protected]
with:
name: Documentation-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.python-architecture }}
retention-days: 1
path: pnl-html
50 changes: 16 additions & 34 deletions .github/workflows/pnl-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,32 @@ jobs:
os: windows-latest

steps:
- uses: actions/checkout@v2
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 10

- name: Linux wheels cache
uses: actions/[email protected]
if: startsWith(runner.os, 'Linux')
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
path: ~/.cache/pip/wheels
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }}
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-architecture }}

- name: MacOS wheels cache
uses: actions/[email protected]
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip/wheels
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }}
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2
- name: Get pip cache location
shell: bash
id: pip_cache
run: |
python -m pip install -U pip
python -m pip --version
echo ::set-output name=pip_cache_dir::$(python -m pip cache dir)
- name: Windows wheels cache
- name: Wheels cache
uses: actions/[email protected]
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache\wheels
path: ${{ steps.pip_cache.outputs.pip_cache_dir }}/wheels
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }}
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-architecture }}

- name: MacOS dependencies
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install graphviz
if: startsWith(runner.os, 'macOS')
Expand All @@ -86,17 +78,7 @@ jobs:
if: startsWith(runner.os, 'Windows') && matrix.python-architecture != 'x86'

- name: Cleanup old wheels
shell: bash
run: |
pip cache info
INSTALLED=`pip list | sed 's/-/_/g' | sed 's/ */-/' | tail -n+3`
CACHED=`pip cache list | cut -f 2,3 -d- | tail -n+3`
for P in $CACHED; do
# Remove cached and not installed
if [ `echo $INSTALLED | grep -o $P | wc -l` == "0" ] ; then
pip cache remove -v $P
fi
done
uses: ./.github/actions/cleanup-pip-cache

- name: Lint with flake8
shell: bash
Expand Down

0 comments on commit d981a64

Please sign in to comment.