Add python format checker (yapf) to the build pipeline
diff --git a/.drone.yml b/.drone.yml
index 679c23c..968da46 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -3,24 +3,24 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
# 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 @@
# - 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 @@
# 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 @@
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 @@
${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 @@
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 @@
iproute2 \
python3-pip
-RUN pip3 install pyopenssl toml cryptography
+RUN pip3 install pyopenssl toml cryptography yapf
# clean up apt caches