Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests wheel reproducibility against version control #243

Merged
merged 4 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ jobs:
command: |
make install-deps
make lint-desktop-files
virtualenv -p python3 .venv
virtualenv -p /usr/bin/python3 .venv
source .venv/bin/activate
pip install -r test-requirements.txt
sudo sed -i -re "292s/^(\s+).*\$/\1return _.prepend_to_build_command_raw('')/" /usr/lib/python3/dist-packages/reprotest/build.py
Expand All @@ -241,7 +241,7 @@ jobs:
name: install test requirements and run tests
command: |
make install-deps
virtualenv -p python3 .venv
virtualenv -p /usr/bin/python3 .venv
source .venv/bin/activate
pip install -r test-requirements.txt
sudo sed -i -re "292s/^(\s+).*\$/\1return _.prepend_to_build_command_raw('')/" /usr/lib/python3/dist-packages/reprotest/build.py
Expand All @@ -256,7 +256,7 @@ jobs:
name: install test requirements and run tests
command: |
make install-deps
virtualenv -p python3 .venv
virtualenv -p /usr/bin/python3 .venv
source .venv/bin/activate
pip install -r test-requirements.txt
# Patch reprotest in-place to skip 'setarch' prefix, which fails under containers.
Expand Down
13 changes: 13 additions & 0 deletions tests/test_reproducible_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def get_repo_root():
return top_level


@pytest.mark.skip(reason="Comparing to version control is sufficient")
@pytest.mark.parametrize("repo_name", REPOS_WITH_WHEELS)
def test_wheel_builds_are_reproducible(repo_name):
"""
Expand Down Expand Up @@ -45,3 +46,15 @@ def test_wheel_builds_are_reproducible(repo_name):
]
repo_root = get_repo_root()
subprocess.check_call(cmd, env=cmd_env, cwd=repo_root)


@pytest.mark.parametrize("repo_name", REPOS_WITH_WHEELS)
def test_wheel_builds_match_version_control(repo_name):
repo_url = f"https://github.com/freedomofpress/{repo_name}"
build_cmd = f"./scripts/build-sync-wheels -p {repo_url} --clobber".split()
subprocess.check_call(build_cmd)
# Check for modified files (won't catch new, untracked files)
subprocess.check_call("git diff --exit-code".split())
# Check for new, untracked files. Test will fail if working copy is dirty
# in any way, so mostly useful in CI.
assert subprocess.check_output("git status --porcelain".split()) == b""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should keep this command in mind. Thank you @conorsch.