build.sh 1.53 KB
Newer Older
BO ZHANG's avatar
BO ZHANG committed
1
2
3
4
5
6
7
#!/bin/bash
echo "===================== prepare for installation ====================="
whoami
uname -a
pwd
ls -a

BO ZHANG's avatar
BO ZHANG committed
8
# define environment variables
BO ZHANG's avatar
BO ZHANG committed
9
10
export CSST_SIMS_C3="/nfsdata/share/csst_simulation_data/Cycle-3-SimuData/"
export CSST_SIMS_C5_2="/nfsdata/share/csst_simulation_data/Cycle-5-SimuData/"
BO ZHANG's avatar
BO ZHANG committed
11
export AUX_DIR="/nfsdata/users/csstpipeline/L1Pipeline/unittests/"
BO ZHANG's avatar
BO ZHANG committed
12

BO ZHANG's avatar
tweaks    
BO ZHANG committed
13
echo "Python executor and version"
BO ZHANG's avatar
BO ZHANG committed
14
15
16
17
18
19
20
21
22
23
24
which python
which pip
python --version

echo "===================== isntall requirements ====================="
pip install -r requirements.txt

echo "===================== install package ====================="
sh install_local.sh

echo "===================== show package info ====================="
BO ZHANG's avatar
BO ZHANG committed
25
pip show $JOB_NAME
BO ZHANG's avatar
BO ZHANG committed
26

BO ZHANG's avatar
BO ZHANG committed
27
if [ "$JOB_NAME" != "csst_proto" ]; then
BO ZHANG's avatar
tweaks    
BO ZHANG committed
28
  echo "===================== download code style tests ====================="
29
30
  curl -O https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto/-/raw/main/pipelines/test_codestyle.py
fi
BO ZHANG's avatar
BO ZHANG committed
31
coverage run -m pytest
BO ZHANG's avatar
BO ZHANG committed
32
unittest_status=$?
BO ZHANG's avatar
BO ZHANG committed
33
34
35
36
37
38
39

echo "===================== make coverage ====================="
coverage report
coverage html
# zip -q -r htmlcov.zip htmlcov

echo "===================== importability ====================="
BO ZHANG's avatar
BO ZHANG committed
40
python -c "from $JOB_NAME.top_level_interface import *"
BO ZHANG's avatar
BO ZHANG committed
41
42

echo "===================== POST BUILD BELOW ====================="
BO ZHANG's avatar
BO ZHANG committed
43
44
45
46
47
48
49
50

# the exit value is determined from unit tests
if [ "$unittest_status" != 0 ]; then
  exit $unittest_status
else
  exit 0
fi

BO ZHANG's avatar
BO ZHANG committed
51
52
53
# In Jenkins:
#!/bin/bash
#sh -c "$(curl -fsSL https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto/-/raw/main/pipelines/build.sh)"