build.sh 1.49 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
13
14
15
16
17
18
19
20
21
22
23

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
24
pip show $JOB_NAME
BO ZHANG's avatar
BO ZHANG committed
25

BO ZHANG's avatar
BO ZHANG committed
26
if [ "$JOB_NAME" != "csst_proto" ]; then
BO ZHANG's avatar
tweaks    
BO ZHANG committed
27
  echo "===================== download code style tests ====================="
28
29
  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
30
coverage run -m pytest
BO ZHANG's avatar
BO ZHANG committed
31
unittest_status=$?
BO ZHANG's avatar
BO ZHANG committed
32
33
34
35
36
37
38

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

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

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

# 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
50
51
52
# In Jenkins:
#!/bin/bash
#sh -c "$(curl -fsSL https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto/-/raw/main/pipelines/build.sh)"