[pre-commit.ci] pre-commit autoupdate #88
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
name: Pull request checks | |
on: [pull_request] | |
jobs: | |
build-environment: | |
runs-on: ubuntu-18.04 | |
name: Build conda environment | |
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 | |
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') }} | |
- 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 | |
unit-tests: | |
name: Run unit tests | |
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: Run tests | |
run: | | |
source /tmp/nxviz/bin/activate | |
python -m pip install -e . | |
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 | |
python -m ipykernel install --user --name nxviz | |
make docs | |
# https://www.bradmcgonigle.com/blog/github-action-for-continuous-deployment | |
# - NETLIFY_SITE_ID maps to the netlify site's API ID | |
# - NETLIFY_AUTH_TOKEN maps to netlify's Personal Access Token that I set on a per-user basis | |
- name: Deploy to Netlify | |
uses: netlify/actions/cli@master | |
with: | |
args: deploy --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_AUTH_TOKEN }} --dir=site/ |