Skip to content

Commit

Permalink
Dev: Relaxed the conditions when safety issues are tolerated
Browse files Browse the repository at this point in the history
Details:

* Changed the default RUN_TYPE for local make runs to 'local', in order to
  be able to distinguish local make runs from test workflow runs.

* Safety issues in development dependencies are now tolerated in normal and
  scheduled test workflow runs (but not in local make runs and release test
  workflow runs).

* Safety issues in installation dependencies are now tolerated in normal test
  workflow runs (but not in local make runs and scheduled/release test
  workflow runs).

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
  • Loading branch information
andy-maier committed Aug 17, 2024
1 parent 7d0855a commit 40ed315
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
File renamed without changes.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ else
endif
endif

# Run type (normal, scheduled, release)
# Run type (normal, scheduled, release, local)
ifndef RUN_TYPE
RUN_TYPE := normal
RUN_TYPE := local
endif

# Make variables are case sensitive and some native Windows environments have
Expand Down Expand Up @@ -150,7 +150,7 @@ done_dir := done
pytest_no_log_opt := $(shell py.test --help 2>/dev/null |grep '\--no-print-logs' >/dev/null; if [ $$? -eq 0 ]; then echo '--no-print-logs'; else echo ''; fi)

# Safety policy files
safety_install_policy_file := .safety-policy.yml
safety_install_policy_file := .safety-policy-install.yml
safety_develop_policy_file := .safety-policy-develop.yml

# Flake8 config file
Expand Down Expand Up @@ -389,18 +389,18 @@ $(done_dir)/flake8_$(pymn)_$(PACKAGE_LEVEL).done: $(done_dir)/develop_$(pymn)_$(
echo "done" >$@

$(done_dir)/safety_develop_$(pymn)_$(PACKAGE_LEVEL).done: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done Makefile $(safety_develop_policy_file) minimum-constraints-develop.txt
@echo "Makefile: Running Safety tool for development packages"
@echo "Makefile: Running Safety for development packages (and tolerate safety issues when RUN_TYPE is normal or scheduled)"
-$(call RM_FUNC,$@)
bash -c "safety check --policy-file $(safety_develop_policy_file) -r minimum-constraints-develop.txt --full-report || test '$(RUN_TYPE)' != 'release' || exit 1"
bash -c "safety check --policy-file $(safety_develop_policy_file) -r minimum-constraints-develop.txt --full-report || test '$(RUN_TYPE)' == 'normal' || test '$(RUN_TYPE)' == 'scheduled' || exit 1"
echo "done" >$@
@echo "Makefile: Done running Safety tool for development packages"
@echo "Makefile: Done running Safety for development packages"

$(done_dir)/safety_install_$(pymn)_$(PACKAGE_LEVEL).done: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done Makefile $(safety_install_policy_file) minimum-constraints.txt
@echo "Makefile: Running Safety tool for installation packages"
@echo "Makefile: Running Safety for install packages (and tolerate safety issues when RUN_TYPE is normal)"
-$(call RM_FUNC,$@)
safety check --policy-file $(safety_install_policy_file) -r minimum-constraints.txt --full-report
bash -c "safety check --policy-file $(safety_install_policy_file) -r minimum-constraints-install.txt --full-report || test '$(RUN_TYPE)' == 'normal' || exit 1"
echo "done" >$@
@echo "Makefile: Done running Safety tool for installation packages"
@echo "Makefile: Done running Safety for install packages"

.PHONY: check_reqs
check_reqs: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done requirements.txt minimum-constraints.txt minimum-constraints-develop.txt
Expand Down

0 comments on commit 40ed315

Please sign in to comment.