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

BO ZHANG's avatar
BO ZHANG committed
12
# define environment variables
BO ZHANG's avatar
BO ZHANG committed
13
14
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
15
export AUX_DIR="/nfsdata/users/csstpipeline/L1Pipeline/unittests/"
BO ZHANG's avatar
BO ZHANG committed
16

BO ZHANG's avatar
BO ZHANG committed
17
echo " > which python"
BO ZHANG's avatar
BO ZHANG committed
18
which python
BO ZHANG's avatar
BO ZHANG committed
19
echo " > which pip"
BO ZHANG's avatar
BO ZHANG committed
20
which pip
BO ZHANG's avatar
BO ZHANG committed
21
echo " > python --version"
BO ZHANG's avatar
BO ZHANG committed
22
23
24
25
26
27
28
29
30
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
31
pip show $JOB_NAME
BO ZHANG's avatar
BO ZHANG committed
32

BO ZHANG's avatar
BO ZHANG committed
33
if [ "$JOB_NAME" != "csst_proto" ]; then
BO ZHANG's avatar
tweaks    
BO ZHANG committed
34
  echo "===================== download code style tests ====================="
35
36
  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
37
coverage run -m pytest
BO ZHANG's avatar
BO ZHANG committed
38
unittest_status=$?
BO ZHANG's avatar
BO ZHANG committed
39
40
41
42
43
44
45

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

echo "===================== importability ====================="
BO ZHANG's avatar
BO ZHANG committed
46
python -c "from $JOB_NAME.top_level_interface import *"
BO ZHANG's avatar
BO ZHANG committed
47
48

echo "===================== POST BUILD BELOW ====================="
BO ZHANG's avatar
BO ZHANG committed
49
50
51
52
53
54
55
56

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