[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 <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-02-01 15:23:19 +01:00 committed by Alexandre Flament
parent 38b39ef0ae
commit 8c45f1149d
2 changed files with 6 additions and 1 deletions

View File

@ -34,7 +34,7 @@ jobs:
make V=1 install make V=1 install
make V=1 gecko.driver make V=1 gecko.driver
- name: Run tests - name: Run tests
run: make V=1 test run: make V=1 ci.test
- name: Test coverage - name: Test coverage
run: make V=1 test.coverage run: make V=1 test.coverage
- name: Store coverage result - name: Store coverage result

View File

@ -251,6 +251,11 @@ test.clean:
# travis # travis
# ------ # ------
PHONY += ci.test
ci.test:
$(PY_ENV_BIN)/python -c "import yaml" || make clean
$(MAKE) test
travis.codecov: travis.codecov:
$(Q)$(PY_ENV_BIN)/python -m pip install codecov $(Q)$(PY_ENV_BIN)/python -m pip install codecov