This is an automated email from the ASF dual-hosted git repository. mssun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git
commit 2c87361f595c6eab7a7b4e8a4c33ea6aeb8c479b Author: Mingshen Sun <[email protected]> AuthorDate: Mon Jun 8 18:08:50 2020 -0700 Add python format checker (yapf) to the build pipeline --- .drone.yml | 60 ++++++++++++------------ cmake/UtilTargets.cmake | 25 ++++++++-- docker/build.ubuntu-1804.sgx-2.9.1.Dockerfile | 2 +- docker/build.ubuntu-1804.sgx-dcap-1.6.Dockerfile | 2 +- 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/.drone.yml b/.drone.yml index 679c23c..968da46 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,24 +3,24 @@ name: sgx-debug-ubuntu-1804 steps: - name: prepare - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - . /opt/sgxsdk/environment - mkdir -p build - cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DTEST_MODE=ON .. - name: check - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make check - name: compile - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make VERBOSE=1 -j2 - name: test - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 environment: AS_ALGO: sgx_epid AS_URL: https://api.trustedservices.intel.com:443 @@ -56,26 +56,26 @@ name: sgx-dcap-debug-ubuntu-1804 steps: - name: prepare - image: teaclave/teaclave-build-ubuntu-1804-sgx-dcap-1.6:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-dcap-1.6:0.1.1 commands: - . /root/.cargo/env - . /opt/sgxsdk/environment - mkdir -p build - cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DTEST_MODE=ON -DDCAP=ON .. - name: check - image: teaclave/teaclave-build-ubuntu-1804-sgx-dcap-1.6:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-dcap-1.6:0.1.1 commands: - . /root/.cargo/env - cd build && make check - name: compile - image: teaclave/teaclave-build-ubuntu-1804-sgx-dcap-1.6:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-dcap-1.6:0.1.1 commands: - . /root/.cargo/env - . /opt/sgxsdk/environment - sed -i 's/ias_root_ca_cert/dcap_root_ca_cert/' config/build.config.toml - cd build && make VERBOSE=1 -j2 - name: test - image: teaclave/teaclave-build-ubuntu-1804-sgx-dcap-1.6:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-dcap-1.6:0.1.1 environment: AS_ALGO: sgx_ecdsa AS_URL: https://localhost:8080 @@ -123,24 +123,24 @@ name: sgx-release-ubuntu-1804 steps: - name: prepare - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - . /opt/sgxsdk/environment - mkdir -p build - cd build && cmake -DCMAKE_BUILD_TYPE=Release -DTEST_MODE=OFF .. - name: check - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make check - name: compile - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make VERBOSE=1 -j2 - name: test - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 privileged: true environment: AS_ALGO: sgx_epid @@ -176,24 +176,24 @@ name: sim-debug-ubuntu-1804 steps: - name: prepare - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - . /opt/sgxsdk/environment - mkdir -p build - cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DSGX_SIM_MODE=ON -DTEST_MODE=ON .. - name: check - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make check - name: compile - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make VERBOSE=1 -j2 - name: test - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 environment: AS_ALGO: sgx_epid AS_URL: https://api.trustedservices.intel.com:443 @@ -215,24 +215,24 @@ name: sim-release-ubuntu-1804 steps: - name: prepare - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - . /opt/sgxsdk/environment - mkdir -p build - cd build && cmake -DCMAKE_BUILD_TYPE=Release -DSGX_SIM_MODE=ON -DTEST_MODE=OFF .. - name: check - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make check - name: compile - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make VERBOSE=1 -j2 - name: test - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make run-examples @@ -413,19 +413,19 @@ name: lint steps: - name: prepare - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - . /opt/sgxsdk/environment - mkdir -p build - cd build && cmake -DRUSTFLAGS="-D warnings" -DTEST_MODE=ON .. - name: check - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make check - name: clippy - image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 + image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 commands: - . /root/.cargo/env - cd build && make CLP=1 @@ -440,24 +440,24 @@ node: # steps: # - name: prepare -# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 +# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 # commands: # - . /root/.cargo/env # - mkdir -p build # - cd build && cmake -DCMAKE_BUILD_TYPE=DEBUG -DCOV=ON -DTEST_MODE=ON .. # - name: check -# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 +# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 # commands: # - . /root/.cargo/env # - cd build && make check # - name: compile -# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 +# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 # commands: # - . /root/.cargo/env # - export RUSTFLAGS="-D warnings" # - cd build && make VERBOSE=1 -j2 # - name: test -# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 +# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 # environment: # AS_ALGO: sgx_epid # AS_URL: https://api.trustedservices.intel.com:443 @@ -476,7 +476,7 @@ node: # - cd build && make run-tests # - name: coverage # failure: ignore -# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 +# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 # commands: # - cd build && make cov # - bash -c "bash <(curl -s https://codecov.io/bash) -f intermediate/cov.info" @@ -508,13 +508,13 @@ node: # steps: # - name: prepare -# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 +# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 # commands: # - . /root/.cargo/env # - mkdir -p build # - cd build && cmake .. # - name: doc -# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.0 +# image: teaclave/teaclave-build-ubuntu-1804-sgx-2.9.1:0.1.1 # failure: ignore # commands: # - . /root/.cargo/env diff --git a/cmake/UtilTargets.cmake b/cmake/UtilTargets.cmake index 5de4258..e5e1ae3 100644 --- a/cmake/UtilTargets.cmake +++ b/cmake/UtilTargets.cmake @@ -9,11 +9,19 @@ add_custom_target( format COMMAND rustup component add rustfmt --toolchain ${RUSTUP_TOOLCHAIN} COMMAND - RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN} find ${TEACLAVE_PROJECT_ROOT} -path - ${TEACLAVE_PROJECT_ROOT}/third_party -prune -o -path - ${TEACLAVE_PROJECT_ROOT}/.git -prune -o -path ${TEACLAVE_BUILD_ROOT} -prune + RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN} find ${TEACLAVE_PROJECT_ROOT} + -path ${TEACLAVE_PROJECT_ROOT}/third_party -prune -o + -path ${TEACLAVE_PROJECT_ROOT}/.git -prune -o + -path ${TEACLAVE_BUILD_ROOT} -prune -o -name "*.rs" -exec rustfmt {} + - COMMENT "Formating every .rs file" + COMMAND + find ${TEACLAVE_PROJECT_ROOT} + -path ${TEACLAVE_PROJECT_ROOT}/third_party -prune -o + -path ${TEACLAVE_PROJECT_ROOT}/.git -prune -o + -path ${TEACLAVE_PROJECT_ROOT}/services/access_control -prune -o + -path ${TEACLAVE_BUILD_ROOT} -prune + -o -name "*.py" -exec yapf -i {} + + COMMENT "Formating every .rs and .py file with rustfmt and yapf" DEPENDS prep) add_custom_target( @@ -24,7 +32,14 @@ add_custom_target( ${TEACLAVE_PROJECT_ROOT}/third_party -prune -o -path ${TEACLAVE_PROJECT_ROOT}/.git -prune -o -path ${TEACLAVE_BUILD_ROOT} -prune -o -name "*.rs" -exec rustfmt --check {} + - COMMENT "Checking the format of every .rs file" + COMMAND + find ${TEACLAVE_PROJECT_ROOT} + -path ${TEACLAVE_PROJECT_ROOT}/third_party -prune -o + -path ${TEACLAVE_PROJECT_ROOT}/.git -prune -o + -path ${TEACLAVE_PROJECT_ROOT}/services/access_control -prune -o + -path ${TEACLAVE_BUILD_ROOT} -prune + -o -name "*.py" -exec yapf -d {} + + COMMENT "Checking the format of every .rs and .py file with rustfmt and yapf" DEPENDS prep) if(TEST_MODE) diff --git a/docker/build.ubuntu-1804.sgx-2.9.1.Dockerfile b/docker/build.ubuntu-1804.sgx-2.9.1.Dockerfile index 74d5893..f9a6266 100644 --- a/docker/build.ubuntu-1804.sgx-2.9.1.Dockerfile +++ b/docker/build.ubuntu-1804.sgx-2.9.1.Dockerfile @@ -78,7 +78,7 @@ RUN apt-get update && apt-get install -q -y \ curl \ python3-pip -RUN pip3 install pyopenssl toml cryptography +RUN pip3 install pyopenssl toml cryptography yapf # clean up apt caches diff --git a/docker/build.ubuntu-1804.sgx-dcap-1.6.Dockerfile b/docker/build.ubuntu-1804.sgx-dcap-1.6.Dockerfile index 10eb982..e7c0c4e 100644 --- a/docker/build.ubuntu-1804.sgx-dcap-1.6.Dockerfile +++ b/docker/build.ubuntu-1804.sgx-dcap-1.6.Dockerfile @@ -81,7 +81,7 @@ RUN apt-get update && apt-get install -q -y \ iproute2 \ python3-pip -RUN pip3 install pyopenssl toml cryptography +RUN pip3 install pyopenssl toml cryptography yapf # clean up apt caches --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
