From 25f65192fd3c67d1cf6993f0f678f0c8e06b2f14 Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Wed, 5 Oct 2022 00:17:08 +0800 Subject: [PATCH] moved build scripts to csst_cicd --- pipelines/build-in-jenkins.sh | 3 - pipelines/build.sh | 106 ---------------------------------- pipelines/test_codestyle.py | 22 ------- 3 files changed, 131 deletions(-) delete mode 100644 pipelines/build-in-jenkins.sh delete mode 100644 pipelines/build.sh delete mode 100644 pipelines/test_codestyle.py diff --git a/pipelines/build-in-jenkins.sh b/pipelines/build-in-jenkins.sh deleted file mode 100644 index 9442008..0000000 --- a/pipelines/build-in-jenkins.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -source "$HOME"/anaconda3/bin/activate -bash -c "$(curl -fsSL https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto/-/raw/main/pipelines/build.sh)" \ No newline at end of file diff --git a/pipelines/build.sh b/pipelines/build.sh deleted file mode 100644 index a60a63f..0000000 --- a/pipelines/build.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash -echo "===================== prepare for installation =====================" -# show where I am -echo " > whoami" -whoami -echo " > uname -a" -uname -a -echo " > pwd" -pwd -echo " > ls -a" -ls -a - -# define environment variables -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/" -export AUX_DIR="/nfsdata/users/csstpipeline/L1Pipeline/unittests/" - -# show Python environment -echo " > which python" -which python -echo " > which pip" -which pip -echo " > python --version" -python --version - -echo "===================== uninstall package =====================" -pip uninstall -y "$JOB_NAME" - -echo "===================== install requirements =====================" -if [ -f "requirements.txt" ]; then - pip install -r requirements.txt - status_install_requirements=$? -else - status_install_requirements=0 -fi - -echo "===================== install package =====================" -#if [ -f "install_local.sh" ]; then -# sh install_local.sh -#else - # default install script -#python setup.py install -rm -rf dist -python setup.py build_ext --inplace -python setup.py sdist -pip install dist/*.tar.gz --force-reinstall --no-deps -status_install=$? -#fi - -echo "===================== show package info =====================" -echo " > pip show $JOB_NAME" -pip show $JOB_NAME - -if [ "$JOB_NAME" != "csst_proto" ]; then - echo "===================== download code style tests =====================" - curl -O https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto/-/raw/main/pipelines/test_codestyle.py -fi -coverage run -m pytest --import-mode=importlib -status_unittest=$? - -echo "===================== make coverage =====================" -coverage report -coverage html -zip -q -r htmlcov.zip htmlcov - -echo "===================== importability =====================" -if [ "$JOB_NAME" != "csst_common" ]; then - echo " > try 'from $JOB_NAME.top_level_interface import *'" - python -c "from $JOB_NAME.top_level_interface import *" - status_import=$? - if [ "$status_import" != 0 ]; then - echo "Import failed!" - else - echo "Import done!" - fi -else - status_import=0 -fi - -# the exit value is determined from unit tests -if [ "$status_install_requirements" != 0 ] \ - || [ "$status_install" != 0 ] \ - || [ "$status_import" != 0 ] \ - || [ "$status_unittest" != 0 ]; then - echo "===================== TEST SUMMARY =====================" - echo "Test failed!" - echo "Install requirements: $status_install_requirements" - echo "Install package: $status_install" - echo "Importability status: $status_import" - echo "Unit test status: $status_unittest" - echo "===================== POST BUILD BELOW =====================" - exit 1 -else - echo "===================== TEST SUMMARY =====================" - echo "Test passed!" - echo "Install requirements: $status_install_requirements" - echo "Install package: $status_install" - echo "Importability status: $status_import" - echo "Unit test status: $status_unittest" - echo "===================== POST BUILD BELOW =====================" - exit 0 -fi - -# In Jenkins: -#!/bin/bash -#sh -c "$(curl -fsSL https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto/-/raw/main/pipelines/build.sh)" \ No newline at end of file diff --git a/pipelines/test_codestyle.py b/pipelines/test_codestyle.py deleted file mode 100644 index c99de83..0000000 --- a/pipelines/test_codestyle.py +++ /dev/null @@ -1,22 +0,0 @@ -import glob -import unittest -import pycodestyle - - -class TestCodeFormat(unittest.TestCase): - - def test_codestyle_conformance(self): - """Test that we conform to PEP-8.""" - style = pycodestyle.StyleGuide( - quiet=True, ignore=["E121", "E123", "E126", "E226", "E24", "E704", "W503", "W504", "E501", "E722"]) - result = style.check_files(glob.glob("./**/*.py")) - print("================ pycodestyle statistics ================") - if result.total_errors == 0: - print("Your code style is GREAT!") - else: - for line in result.get_statistics(): - print(line) - print("*** Please use the command below to check code yourself!!! ***") - print("pycodestyle ./**/*.py --ignore=E121,E123,E126,E226,E24,E704,W503,W504,E501,E722") - print("========================================================") - self.assertEqual(result.total_errors, 0, "Found code style errors (and warnings).") -- GitLab