-
Notifications
You must be signed in to change notification settings - Fork 31
154 lines (129 loc) · 4.53 KB
/
continuous-integration.yml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: JAX-UniRep CI pipeline
on: [pull_request]
jobs:
# Code style checks
# In principle, these don't rely on the environment.yml,
# and can be run in a bare native Python env instead.
# Doing so gives us speed, so we can quickly uncover code style issues
# instead of having to wait for the environment to be built first.
code-style:
runs-on: ubuntu-18.04
name: Code style checks
steps:
- uses: actions/checkout@v2
name: Checkout repository
- uses: actions/setup-python@v2
name: Setup Python
with:
python-version: 3.9
- name: Install code style checker "black"
run: python -m pip install black
- name: Run black
run: make style
# Build environment
# This can be zipped up and passed to the downstream jobs:
# - run-tests
# - make-docs
# for which we want both to run concurrently to save time.
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
- uses: s-weigand/setup-conda@v1
with:
conda-channels: "conda-forge"
# Build cache of environment -- this can shave minutes off the CI.
- name: Cache conda environment
id: cache-environment
uses: actions/cache@v2
# Conda environment build step depends on just environment.yml,
# so we ensure that the hash key contains its hash.
# If the file changes, then its hash will change,
# and the cache will be invalidated,
# thus triggering a rebuild.
# (There is a strong assumption here that changing `build_environment.sh`
# will not change the environment definition, which it shouldn't.)
with:
path: |
jax-unirep.tar.gz
key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}
- name: Build and pack environment
if: steps.cache-environment.outputs.cache-hit != 'true'
run: bash scripts/ci/build_environment.sh
# See: https://github.com/actions/upload-artifact
- name: Upload environment
uses: actions/upload-artifact@v2
with:
name: jax-unirep-tarball
path: jax-unirep.tar.gz
run-fast-tests:
runs-on: ubuntu-18.04
needs: build-environment
name: Run fast tests
steps:
- uses: actions/checkout@v2
name: Checkout repository
# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/[email protected]
with:
name: jax-unirep-tarball
- name: Unpack environment and activate it
run: bash scripts/ci/unpack_environment.sh
- name: Run fast tests
run: |
source /tmp/jax_unirep_env/bin/activate
make fasttest
bash <(curl -s https://codecov.io/bash) -cF python
# - name: Upload fast-test coverage
# uses: codecov/codecov-action@v1
# with:
# files: ./.coverage
# name: codecov-fast-tests
# fail_ci_if_error: true
run-slow-tests:
runs-on: ubuntu-18.04
needs: build-environment
name: Run slow tests
steps:
- uses: actions/checkout@v2
name: Checkout repository
# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/[email protected]
with:
name: jax-unirep-tarball
- name: Unpack environment and activate it
run: bash scripts/ci/unpack_environment.sh
- name: Run slow tests
run: |
source /tmp/jax_unirep_env/bin/activate
make slowtest
bash <(curl -s https://codecov.io/bash) -cF python
# - name: Upload slow-test coverage
# uses: codecov/codecov-action@v1
# with:
# files: ./.coverage
# name: codecov-slow-tests
# fail_ci_if_error: true
build-docs:
runs-on: ubuntu-18.04
needs: build-environment
name: Build docs
steps:
- uses: actions/checkout@v2
name: Checkout repository
# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/[email protected]
with:
name: jax-unirep-tarball
- name: Unpack environment and activate it
run: bash scripts/ci/unpack_environment.sh
- name: Build Docs
run: |
source /tmp/jax_unirep_env/bin/activate
bash scripts/ci/build_docs.sh