Skip to content

Commit 7528755

Browse files
shaojunwangsuperajun-wsj
authored andcommitted
add-github-cicd
1 parent a9b2060 commit 7528755

File tree

4 files changed

+59
-16
lines changed

4 files changed

+59
-16
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Apache Teaclave Java Tee SDK CI
2+
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
3+
on: [push, pull_request, workflow_dispatch]
4+
defaults:
5+
run:
6+
shell: bash
7+
8+
jobs:
9+
Explore-GitHub-Actions:
10+
runs-on: [self-hosted, linux]
11+
steps:
12+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
13+
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
14+
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
15+
- name: Check out repository code
16+
uses: actions/checkout@v3
17+
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
18+
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
19+
- name: List files in the repository
20+
run: ls ${{ github.workspace }}
21+
- name: Build JavaEnclave
22+
run: sudo ${{ github.workspace }}/tools/cicd/make.sh build
23+
- name: Release JavaEnclave
24+
run: sudo ${{ github.workspace }}/tools/cicd/make.sh release
25+
- name: Test JavaEnclave
26+
run: sudo ${{ github.workspace }}/tools/cicd/make.sh test
27+
- name: Run JavaEnclave Samples
28+
run: sudo ${{ github.workspace }}/tools/cicd/make.sh samples
29+
- name: Run JavaEnclave Benchmark
30+
run: sudo ${{ github.workspace }}/tools/cicd/make.sh benchmark
31+
- run: echo "🍏 This job's status is ${{ job.status }}."

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ In essence, it's an SPI mechanism between host and enclave parts.
206206
`MOCK_IN_SVM` mode in Teaclave Java TEE SDK is also a simulated mode, it doesn't need SGX hardware support. Compare with `MOCK_IN_JVM` mode, the enclave submodule
207207
will be compiled into a native image, and the host submodule run in a JVM environment. host part will load, create and invoke service defined in enclave by JNI native call.
208208

209-
### TEE_SDK mode
209+
#### TEE_SDK mode
210210

211211
`TEE_SDK` mode is a hardware mode, it must run on the platform with SGX2 hardware support. Compare with `MOCK_IN_SVM` mode, the enclave submodule also will be compiled into a native image, but it will be loaded and run in sgx enclave environment. The host part will run in a JVM environment, and both the host and enclave module will run in one process.
212212

build.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,29 @@ if [ ! "$STAGE" -o "build" = "$STAGE" ]; then
4040
# Install JavaEnclave archetype
4141
pushd "${WORKDIR}"/archetype && mvn clean install && popd
4242
elif [ ! "$STAGE" -o "test" = "$STAGE" ]; then
43+
mkdir -p /dev/sgx
44+
ln -s /dev/sgx_enclave /dev/sgx/enclave
45+
ln -s /dev/sgx_provision /dev/sgx/provision
4346
# Test unit test cases in JavaEnclave
4447
pushd "${WORKDIR}"/test && ./run.sh && popd
4548
elif [ ! "$STAGE" -o "coverage" = "$STAGE" ]; then
49+
mkdir -p /dev/sgx
50+
ln -s /dev/sgx_enclave /dev/sgx/enclave
51+
ln -s /dev/sgx_provision /dev/sgx/provision
4652
# collect and analysis JavaEnclave ut coverage
4753
pushd "${WORKDIR}"/coverage && ./run.sh "${WORKDIR}"/test && popd
4854
elif [ ! "$STAGE" -o "samples" = "$STAGE" ]; then
55+
mkdir -p /dev/sgx
56+
ln -s /dev/sgx_enclave /dev/sgx/enclave
57+
ln -s /dev/sgx_provision /dev/sgx/provision
4958
# samples in JavaEnclave
5059
pushd "${WORKDIR}"/samples/helloworld && ./run.sh && popd
5160
pushd "${WORKDIR}"/samples/springboot && ./run.sh && popd
5261
elif [ ! "$STAGE" -o "benchmark" = "$STAGE" ]; then
62+
mkdir -p /dev/sgx
63+
ln -s /dev/sgx_enclave /dev/sgx/enclave
64+
ln -s /dev/sgx_provision /dev/sgx/provision
5365
# benchmark in JavaEnclave
5466
pushd "${WORKDIR}"/benchmark/guomi && ./run.sh && popd
5567
pushd "${WORKDIR}"/benchmark/string && ./run.sh && popd
56-
fi
68+
fi

