forked from bluecheetah/pybag
-
Notifications
You must be signed in to change notification settings - Fork 3
157 lines (154 loc) · 4.56 KB
/
pr.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
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
155
156
157
# CI flow
name: pybag-pr-ci
on:
push:
schedule:
- cron: '0 9 * * *' # 9AM UTC = 2AM PST
env:
CONDA_ENV_NAME: bag_py3d7_c
jobs:
build:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash -el {0}
continue-on-error: true
outputs:
pytestOutput: ${{ steps.unit-tests.outputs.test }}
strategy:
matrix:
python-version: ["3.7"]
steps:
- name: Install packages
run: |
sudo apt update
sudo apt -y install \
autoconf \
curl \
gcc-8 \
g++-8 \
git \
libtool \
libltdl-dev \
pkg-config \
make \
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup conda
uses: conda-incubator/[email protected]
with:
activate-environment: ${{ env.CONDA_ENV_NAME }}
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Save Conda Env
# Workaround, this isn't working otherwise.
run: |
echo "CONDA=$CONDA"
echo "CONDA=$CONDA" >> "$GITHUB_ENV"
- name: Cache Conda env
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs/${{ env.CONDA_ENV_NAME }}
key:
conda-${{ runner.os }}--${{ runner.arch }}--${{
steps.get-date.outputs.today }}-${{
hashFiles('environment.yml') }}-${{
env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
id: cache-conda
- name: Update conda environment
run: |
echo "CONDA=$CONDA"
conda env update -n ${{ env.CONDA_ENV_NAME }} -f environment.yml
if: steps.cache-conda.outputs.cache-hit != 'true'
- name: Install additional dependencies
if: steps.cache-conda.outputs.cache-hit != 'true'
run: |
cd setup
mkdir install
cp setup_script.sh install/
cp render_template.py install/
cp project-config.template install/
cd install
./setup_script.sh
cd ../../
- name: Build cbag and pybag
id: cpp-build
run: |
export PYBAG_PYTHON=python
echo "PYBAG_PYTHON=$PYBAG_PYTHON"
./run_test.sh
- name: Cache pybag build
uses: actions/cache@v3
with:
path: _build
key:
build-${{ runner.os }}--${{ runner.arch }}--${{
steps.get-date.outputs.today }}-${{
env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
id: cache-pybag
test:
needs: build
runs-on: ubuntu-20.04
defaults:
run:
shell: bash -el {0}
continue-on-error: true
outputs:
pytestOutput: ${{ steps.unit-tests.outputs.test }}
strategy:
matrix:
python-version: ["3.7"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup conda
uses: conda-incubator/[email protected]
with:
activate-environment: bag_py3d7_c
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Save Conda Env
# Workaround, this isn't working otherwise.
run: |
echo "CONDA=$CONDA"
echo "CONDA=$CONDA" >> "$GITHUB_ENV"
- name: Cache Conda env
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs/${{ env.CONDA_ENV_NAME }}
key:
conda-${{ runner.os }}--${{ runner.arch }}--${{
steps.get-date.outputs.today }}-${{
hashFiles('environment.yml') }}-${{
env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
id: cache-conda
- name: Cache pybag build
uses: actions/cache@v3
with:
path: _build
key:
build-${{ runner.os }}--${{ runner.arch }}--${{
steps.get-date.outputs.today }}-${{
env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
id: cache-pybag
- name: Run test
id: run-pytest
run: |
which pytest
pytest tests -v