-
Notifications
You must be signed in to change notification settings - Fork 87
105 lines (86 loc) · 3.07 KB
/
pr-checks.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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/