tools/cicd/make.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ function build_javaenclave() {
6262
docker run -i --rm --privileged --network host \
6363
-w "${WORKDIR}" \
6464
-v "${HOME}"/.m2:/root/.m2 -v "${WORKDIR}":"${WORKDIR}" \
65-
-v /dev/sgx_enclave:/dev/sgx/enclave \
66-
-v /dev/sgx_provision:/dev/sgx/provision \
65+
-v /dev/sgx_enclave:/dev/sgx_enclave \
66+
-v /dev/sgx_provision:/dev/sgx_provision \
6767
${BASE_IMAGE}:${BASE_TAG} /bin/bash build.sh $1
6868
}
6969

@@ -87,8 +87,8 @@ function test_javaenclave() {
8787
-w "${WORKDIR}" \
8888
-v "${HOME}"/.m2:/root/.m2 -v "${WORKDIR}":"${WORKDIR}" \
8989
-e PCCS_URL=${PCCS_URL} \
90-
-v /dev/sgx_enclave:/dev/sgx/enclave \
91-
-v /dev/sgx_provision:/dev/sgx/provision \
90+
-v /dev/sgx_enclave:/dev/sgx_enclave \
91+
-v /dev/sgx_provision:/dev/sgx_provision \
9292
${RELEASE_IMAGE}:${RELEASE_TAG} /bin/bash build.sh $1
9393
}
9494

@@ -101,8 +101,8 @@ function collect_javaenclave_coverage() {
101101
-w "${WORKDIR}" \
102102
-v "${HOME}"/.m2:/root/.m2 -v "${WORKDIR}":"${WORKDIR}" \
103103
-e PCCS_URL=${PCCS_URL} \
104-
-v /dev/sgx_enclave:/dev/sgx/enclave \
105-
-v /dev/sgx_provision:/dev/sgx/provision \
104+
-v /dev/sgx_enclave:/dev/sgx_enclave \
105+
-v /dev/sgx_provision:/dev/sgx_provision \
106106
${RELEASE_IMAGE}:${RELEASE_TAG} /bin/bash build.sh $1
107107
}
108108

@@ -115,8 +115,8 @@ function samples_javaenclave() {
115115
-w "${WORKDIR}" \
116116
-v "${HOME}"/.m2:/root/.m2 -v "${WORKDIR}":"${WORKDIR}" \
117117
-e PCCS_URL=${PCCS_URL} \
118-
-v /dev/sgx_enclave:/dev/sgx/enclave \
119-
-v /dev/sgx_provision:/dev/sgx/provision \
118+
-v /dev/sgx_enclave:/dev/sgx_enclave \
119+
-v /dev/sgx_provision:/dev/sgx_provision \
120120
${RELEASE_IMAGE}:${RELEASE_TAG} /bin/bash build.sh $1
121121
}
122122

@@ -129,8 +129,8 @@ function benchmark_javaenclave() {
129129
-w "${WORKDIR}" \
130130
-v "${HOME}"/.m2:/root/.m2 -v "${WORKDIR}":"${WORKDIR}" \
131131
-e PCCS_URL=${PCCS_URL} \
132-
-v /dev/sgx_enclave:/dev/sgx/enclave \
133-
-v /dev/sgx_provision:/dev/sgx/provision \
132+
-v /dev/sgx_enclave:/dev/sgx_enclave \
133+
-v /dev/sgx_provision:/dev/sgx_provision \
134134
${RELEASE_IMAGE}:${RELEASE_TAG} /bin/bash build.sh $1
135135
}
136136

@@ -172,8 +172,8 @@ function develop_javaenclave() {
172172
-w "${WORKDIR}" \
173173
-v "${HOME}"/.m2:/root/.m2 -v "${WORKDIR}":"${WORKDIR}" \
174174
-e PCCS_URL=${PCCS_URL} \
175-
-v /dev/sgx_enclave:/dev/sgx/enclave \
176-
-v /dev/sgx_provision:/dev/sgx/provision \
175+
-v /dev/sgx_enclave:/dev/sgx_enclave \
176+
-v /dev/sgx_provision:/dev/sgx_provision \
177177
${BASE_IMAGE}:${BASE_TAG} /bin/bash
178178
}
179179

@@ -185,8 +185,8 @@ function develop_application() {
185185
-w "${WORKDIR}" \
186186
-v "${HOME}"/.m2:/root/.m2 -v "${WORKDIR}":"${WORKDIR}" \
187187
-e PCCS_URL=${PCCS_URL} \
188-
-v /dev/sgx_enclave:/dev/sgx/enclave \
189-
-v /dev/sgx_provision:/dev/sgx/provision \
188+
-v /dev/sgx_enclave:/dev/sgx_enclave \
189+
-v /dev/sgx_provision:/dev/sgx_provision \
190190
${RELEASE_IMAGE}:${RELEASE_TAG} /bin/bash
191191
}
192192

0 commit comments

Comments
 (0)