-
Notifications
You must be signed in to change notification settings - Fork 46
Sgx runner #1222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sgx runner #1222
Changes from 79 commits
c344f46
1e29cd8
3c9c2ae
2a1a587
02841fb
731e3d2
fad37af
4b757f2
6ffb965
cc4aa8e
238ac30
3f8c1ae
29daea6
e11d1d7
65a199c
74fd054
5c0b2f0
5c171de
cdd42e1
223b4d1
b3e2875
88ff927
7e35719
b9080f3
8e3b7e7
a3d2f2f
1bac47b
1b138a4
2abe1a8
ecfafbb
8006b16
5e9f62b
7d3a0b1
f96e1cc
2b56719
4f20cfb
53bebd2
3be342a
72f5937
51285af
aa933b7
ba68a3e
3ffa62f
63b8191
a09d119
3c15139
f6e484c
6c01bba
fe38e11
ce17504
05440b0
6c9e8e9
7d436a8
36fb3d1
e50899c
e075f7c
c7de601
d9cd213
3874ca8
832591b
010f01c
c11faa4
e8ad5da
b2dfac6
775f098
c136eb2
824ef04
834b019
22bb0a9
b7beded
1be4dc0
fd3e792
2de8e02
47aea84
8ee541a
83291cf
1846b54
aa98471
cfdd8e3
ce9ef2c
c93dcc3
f1fdfaa
9de7be4
9e3e707
69b9329
5e830c3
e8f676b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,27 +21,35 @@ env: | |
| jobs: | ||
| cancel_previous_runs: | ||
| name: Cancel Previous Runs | ||
| runs-on: ubuntu-22.04 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: styfle/cancel-workflow-action@0.11.0 | ||
| with: | ||
| access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| build-test: | ||
| runs-on: ubuntu-22.04 | ||
| runs-on: ${{ matrix.host }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - flavor_id: sidechain | ||
| mode: sidechain | ||
| host: integritee-builder-sgx | ||
| sgx_mode: HW | ||
| - flavor_id: offchain-worker | ||
| mode: offchain-worker | ||
| host: integritee-builder-sgx | ||
| sgx_mode: HW | ||
| - flavor_id: teeracle | ||
| mode: teeracle | ||
| host: integritee-builder-sgx | ||
| sgx_mode: HW | ||
| - flavor_id: sidechain-evm | ||
| mode: sidechain | ||
| additional_features: evm | ||
| host: integritee-builder-sgx | ||
| sgx_mode: HW | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
@@ -58,7 +66,7 @@ jobs: | |
| run: > | ||
| docker build -t integritee-worker-${{ matrix.flavor_id }}-${{ github.sha }} | ||
| --target deployed-worker | ||
| --build-arg WORKER_MODE_ARG=${{ matrix.mode }} --build-arg ADDITIONAL_FEATURES_ARG=${{ matrix.additional_features }} | ||
| --build-arg WORKER_MODE_ARG=${{ matrix.mode }} --build-arg ADDITIONAL_FEATURES_ARG=${{ matrix.additional_features }} --build-arg SGX_MODE=${{ matrix.sgx_mode }} | ||
| -f build.Dockerfile . | ||
|
|
||
| - name: Build CLI client | ||
|
|
@@ -73,7 +81,7 @@ jobs: | |
| - run: docker images --all | ||
|
|
||
| - name: Test Enclave # cargo test is not supported in the enclave, see: https://github.com/apache/incubator-teaclave-sgx-sdk/issues/232 | ||
| run: docker run --name ${{ env.BUILD_CONTAINER_NAME }} integritee-worker-${{ matrix.flavor_id }}-${{ github.sha }} test --all | ||
| run: docker run --device=/dev/sgx/enclave --device=/dev/sgx/provision -v /var/run/aesmd:/var/run/aesmd integritee-worker-${{ matrix.flavor_id }}-${{ github.sha }} test --all | ||
|
|
||
| - name: Export worker image(s) | ||
| run: | | ||
|
|
@@ -94,7 +102,7 @@ jobs: | |
|
|
||
| clippy: | ||
| runs-on: ubuntu-22.04 | ||
| container: "integritee/integritee-dev:0.1.13" | ||
| container: "integritee/integritee-dev:0.2.1" | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: init rust | ||
|
|
@@ -152,7 +160,7 @@ jobs: | |
| uses: andymckay/cancel-action@0.3 | ||
|
|
||
| integration-tests: | ||
| runs-on: ubuntu-22.04 | ||
| runs-on: ${{ matrix.host }} | ||
| if: ${{ always() }} | ||
| needs: build-test | ||
| env: | ||
|
|
@@ -168,34 +176,60 @@ jobs: | |
| - test: M6 | ||
| flavor_id: sidechain | ||
| demo_name: demo-indirect-invocation | ||
| host: test-runner-sgx | ||
| sgx_mode: HW | ||
| - test: M8 | ||
| flavor_id: sidechain | ||
| demo_name: demo-direct-call | ||
| host: test-runner-sgx | ||
| sgx_mode: HW | ||
| - test: Sidechain | ||
| flavor_id: sidechain | ||
| demo_name: demo-sidechain | ||
| host: test-runner-sgx | ||
| sgx_mode: HW | ||
| - test: M6 | ||
| flavor_id: offchain-worker | ||
| demo_name: demo-indirect-invocation | ||
| host: test-runner-sgx | ||
| sgx_mode: HW | ||
| - test: Teeracle | ||
| flavor_id: teeracle | ||
| demo_name: demo-teeracle | ||
| host: test-runner-sgx | ||
| sgx_mode: HW | ||
| - test: Teeracle | ||
| flavor_id: teeracle | ||
| demo_name: demo-teeracle-generic | ||
| host: test-runner-sgx | ||
| sgx_mode: HW | ||
| - test: Benchmark | ||
| flavor_id: sidechain | ||
| demo_name: sidechain-benchmark | ||
| host: test-runner-sgx | ||
| sgx_mode: HW | ||
| - test: EVM | ||
| flavor_id: sidechain-evm | ||
| demo_name: demo-smart-contract | ||
| host: test-runner-sgx | ||
| sgx_mode: HW | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Set env | ||
| run: | | ||
| version=$RANDOM | ||
| echo "FLAVOR_ID=${{ matrix.flavor_id }}" >> $GITHUB_ENV | ||
| echo "PROJECT=${{ matrix.flavor_id }}-${{ matrix.demo_name }}" >> $GITHUB_ENV | ||
| echo "VERSION=dev.$version" >> $GITHUB_ENV | ||
| echo "WORKER_IMAGE_TAG=integritee-worker:dev.$version" >> $GITHUB_ENV | ||
| echo "CLIENT_IMAGE_TAG=integritee-cli:dev.$version" >> $GITHUB_ENV | ||
| if [[ ${{ matrix.sgx_mode }} == 'HW' ]]; then | ||
| echo "SGX_PROVISION=/dev/sgx/provision" >> $GITHUB_ENV | ||
| echo "SGX_ENCLAVE=/dev/sgx/enclave" >> $GITHUB_ENV | ||
| echo "AESMD=/var/run/aesmd" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - name: Download Worker Image | ||
| uses: actions/download-artifact@v3 | ||
|
|
@@ -217,42 +251,82 @@ jobs: | |
| docker image load --input integritee-cli-client-${{ matrix.flavor_id }}-${{ github.sha }}.tar.gz | ||
| docker images --all | ||
|
|
||
| ## | ||
| # Before tagging, delete the old "stuck" ones to be sure that the newly created ones are the latest | ||
| # Without if the docker image rmi throws an error if the image doesn't exist. | ||
| ## | ||
mosonyi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Re-name Image Tags | ||
| run: | | ||
| if [[ "$(docker images -q ${{ env.WORKER_IMAGE_TAG }} 2> /dev/null)" == "" ]]; then | ||
| docker image rmi --force ${{ env.WORKER_IMAGE_TAG }} 2>/dev/null | ||
| fi | ||
| if [[ "$(docker images -q ${{ env.CLIENT_IMAGE_TAG }} 2> /dev/null)" == "" ]]; then | ||
| docker image rmi --force ${{ env.CLIENT_IMAGE_TAG }} 2>/dev/null | ||
| fi | ||
OverOrion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| docker tag integritee-worker-${{ matrix.flavor_id }}-${{ github.sha }} ${{ env.WORKER_IMAGE_TAG }} | ||
| docker tag integritee-cli-client-${{ matrix.flavor_id }}-${{ github.sha }} ${{ env.CLIENT_IMAGE_TAG }} | ||
| docker images --all | ||
|
|
||
| - name: Integration Test ${{ matrix.test }}-${{ matrix.flavor_id }} | ||
| ## | ||
| # Stop any stucked/running compose projects | ||
| ## | ||
| - name: Stop docker containers | ||
OverOrion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if: always() | ||
| continue-on-error: true | ||
| run: | | ||
| cd docker | ||
| docker compose -f docker-compose.yml -f ${{ matrix.demo_name }}.yml up ${{ matrix.demo_name }} --no-build --exit-code-from ${{ matrix.demo_name }} | ||
| docker compose -f <(envsubst < docker-compose.yml) -f <(envsubst < ${{ matrix.demo_name }}.yml) -p ${PROJECT} stop | ||
|
|
||
| - name: Stop docker containers | ||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
|
||
| - name: Integration Test ${{ matrix.test }}-${{ matrix.flavor_id }} | ||
| run: | | ||
| cd docker | ||
| docker compose -f docker-compose.yml -f ${{ matrix.demo_name }}.yml stop | ||
| docker compose -f <(envsubst < docker-compose.yml) -f <(envsubst < ${{ matrix.demo_name }}.yml) -p ${PROJECT} up ${{ matrix.demo_name }} --no-build --exit-code-from ${{ matrix.demo_name }} --remove-orphans | ||
|
|
||
|
|
||
| - name: Collect Docker Logs | ||
| continue-on-error: true | ||
| if: always() | ||
| uses: jwalton/gh-docker-logs@v2 | ||
| with: | ||
| #images: '${{ env.WORKER_IMAGE_TAG }},${{ env.CLIENT_IMAGE_TAG }}' | ||
| images: 'integritee-worker-${{ matrix.flavor_id }}-${{ github.sha }},integritee-cli-client-${{ matrix.flavor_id }}-${{ github.sha }}' | ||
| tail: all | ||
| dest: ./${{ env.LOG_DIR }} | ||
| dest: ./${LOG_DIR}-${{ matrix.flavor_id }}-${{ github.sha }} | ||
|
||
|
|
||
| - name: Upload logs | ||
| if: always() | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: logs-${{ matrix.test }}-${{ matrix.flavor_id }} | ||
| path: ./${{ env.LOG_DIR }} | ||
| path: ./${LOG_DIR}-${{ matrix.flavor_id }}-${{ github.sha }} | ||
|
|
||
| - name: Stop docker containers | ||
| if: always() | ||
| continue-on-error: true | ||
| run: | | ||
| cd docker | ||
| docker compose -f <(envsubst < docker-compose.yml) -f <(envsubst < ${{ matrix.demo_name }}.yml) -p ${PROJECT} stop | ||
|
|
||
| - name: Delete images | ||
| run: | | ||
| if [[ "$(docker images -q ${{ env.WORKER_IMAGE_TAG }} 2> /dev/null)" == "" ]]; then | ||
| docker image rmi --force ${{ env.WORKER_IMAGE_TAG }} 2>/dev/null | ||
| fi | ||
| if [[ "$(docker images -q ${{ env.CLIENT_IMAGE_TAG }} 2> /dev/null)" == "" ]]; then | ||
| docker image rmi --force ${{ env.CLIENT_IMAGE_TAG }} 2>/dev/null | ||
| fi | ||
| docker images --all | ||
|
|
||
|
|
||
OverOrion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| release: | ||
| runs-on: ubuntu-22.04 | ||
clangenb marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| name: Draft Release | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| runs-on: ubuntu-22.04 | ||
| needs: [build-test, integration-tests] | ||
| outputs: | ||
| release_url: ${{ steps.create-release.outputs.html_url }} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.