build.sh 1.65 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
echo " > pip show $JOB_NAME"
BO ZHANG's avatar
BO ZHANG committed
32
pip show $JOB_NAME
BO ZHANG's avatar
BO ZHANG committed
33

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

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

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

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

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