Skip to content

Commit

Permalink
ci: 🎡 try to fix pip-audit
Browse files Browse the repository at this point in the history
see pypa/pip-audit#84 (comment)
in particular
  • Loading branch information
severo committed Nov 24, 2022
1 parent 4a48536 commit 18fbd97
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/_quality-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ jobs:
run: poetry run mypy tests src
- name: Run bandit
run: poetry run bandit -r src
- name: Run pip-audit (datasets worker)
if: ${{ inputs.is-datasets-worker == true }}
run: bash -c "poetry run pip-audit -r <(poetry export -f requirements.txt --with dev | sed '/^requests==2.28.1 ;/,+2 d' | sed '/^kenlm @/d' | sed '/^trec-car-tools @/d')"
- name: Run pip-audit
if: ${{ inputs.is-datasets-worker == false }}
run: bash -c 'poetry run pip-audit -r <(poetry export -f requirements.txt --with dev)'
1 change: 1 addition & 0 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ DOCKER_COMPOSE := ../tools/docker-compose-datasets-server-from-remote-images.yml
DOCKER_IMAGES := ../chart/docker-images.yaml

include ../tools/Python.mk
include ../tools/PythonAudit.mk
include ../tools/PythonTest.mk
include ../tools/DockerRemoteImages.mk
include ../tools/Docker.mk
Expand Down
1 change: 1 addition & 0 deletions jobs/mongodb_migration/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export MONGODB_MIGRATION_MONGO_URL := mongodb://localhost:${MONGO_PORT}
DOCKER_COMPOSE := ../../tools/docker-compose-mongo.yml

include ../../tools/Python.mk
include ../../tools/PythonAudit.mk
include ../../tools/PythonTest.mk
include ../../tools/Docker.mk

Expand Down
1 change: 1 addition & 0 deletions libs/libcache/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export COMPOSE_PROJECT_NAME := libcache
DOCKER_COMPOSE := ../../tools/docker-compose-mongo.yml

include ../../tools/Python.mk
include ../../tools/PythonAudit.mk
include ../../tools/PythonTest.mk
include ../../tools/Docker.mk
1 change: 1 addition & 0 deletions libs/libcommon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export COMPOSE_PROJECT_NAME := libcommon
DOCKER_COMPOSE := ../../tools/docker-compose-empty.yml

include ../../tools/Python.mk
include ../../tools/PythonAudit.mk
include ../../tools/PythonTest.mk
include ../../tools/Docker.mk
1 change: 1 addition & 0 deletions libs/libqueue/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export QUEUE_MONGO_URL := mongodb://localhost:${MONGO_PORT}
DOCKER_COMPOSE := ../../tools/docker-compose-mongo.yml

include ../../tools/Python.mk
include ../../tools/PythonAudit.mk
include ../../tools/PythonTest.mk
include ../../tools/Docker.mk
1 change: 1 addition & 0 deletions services/admin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export QUEUE_MONGO_URL := mongodb://localhost:${MONGO_PORT}
DOCKER_COMPOSE := ../../tools/docker-compose-mongo.yml

include ../../tools/Python.mk
include ../../tools/PythonAudit.mk
#include ../../tools/PythonTest.mk
include ../../tools/Docker.mk

Expand Down
2 changes: 1 addition & 1 deletion services/api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export QUEUE_MONGO_URL := mongodb://localhost:${MONGO_PORT}
# makefile variables
DOCKER_COMPOSE := ../../tools/docker-compose-mongo.yml

# Ensure to specify HF_TOKEN when calling make test, ie HF_TOKEN=hf_app_xxx make test
include ../../tools/Python.mk
include ../../tools/PythonAudit.mk
#include ../../tools/PythonTest.mk
include ../../tools/Docker.mk

Expand Down
2 changes: 1 addition & 1 deletion tools/Python.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ quality:
poetry run flake8 tests src
poetry run mypy tests src
poetry run bandit -r src
bash -c 'poetry run pip-audit -r <(poetry export -f requirements.txt --with dev)'
$(MAKE) pip-audit

# Format source code automatically
.PHONY: style
Expand Down
3 changes: 3 additions & 0 deletions tools/PythonAudit.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.PHONY: pip-audit
pip-audit:
bash -c 'poetry run pip-audit -r <(poetry export -f requirements.txt --with dev)'
5 changes: 5 additions & 0 deletions workers/first_rows/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ include ../../tools/Docker.mk
.PHONY: run
run:
poetry run python src/first_rows/main.py

.PHONY: pip-audit
pip-audit:
bash -c "poetry run pip-audit -r <(poetry export -f requirements.txt --with dev | sed '/^requests==2.28.1 ;/,+2 d' | sed '/^kenlm @/d' | sed '/^trec-car-tools @/d' | sed '/^libcache @/,+1 d' | sed '/^libcommon @/,+1 d' | sed '/^libqueue @/,+1 d')"
# ^ we remove problematic lines to have a working pip-audit. See https://github.com/pypa/pip-audit/issues/84#issuecomment-1326203111 for "requests"
5 changes: 5 additions & 0 deletions workers/splits/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ include ../../tools/Docker.mk
.PHONY: run
run:
poetry run python src/splits/main.py

.PHONY: pip-audit
pip-audit:
bash -c "poetry run pip-audit -r <(poetry export -f requirements.txt --with dev | sed '/^requests==2.28.1 ;/,+2 d' | sed '/^kenlm @/d' | sed '/^trec-car-tools @/d')"
# ^ we remove problematic lines to have a working pip-audit. See https://github.com/pypa/pip-audit/issues/84#issuecomment-1326203111 for "requests"

0 comments on commit 18fbd97

Please sign in to comment.