From 8c45f1149dd464317c8a11829b084f2d30037162 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 1 Feb 2021 15:23:19 +0100 Subject: [PATCH] [hardening] github workflows - corrupted cache aka: ensure that 'make test' works as expected The cache contains a copy './local' which is - under some circumstance - corrupted. It is not possible to clear the cache [1] (see the top of the page). Ensure that 'make test' works as expected [2] even if - the python interpreter is missing - the virtualenv exists but pyyaml is missing To hardening when the workflow cache fails, this patch adds the new target 'travis.test' into the workflow. This target probes to import a python module 'yaml'. If this fails the virtualenv will be completely new build. [1] https://github.com/actions/cache/issues/2#issuecomment-673493515 [2] https://github.com/searx/searx/pull/2517#discussion_r567240235 Signed-off-by: Markus Heiser --- .github/workflows/integration.yml | 2 +- Makefile | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 4f3b8e9c8..39f3d3418 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -34,7 +34,7 @@ jobs: make V=1 install make V=1 gecko.driver - name: Run tests - run: make V=1 test + run: make V=1 ci.test - name: Test coverage run: make V=1 test.coverage - name: Store coverage result diff --git a/Makefile b/Makefile index c52e93cdb..d148581dd 100644 --- a/Makefile +++ b/Makefile @@ -251,6 +251,11 @@ test.clean: # travis # ------ +PHONY += ci.test +ci.test: + $(PY_ENV_BIN)/python -c "import yaml" || make clean + $(MAKE) test + travis.codecov: $(Q)$(PY_ENV_BIN)/python -m pip install codecov