From 21e8b08ed980ffa0552714299a51fd30ef007497 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Mon, 14 Nov 2022 16:35:24 -0300 Subject: [PATCH] Reduce Zephyr test time --- .github/workflows/test.yml | 25 ++++++++++++------------- examples/zephyr/Makefile | 29 +++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 examples/zephyr/Makefile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 78d06958..f1e8fb5f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -121,19 +121,18 @@ jobs: - uses: actions/checkout@v3 - name: ${{ matrix.example.path }} run: make -C examples/${{ matrix.example.path }} build - matrix_zephyr_examples: + zephyr_examples: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - zephyrexample: - - path: zephyr/device-dashboard - - path: zephyr/http-client - - path: zephyr/http-server - - path: zephyr/mqtt-aws-client - - path: zephyr/websocket-server - name: ${{ matrix.zephyrexample.name }} steps: - uses: actions/checkout@v3 - - name: ${{ matrix.zephyrexample.path }} - run: make -C examples/${{ matrix.zephyrexample.path }} zephyr build + - run: make -C examples/zephyr init + - name: minify manifest + uses: mikefarah/yq@master + with: + cmd: yq -i eval '(.manifest.defaults, .manifest.remotes, .manifest.projects[] | select(.name == "cmsis" or .name == "hal_stm32" or .name == "mbedtls" or .name == "mcuboot" or .name == "picolibc" | del(.null) ), .manifest.self) as $i ireduce({};setpath($i | path; $i)) | del(.manifest.projects.[].null) | del(..|select(length==0))' examples/zephyr/zephyrproject/zephyr/west.yml + - run: make -C examples/zephyr update + - run: make -C examples/zephyr/device-dashboard build + - run: make -C examples/zephyr/http-client build + - run: make -C examples/zephyr/http-server build + - run: make -C examples/zephyr/mqtt-aws-client build + - run: make -C examples/zephyr/websocket-server build diff --git a/examples/zephyr/Makefile b/examples/zephyr/Makefile new file mode 100644 index 00000000..9669ba6c --- /dev/null +++ b/examples/zephyr/Makefile @@ -0,0 +1,29 @@ +DOCKER_PROJECT_DIR ?= /workdir +ZEPHYR_DIR ?= zephyrproject +PROJECT_PATH = $(realpath $(CURDIR)) +ZEPHYR_PATH = $(realpath $(CURDIR))/$(ZEPHYR_DIR) +DOCKER_PROJECT_PATH = $(DOCKER_PROJECT_DIR) +DOCKER_ZEPHYR_PATH = $(DOCKER_PROJECT_DIR)/$(ZEPHYR_DIR) + +DOCKER ?= docker run --rm -v $(PROJECT_PATH):$(DOCKER_PROJECT_PATH) -v $(ZEPHYR_PATH):$(DOCKER_ZEPHYR_PATH) +REPO ?= zephyrprojectrtos/ci + +YQ ?= yq + +example: + true + +init: +ifeq ($(wildcard $(ZEPHYR_PATH)/.*),) + mkdir $(ZEPHYR_PATH) + $(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_PROJECT_DIR) && west init ./$(ZEPHYR_DIR)' +endif + +update: + $(DOCKER) $(REPO) /bin/sh -c 'cd $(DOCKER_ZEPHYR_PATH) && west update' + +minify: + $(YQ) -i eval '(.manifest.defaults, .manifest.remotes, .manifest.projects[] | select(.name == "cmsis" or .name == "hal_stm32" or .name == "mbedtls" or .name == "mcuboot" or .name == "picolibc" | del(.null) ), .manifest.self) as $$i ireduce({};setpath($$i | path; $$i)) | del(.manifest.projects.[].null) | del(..|select(length==0))' zephyrproject/zephyr/west.yml + +zephyr: init minify update +