This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate dependency management to poetry
Switch dependency management to use poetry, which is much nicer than pip-tools. This is largely based off of <freedomofpress/securedrop-proxy#122> and applies the same changes to the Makefile and CI.
- Loading branch information
Showing
14 changed files
with
1,154 additions
and
1,417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,59 @@ | ||
--- | ||
common-steps: | ||
- &install_poetry | ||
run: | ||
name: Install Poetry | ||
command: | | ||
set -e | ||
source /etc/os-release | ||
if [[ "$VERSION_CODENAME" == "bullseye" ]]; then | ||
# Install Poetry via PyPI | ||
apt-get update && apt-get install --yes --no-install-recommends python3-pip | ||
pip install poetry==1.6.1 | ||
elif [[ "$VERSION_CODENAME" == "bookworm" ]]; then | ||
# Install Poetry via system package | ||
apt-get update && apt-get install --yes --no-install-recommends python3-poetry | ||
else | ||
echo "Unsupported Debian version: $VERSION_CODENAME" | ||
exit 1 | ||
fi | ||
- &install_testing_dependencies | ||
run: | ||
name: Install testing dependencies | ||
command: | | ||
set -e | ||
apt update && apt install -y git gnupg make python3-dev gnupg python3-venv libnotify-bin | ||
poetry install --no-ansi | ||
- &install_build_dependencies | ||
run: | ||
name: Install build dependencies | ||
command: | | ||
set -e | ||
apt update && apt install -y git make sudo | ||
- &run_unit_tests | ||
run: | ||
name: Install requirements and run unit tests | ||
command: | | ||
set -e | ||
export VERSION_CODENAME=$(~/project/scripts/codename) | ||
make venv | ||
source .venv/bin/activate | ||
export PYTHONPATH=$PYTHONPATH:. # so alembic can get to Base metadata | ||
make test | ||
- &run_lint | ||
run: | ||
name: Run lint, type checking, code formatting | ||
command: | | ||
set -e | ||
export VERSION_CODENAME=$(~/project/scripts/codename) | ||
make venv | ||
source .venv/bin/activate | ||
make check-black lint | ||
- &check_security | ||
run: | ||
name: Run static analysis on source code to find security issues | ||
command: | | ||
set -e | ||
export VERSION_CODENAME=$(~/project/scripts/codename) | ||
make venv | ||
source .venv/bin/activate | ||
make semgrep | ||
- &check_python_dependencies_for_vulnerabilities | ||
run: | ||
name: Check Python dependencies for known vulnerabilities | ||
command: | | ||
set -e | ||
export VERSION_CODENAME=$(~/project/scripts/codename) | ||
make venv | ||
source .venv/bin/activate | ||
make safety | ||
- &install_packaging_dependencies | ||
|
@@ -61,12 +62,10 @@ common-steps: | |
command: | | ||
set -x | ||
mkdir ~/packaging && cd ~/packaging | ||
# local builds may not have an ssh url, so || true | ||
git config --global --unset url.ssh://[email protected] || true | ||
git clone https://github.com/freedomofpress/securedrop-debian-packaging.git | ||
cd securedrop-debian-packaging | ||
apt-get update && apt-get install -y sudo make | ||
git clone https://github.com/freedomofpress/securedrop-builder.git -b bc-build-reqs | ||
cd securedrop-builder | ||
make install-deps | ||
source .venv/bin/activate | ||
PKG_DIR=~/project make requirements | ||
- &check_packaging_requirements | ||
|
@@ -77,24 +76,14 @@ common-steps: | |
# Fail if unstaged changes exist (after `make requirements` in the previous run step). | ||
git diff --ignore-matching-lines=# --exit-code | ||
- &check_testing_requirements | ||
run: | ||
name: Ensure that the same Python requirements are used for development/testing and production. | ||
command: | | ||
set -e | ||
export VERSION_CODENAME=$(~/project/scripts/codename) | ||
make venv | ||
source .venv/bin/activate | ||
make requirements | ||
git diff --exit-code requirements/dev-${VERSION_CODENAME}-requirements.txt | ||
- &build_debian_package | ||
run: | ||
name: Build debian package | ||
command: | | ||
cd ~/packaging/securedrop-debian-packaging | ||
cd ~/packaging/securedrop-builder | ||
export PKG_VERSION=1000.0 | ||
export PKG_PATH=~/project/ | ||
source .venv/bin/activate | ||
make securedrop-export | ||
version: 2.1 | ||
|
@@ -147,14 +136,6 @@ jobs: | |
- checkout | ||
- *check_python_dependencies_for_vulnerabilities | ||
|
||
check-testing-requirements: | ||
parameters: *parameters | ||
docker: *docker | ||
steps: | ||
- *install_testing_dependencies | ||
- checkout | ||
- *check_testing_requirements | ||
|
||
workflows: | ||
securedrop_export_ci: | ||
jobs: &jobs | ||
|
@@ -166,8 +147,6 @@ workflows: | |
- bookworm | ||
- lint: | ||
matrix: *matrix | ||
- check-testing-requirements: | ||
matrix: *matrix | ||
- check-security: | ||
matrix: *matrix | ||
- check-python-security: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.