Skip to content

Commit

Permalink
Merge pull request #506 from freedomofpress/poetry-deps
Browse files Browse the repository at this point in the history
Specify test dependencies using poetry
  • Loading branch information
cfm authored Jan 9, 2025
2 parents 0433b45 + b9efb8d commit 5958e51
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 18 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@ jobs:
steps:
- name: Bootstrap Debian system package dependencies
run: |
apt-get update && apt-get install --yes --no-install-recommends make sudo git git-lfs ca-certificates
apt-get update && apt-get install --yes --no-install-recommends make sudo git git-lfs ca-certificates \
python3-poetry
- uses: actions/checkout@v4
with:
lfs: true
- name: Install additional packages and Python dependencies
run: |
# Installs Python & bootstrap wheels, and initializes a virtualenv at .venv
make install-deps
./.venv/bin/pip install -r test-requirements.txt
poetry install --no-ansi
- name: Run linters
run: |
. ./.venv/bin/activate
make lint
- name: Run tests except reprotest
run: |
. ./.venv/bin/activate
make test
checksums:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/reprotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ jobs:
steps:
- name: Bootstrap Debian system package dependencies
run: |
apt-get update && apt-get install --yes --no-install-recommends make sudo git git-lfs ca-certificates
apt-get update && apt-get install --yes --no-install-recommends make sudo git git-lfs ca-certificates \
python3-poetry
- uses: actions/checkout@v4
with:
lfs: true
- name: Install additional packages and Python dependencies
run: |
# Installs Python & bootstrap wheels, and initializes a virtualenv at .venv
make install-deps
./.venv/bin/pip install -r test-requirements.txt
# Install poetry deps into the .venv
poetry install --no-ansi
- name: Test wheel reproducibility
run: |
# Necessary to enable git operations without permission issues
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ SHELL := /bin/bash

.PHONY: lint
lint:
@ruff check .
@ruff format --check .
@poetry run ruff check .
@poetry run ruff format --check .

.PHONY: fix
fix:
@ruff check . --fix
@ruff format .
@poetry run ruff check . --fix
@poetry run ruff format .

.PHONY: install-deps
install-deps: ## Install initial wheel building dependencies
Expand All @@ -28,11 +28,11 @@ build-wheels: ## Builds the wheels and adds them to the wheels subdirectory

.PHONY: test
test: ## Run simple test suite (skips reproducibility checks)
pytest -v tests/test_update_requirements.py tests/test_utils.py
poetry run pytest -v tests/test_update_requirements.py tests/test_utils.py

.PHONY: reprotest
reprotest: ## Runs only reproducibility tests for .whl files
pytest -vvs tests/test_reproducible_wheels.py
poetry run pytest -vvs tests/test_reproducible_wheels.py

.PHONY: help
help: ## Prints this message and exits
Expand Down
129 changes: 129 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ name = "securedrop-builder"
version = "0.1.0"
requires-python = ">=3.9"

[tool.poetry]
name = "securedrop-builder"
version = "0.1.0"
description = ""
authors = []

[tool.poetry.dependencies]
python = ">=3.11"

[tool.poetry.group.dev.dependencies]
pytest = "*"
pytest-mock = "*"
ruff = "*"
virtualenv = "<16"

[tool.ruff]
line-length = 100

Expand Down
4 changes: 0 additions & 4 deletions test-requirements.txt

This file was deleted.

0 comments on commit 5958e51

Please sign in to comment.