Skip to content
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

Test SGX examples #9

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add sgx tests
  • Loading branch information
csegarragonz committed Mar 7, 2023
commit 99e29a61f73eb6072aeae156e77fead62953e07d
45 changes: 42 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ jobs:
REDIS_QUEUE_HOST: redis
REDIS_STATE_HOST: redis
container:
image: faasm/examples-run:0.9.2
image: faasm/examples-run:0.9.4
services:
redis:
image: faasm/redis:0.9.2
image: faasm/redis:0.9.4
minio:
image: faasm/minio:0.9.2
image: faasm/minio:0.9.4
env:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
Expand Down Expand Up @@ -151,3 +151,42 @@ jobs:
run: ./bin/inv_wrapper.sh run tf check
- name: "Run FFmpeg check"
run: ./bin/inv_wrapper.sh run ffmpeg check

run-sgx-examples:
if: github.event.pull_request.draft == false
needs: [build-examples]
runs-on: ubuntu-latest
env:
WASM_VM: sgx
container:
image: faasm/examples-run-sgx-sim:0.9.4
services:
redis:
image: faasm/redis:0.9.4
minio:
image: faasm/minio:0.9.4
env:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
steps:
- name: "Download examples wasm"
uses: actions/download-artifact@v3.0.1
with:
name: examples-wasm
path: /usr/local/faasm/wasm
- name: "Checkout latest Faasm code"
uses: actions/checkout@v3
with:
repository: faasm/faasm
# TODO: remove after merge
ref: wamr-fs
- name: "Re-build targets"
run: ./bin/inv_wrapper.sh dev.tools --sgx Simulation
- name: "Run codegen"
run: |
./bin/inv_wrapper.sh codegen imagemagick main
./bin/inv_wrapper.sh codegen tf check
- name: "Run ImageMagick"
run: ./bin/inv_wrapper.sh run imagemagick main --cmdline 'faasm://im/sample_image.png -flip faasm://im/image_out.png'
- name: "Run TFlite check"
run: ./bin/inv_wrapper.sh run tf check
2 changes: 1 addition & 1 deletion FAASM_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.2
0.9.4
3 changes: 2 additions & 1 deletion docker/run.dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
ARG EXAMPLES_VERSION
ARG FAASM_VERSION
ARG SGX_IMAGE_SUFFIX
FROM faasm/examples-build:${EXAMPLES_VERSION} as build

# Prepare shared data for the tests
RUN cd /code/examples \
&& source venv/bin/activate \
&& inv data

FROM faasm/cli:${FAASM_VERSION}
FROM faasm/cli${SGX_IMAGE_SUFFIX}:${FAASM_VERSION}

COPY --from=build /code/examples /code/examples
COPY --from=build /usr/local/faasm/wasm /usr/local/faasm/wasm
12 changes: 11 additions & 1 deletion tasks/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ def get_tag(name):
image_name = EXAMPLES_BUILD_IMAGE_NAME
elif name == "run":
image_name = EXAMPLES_RUN_IMAGE_NAME
elif name == "run-sgx-sim":
image_name = EXAMPLES_RUN_IMAGE_NAME + "-sgx-sim"
return "{}:{}".format(image_name, version)


@task(iterable=["c"])
def build(ctx, c, nocache=False, push=False):
"""
Build container image, possible containers are `build` and `run`
Build container image, possible containers are `build`, `run`,
`run-sgx-sim`, and `run-sgx`.
"""
build_args = {}
for ctr in c:
Expand All @@ -45,6 +48,13 @@ def build(ctx, c, nocache=False, push=False):
"FAASM_VERSION": get_faasm_version(),
}
dockerfile = EXAMPLES_RUN_DOCKERFILE
elif ctr == "run-sgx-sim":
build_args = {
"EXAMPLES_VERSION": get_version(),
"FAASM_VERSION": get_faasm_version(),
"SGX_IMAGE_SUFFIX": "-sgx-sim",
}
dockerfile = EXAMPLES_RUN_DOCKERFILE
else:
raise RuntimeError("Unrecognised container name: {}".format(ctr))

Expand Down
2 changes: 1 addition & 1 deletion tasks/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ def get_version(name="build"):
"""
if name == "build":
return "{}_{}".format(get_cpp_version(), get_python_version())
if name == "run":
if name == "run" or name == "run-sgx-sim":
return "{}".format(get_faasm_version())