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 all commits
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
46 changes: 43 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,43 @@ 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
submodules: true
- 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
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
depends_on:
- redis
- minio
image: faasm/examples-run:${EXAMPLES_RUN_VERSION}
image: faasm/examples-run${SGX_CLI_SUFFIX}:${EXAMPLES_RUN_VERSION}
working_dir: /usr/local/code/faasm
stdin_open: true
tty: true
Expand Down
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
2 changes: 1 addition & 1 deletion python
3 changes: 2 additions & 1 deletion tasks/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@task(default=True)
def cli(ctx, service, clean=False):
def cli(ctx, service, clean=False, sgx=False):
"""
Get a shell into one of the containers: `build` or `run`
"""
Expand Down Expand Up @@ -44,6 +44,7 @@ def cli(ctx, service, clean=False):
{
"EXAMPLES_RUN_VERSION": get_faasm_version(),
"EXAMPLES_BUILD_VERSION": get_version(),
"SGX_CLI_SUFFIX": "-sgx-sim" if sgx else "",
}
)
docker_cmd = "docker compose up -d --no-recreate"
Expand Down
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())
12 changes: 12 additions & 0 deletions tasks/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,15 @@ def compile(ctx, user, func, clean=False, debug=False):

# Copy into place
_copy_built_function(user, func)


@task
def tests(ctx, clean=False):
"""
Build the functions used in the tests
"""
funcs = [
["ffmpeg", "check"],
# What about LAMMPS
["tf", "check"],
]