-
Notifications
You must be signed in to change notification settings - Fork 17
310 lines (264 loc) · 9.4 KB
/
rogue_ci.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# ----------------------------------------------------------------------------
# Title : ROGUE GitHub Actions Script
# ----------------------------------------------------------------------------
# This file is part of the rogue software package. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the rogue software package, including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
# ----------------------------------------------------------------------------
# The following environment variables are required for this process:
# secrets.GH_TOKEN
# secrets.CONDA_UPLOAD_TOKEN_TAG
# secrets.DOCKERHUB_TOKEN
name: Rogue Integration
on: [push]
jobs:
full_build_test:
name: Full Build Test
runs-on: ubuntu-20.04
env:
EPICS_BASE: /home/runner/packages/epics/base-7.0.7
EPICS_PCAS_ROOT: /home/runner/packages/pcas/pcas-4.13.3
steps:
# This step checks out a copy of your repository.
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'pip'
cache-dependency-path: 'pip_requirements.txt'
- name: Setup Environment
run: |
LD_LIBRARY_PATH=/usr/lib:${EPICS_BASE}/lib/linux-x86_64:${EPICS_PCAS_ROOT}/lib/linux-x86_64
PATH=${EPICS_BASE}/bin/linux-x86_64:${PATH}
echo "EPICS_BASE=$EPICS_BASE" >> $GITHUB_ENV
echo "EPICS_PCAS_ROOT=$EPICS_PCAS_ROOT" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install doxygen doxygen-doc libzmq3-dev libboost-all-dev
pip install -r pip_requirements.txt
# Flake 8 check
- name: Flake8 Tests
run: |
python -m compileall -f ./python/
flake8 --count ./python/
python -m compileall -f ./tests
flake8 --count ./tests/
- name: Cache EPICS
uses: actions/cache@v3
id: epics-cache
with:
key: epics
path: |
${{ env.EPICS_BASE }}/
${{ env.EPICS_PCAS_ROOT }}/
- if: ${{ steps.epics-cache.outputs.cache-hit != 'true' }}
name: Install EPICS Base
run: |
mkdir -p ${EPICS_BASE}
cd ${EPICS_BASE}
pwd
wget -O base-7.0.7.tar.gz https://github.com/epics-base/epics-base/archive/R7.0.7.tar.gz
tar xzf base-7.0.7.tar.gz --strip 1
make clean && make && make install
- if: ${{ steps.epics-cache.outputs.cache-hit != 'true' }}
name: Install EPICS PCAS
run: |
mkdir -p ${EPICS_PCAS_ROOT}
cd ${EPICS_PCAS_ROOT}
wget -O pcas-4.13.3.tar.gz https://github.com/epics-modules/pcas/archive/v4.13.3.tar.gz
tar xzf pcas-4.13.3.tar.gz --strip 1
echo "EPICS_BASE=$EPICS_BASE" >> configure/RELEASE.local
make clean && make && make install
# Rogue
- name: Build Rogue
run: |
python -c "import numpy; print(numpy.get_include())"
mkdir build; cd build
cmake .. -DROGUE_INSTALL=local -DDO_EPICS=1
make -j4 install
# Run Tests
- name: Rogue Tests
run: |
source setup_rogue.sh
python -m pytest --cov
# # Run test_rate.py
# # - name: Get test_rate.py output
# # uses: mathiasvr/command-output@v1
# # id: rates
# # with:
# # run: |
# # source setup rogue.sh
# # python -m test_rate.py
# Code Coverage
- name: Code Coverage
run: |
source setup_rogue.sh
codecov
coverage report -m
# Generate Documentation
- name: Generate Documentation
if: startsWith(github.ref, 'refs/tags/')
run: |
source setup_rogue.sh
cd docs
make html
- name: Deploy Documentation
if: startsWith(github.ref, 'refs/tags/')
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_TOKEN }}
publish_dir: docs/build/html
# # Set up for Comment PR
# - name: Checkout
# uses: actions/checkout@v3
# # Comment on PR
# - name: Comment PR
# uses: thollander/actions-comment-pull-request@v1
# with:
# message: |
# Rates -
# ${{steps.rates.outputs.stdout}}
# github_token: ${{ secrets.GITHUB_TOKEN }}
small_build_test:
name: Small Build Test
runs-on: ubuntu-20.04
steps:
# This step checks out a copy of your repository.
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libzmq3-dev
# Rogue
- name: Build Rogue
run: |
mkdir build; cd build
cmake .. -DROGUE_INSTALL=local -DNO_PYTHON=1 -DSTATIC_LIB=1
make -j4 install
gen_release:
name: Generate Release
runs-on: ubuntu-20.04
needs: [full_build_test, small_build_test]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Get Image Information
id: get_image_info
run: |
echo ::set-output name=tag::`git describe --tags`
- name: Get Ruckus
run: |
git clone https://github.com/slaclab/ruckus.git
python -m pip install --upgrade pip
pip install -r ruckus/scripts/pip_requirements.txt
- name: Gen Release
env:
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_TAG: ${{ steps.get_image_info.outputs.tag }}
GH_REPO_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
python ruckus/scripts/releaseGen.py
conda_build:
name: Anaconda Build
needs: [full_build_test, small_build_test]
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os:
- ubuntu-20.04
src:
- conda-recipe
runs-on: ${{ matrix.os }}
steps:
# This step checks out a copy of your repository.
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Setup anaconda
env:
OS_NAME: ${{ matrix.os }}
run: |
cd ${HOME}
wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash miniconda.sh -b -p ${HOME}/miniconda
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
conda config --set always_yes yes
conda config --set channel_priority strict
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
conda install conda-build anaconda-client conda-verify
conda update -q conda conda-build
conda update --all
- name: Get Image Information
id: get_image_info
env:
CONDA_UPLOAD_TOKEN_TAG: ${{ secrets.CONDA_UPLOAD_TOKEN_TAG }}
OS_NAME: ${{ matrix.os }}
run: |
echo ::set-output name=token::$CONDA_UPLOAD_TOKEN_TAG
echo ::set-output name=os::linux-64
- name: Build
env:
CONDA_SRC: ${{ matrix.src }}
run: |
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
conda build $CONDA_SRC --output-folder bld-dir -c tidair-packages -c conda-forge
- name: Upload
run: |
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
anaconda -t ${{ steps.get_image_info.outputs.token }} upload --force bld-dir/${{ steps.get_image_info.outputs.os }}/*.tar.bz2
docker_build:
name: Docker Build
runs-on: ubuntu-20.04
needs: [full_build_test, small_build_test]
if: startsWith(github.ref, 'refs/tags/')
steps:
# This step checks out a copy of your repository.
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Image Information
id: get_image_info
run: |
echo ::set-output name=tag::`git describe --tags`
echo ::set-output name=branch::`echo ${GITHUB_REF} | awk 'BEGIN { FS = "/" } ; { print $3 }'`
# Setup docker build environment
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Login to Dockerhub
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: tidair
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build and push the docker image
- name: Build and push image to Dockerhub
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: tidair/rogue:${{ steps.get_image_info.outputs.tag }}, tidair/rogue:latest
build-args: branch=${{ steps.get_image_info.outputs.branch }}