diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 11e1a5b..2a0535d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -198,6 +198,8 @@ jobs: - name: "Print logs if wasm-upload fails" if: failure() && (steps.wasm-upload.outcome == 'failure') run: faasmctl logs -s upload + - name: "Upload all data files" + run: ./bin/inv_wrapper.sh data.upload - name: "Run OpenCV check" if: "contains(env.FAASM_WASM_VM, 'wamr')" timeout-minutes: 2 diff --git a/tasks/data.py b/tasks/data.py index 48061df..0770a9c 100644 --- a/tasks/data.py +++ b/tasks/data.py @@ -1,20 +1,15 @@ +from faasmctl.util.upload import upload_file from invoke import task -from os import makedirs -from os.path import dirname, exists -from shutil import copyfile from tasks.env import EXAMPLES_DATA_FILES @task(default=True) -def prepare(ctx): +def upload(ctx): """ - Prepare data files to test WASM examples + Upload shared files needed to run WASM examples """ for p in EXAMPLES_DATA_FILES: - path_src = p[0] - path_dst = p[1] + host_path = p[0] + faasm_path = p[1] - if not exists(dirname(path_dst)): - makedirs(dirname(path_dst)) - - copyfile(path_src, path_dst) + upload_file(host_path, faasm_path) diff --git a/tasks/env.py b/tasks/env.py index d3a41ec..e9a8261 100644 --- a/tasks/env.py +++ b/tasks/env.py @@ -25,39 +25,39 @@ EXAMPLES_DATA_FILES = [ [ join(EXAMPLES_DATA_HOST_DIR, "faasm_logo.png"), - join(EXAMPLES_DATA_BASE_DIR, "im", "sample_image.png"), + join("im", "sample_image.png"), ], [ join(EXAMPLES_DATA_HOST_DIR, "in.controller.wall"), - join(EXAMPLES_DATA_BASE_DIR, "lammps-data", "in.controller.wall"), + join("lammps-data", "in.controller.wall"), ], [ join(EXAMPLES_DATA_HOST_DIR, "ffmpeg_video.mp4"), - join(EXAMPLES_DATA_BASE_DIR, "ffmpeg", "sample_video.mp4"), + join("ffmpeg", "sample_video.mp4"), ], [ join(EXAMPLES_DATA_HOST_DIR, "sample_model.tflite"), - join(EXAMPLES_DATA_BASE_DIR, "tflite", "sample_model.tflite"), + join("tflite", "sample_model.tflite"), ], [ join(EXAMPLES_DATA_HOST_DIR, "grace_hopper.bmp"), - join(EXAMPLES_DATA_BASE_DIR, "tflite", "grace_hopper.bmp"), + join("tflite", "grace_hopper.bmp"), ], [ join(EXAMPLES_DATA_HOST_DIR, "bus_photo.bmp"), - join(EXAMPLES_DATA_BASE_DIR, "opencv", "bus_photo.bmp"), + join("opencv", "bus_photo.bmp"), ], [ join(EXAMPLES_DATA_HOST_DIR, "tchaikovsky.bmp"), - join(EXAMPLES_DATA_BASE_DIR, "opencv", "composers", "tchaikovsky.bmp"), + join("opencv", "composers", "tchaikovsky.bmp"), ], [ join(EXAMPLES_DATA_HOST_DIR, "wagner.bmp"), - join(EXAMPLES_DATA_BASE_DIR, "opencv", "composers", "wagner.bmp"), + join("opencv", "composers", "wagner.bmp"), ], [ join(EXAMPLES_DATA_HOST_DIR, "beethoven.bmp"), - join(EXAMPLES_DATA_BASE_DIR, "opencv", "composers", "beethoven.bmp"), + join("opencv", "composers", "beethoven.bmp"), ], ]