Skip to content

Commit

Permalink
Test-driving improved and shortened docs build script.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmjl committed Dec 30, 2021
1 parent e338a1d commit 2d16aac
Showing 1 changed file with 20 additions and 57 deletions.
77 changes: 20 additions & 57 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,36 @@ on:
- master

jobs:
build-environment:
runs-on: ubuntu-18.04
build-docs:
runs-on: ubuntu-latest
name: Build conda environment

# https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
name: Checkout repository

# See: https://github.com/marketplace/actions/setup-conda
- name: Setup anaconda
uses: s-weigand/setup-conda@v1
# See: https://github.com/marketplace/actions/setup-miniconda
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
conda-channels: "conda-forge"

# Build cache of environment
- name: Cache conda environment
id: cache-environment
uses: actions/cache@v2
with:
path: nxviz.tar.gz
# Note: Remember that whatever files the environment build depends on
# should be hashed and added to the key.
key: ${{ runner.os }}-env.${{ hashFiles('environment.yml') }}
auto-update-conda: true
miniforge-variant: Mambaforge
channels: conda-forge
python-version: 3.9
activate-environment: nxviz
environment-file: environment.yml
use-mamba: true

- name: Build environment
if: steps.cache-environment.outputs.cache-hit != 'true'
run: |
conda env create -f environment.yml
python -m pip install .
- name: Install conda-pack
if: steps.cache-environment.outputs.cache-hit != 'true'
run: conda install -c conda-forge conda-pack

- name: Run conda-pack
if: steps.cache-environment.outputs.cache-hit != 'true'
run: conda pack -n nxviz -o nxviz.tar.gz

# See: https://github.com/actions/upload-artifact
- name: Upload environment
uses: actions/upload-artifact@v2
with:
name: nxviz-tarball
path: nxviz.tar.gz

docs:
name: Build static site docs
runs-on: ubuntu-latest
needs: build-environment

steps:
- name: Checkout repository
uses: actions/checkout@v2

# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/download-artifact@v2
with:
name: nxviz-tarball

- name: Unpack environment and activate it
run: |
bash scripts/ci/unpack_environment.sh
- name: Build docs
run: |
source /tmp/nxviz/bin/activate
conda activate nxviz
python -m ipykernel install --user --name nxviz
python -m pip install .
make docs
- name: Deploy website
Expand Down

0 comments on commit 2d16aac

Please sign in to comment.