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

Fix cache issue with the build workflow #810

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Fix cache issue with the build workflow #810

merged 1 commit into from
Apr 18, 2024

Conversation

delatrie
Copy link
Contributor

@delatrie delatrie commented Apr 18, 2024

Context

Starting from version 69.3.0, Setuptools canonicalizes filenames of a source distribution according to PEP 625. Notably, all hyphens (-) are replaced with underscores (_) in the distribution name.

That leads to the following error when installing previously built common packages during a testing job of the build workflow:

Run pip install dist/allure-python-commons*.tar.gz \
WARNING: Requirement 'dist/allure-python-commons*.tar.gz' looks like a filename, but the file does not exist
Processing ./dist/allure-python-commons*.tar.gz
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/home/runner/work/allure-python/allure-python/dist/allure-python-commons*.tar.gz'

If we run ls dist before pip install, we see the following content:

allure_python_commons-0.1.dev1+g2070930-py3-none-any.whl
allure_python_commons-0.1.dev1+g2070930.tar.gz
allure_python_commons_test-0.1.dev1+g2070930-py3-none-any.whl
allure_python_commons_test-0.1.dev1+g2070930.tar.gz

Although a simple fix of the pip install command would be enough, I've decided to eliminate caching altogether and replace it with direct installation from the corresponding directory. The caching doesn't save us anything:

PS > python -m venv env && ./env/bin/Activate.ps1 &&  measure-command { pip install ./dist/allure_python_commons-2.13.6.dev1+gf185ccc.tar.gz }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 11
Milliseconds      : 705
Ticks             : 117050592
TotalDays         : 0.000135475222222222
TotalHours        : 0.00325140533333333
TotalMinutes      : 0.19508432
TotalSeconds      : 11.7050592
TotalMilliseconds : 11705.0592

PS > rm -rf env && python -m venv env && ./env/bin/Activate.ps1 && measure-command { pip install ./allure-python-commons }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 10
Milliseconds      : 378
Ticks             : 103782877
TotalDays         : 0.000120119070601852
TotalHours        : 0.00288285769444444
TotalMinutes      : 0.172971461666667
TotalSeconds      : 10.3782877
TotalMilliseconds : 10378.2877

In fact, it only makes the build longer and more complicated.

@delatrie delatrie added the type:internal Change that isn't visible or obvious for end users label Apr 18, 2024
  - remove build & cache of commons (install from dirs instead)
  - fix install packages command
@delatrie delatrie requested a review from skhomuti April 18, 2024 16:52
@delatrie delatrie self-assigned this Apr 18, 2024
@delatrie delatrie marked this pull request as ready for review April 18, 2024 16:52
@delatrie delatrie merged commit cdae0ba into master Apr 18, 2024
6 checks passed
@delatrie delatrie deleted the ci-cache-fix branch April 18, 2024 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:internal Change that isn't visible or obvious for end users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants