Skip to content

Commit

Permalink
Generate and delete temporary dummy pyproject.toml to hack setup-pyth…
Browse files Browse the repository at this point in the history
…on cache.
  • Loading branch information
kdeldycke committed Jan 31, 2024
1 parent 96e6cf2 commit 89d73b1
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 11 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/autofix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
# We're going to browse all new commits.
fetch-depth: 0
- name: Hack setup-python cache
# XXX Create an empty requirements.txt if this file (or pyproject.toml) doesn't exist.
id: setup_python_hack
# XXX Create an empty pyproject.toml if this file (or requirements.txt) doesn't exist.
# This work around and issue with setup-python for non-Python projects, which ends up with ends up
# with this error:
#
Expand All @@ -62,11 +63,16 @@ jobs:
# or https://github.com/actions/setup-python/issues/751
if: hashFiles('**/requirements.txt', '**/pyproject.toml') == ''
run: |
touch ./requirements.txt
touch ./pyproject.toml
echo "tmp_deps_file=true" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v5.0.0
with:
python-version: "3.12"
cache: "pip"
- name: Remove setup-python hack
if: steps.setup_python_hack.outputs.tmp_deps_file
run: |
rm ./pyproject.toml
- name: Install pip
run: |
python -m pip install --upgrade pip
Expand All @@ -91,7 +97,8 @@ jobs:
steps:
- uses: actions/checkout@v4.1.1
- name: Hack setup-python cache
# XXX Create an empty requirements.txt if this file (or pyproject.toml) doesn't exist.
id: setup_python_hack
# XXX Create an empty pyproject.toml if this file (or requirements.txt) doesn't exist.
# This work around and issue with setup-python for non-Python projects, which ends up with ends up
# with this error:
#
Expand All @@ -110,10 +117,15 @@ jobs:
if: hashFiles('**/requirements.txt', '**/pyproject.toml') == ''
run: |
touch ./pyproject.toml
echo "tmp_deps_file=true" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v5.0.0
with:
python-version: "3.12"
cache: "pip"
- name: Remove setup-python hack
if: steps.setup_python_hack.outputs.tmp_deps_file
run: |
rm ./pyproject.toml
- name: Install pip
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -227,7 +239,8 @@ jobs:
steps:
- uses: actions/checkout@v4.1.1
- name: Hack setup-python cache
# XXX Create an empty requirements.txt if this file (or pyproject.toml) doesn't exist.
id: setup_python_hack
# XXX Create an empty pyproject.toml if this file (or requirements.txt) doesn't exist.
# This work around and issue with setup-python for non-Python projects, which ends up with ends up
# with this error:
#
Expand All @@ -245,11 +258,16 @@ jobs:
# or https://github.com/actions/setup-python/issues/751
if: hashFiles('**/requirements.txt', '**/pyproject.toml') == ''
run: |
touch ./requirements.txt
touch ./pyproject.toml
echo "tmp_deps_file=true" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v5.0.0
with:
python-version: "3.12"
cache: "pip"
- name: Remove setup-python hack
if: steps.setup_python_hack.outputs.tmp_deps_file
run: |
rm ./pyproject.toml
- name: Install pip
run: |
python -m pip install --upgrade pip
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ jobs:
# We're going to browse all new commits.
fetch-depth: 0
- name: Hack setup-python cache
# XXX Create an empty requirements.txt if this file (or pyproject.toml) doesn't exist.
id: setup_python_hack
# XXX Create an empty pyproject.toml if this file (or requirements.txt) doesn't exist.
# This work around and issue with setup-python for non-Python projects, which ends up with ends up
# with this error:
#
Expand All @@ -170,11 +171,16 @@ jobs:
# or https://github.com/actions/setup-python/issues/751
if: hashFiles('**/requirements.txt', '**/pyproject.toml') == ''
run: |
touch ./requirements.txt
touch ./pyproject.toml
echo "tmp_deps_file=true" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v5.0.0
with:
python-version: "3.12"
cache: "pip"
- name: Remove setup-python hack
if: steps.setup_python_hack.outputs.tmp_deps_file
run: |
rm ./pyproject.toml
- name: Install pip
run: |
python -m pip install --upgrade pip
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ jobs:
# We're going to browse all new commits.
fetch-depth: 0
- name: Hack setup-python cache
# XXX Create an empty requirements.txt if this file (or pyproject.toml) doesn't exist.
id: setup_python_hack
# XXX Create an empty pyproject.toml if this file (or requirements.txt) doesn't exist.
# This work around and issue with setup-python for non-Python projects, which ends up with ends up
# with this error:
#
Expand All @@ -48,11 +49,16 @@ jobs:
# or https://github.com/actions/setup-python/issues/751
if: hashFiles('**/requirements.txt', '**/pyproject.toml') == ''
run: |
touch ./requirements.txt
touch ./pyproject.toml
echo "tmp_deps_file=true" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v5.0.0
with:
python-version: "3.12"
cache: "pip"
- name: Remove setup-python hack
if: steps.setup_python_hack.outputs.tmp_deps_file
run: |
rm ./pyproject.toml
- name: Install pip
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -111,7 +117,8 @@ jobs:
steps:
- uses: actions/checkout@v4.1.1
- name: Hack setup-python cache
# XXX Create an empty requirements.txt if this file (or pyproject.toml) doesn't exist.
id: setup_python_hack
# XXX Create an empty pyproject.toml if this file (or requirements.txt) doesn't exist.
# This work around and issue with setup-python for non-Python projects, which ends up with ends up
# with this error:
#
Expand All @@ -129,11 +136,16 @@ jobs:
# or https://github.com/actions/setup-python/issues/751
if: hashFiles('**/requirements.txt', '**/pyproject.toml') == ''
run: |
touch ./requirements.txt
touch ./pyproject.toml
echo "tmp_deps_file=true" >> "$GITHUB_OUTPUT"
- uses: actions/setup-python@v5.0.0
with:
python-version: "3.12"
cache: "pip"
- name: Remove setup-python hack
if: steps.setup_python_hack.outputs.tmp_deps_file
run: |
rm ./pyproject.toml
- name: Install pip
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
This version is not released yet and is under active development.
```

- Generate dummy `pyproject.toml` instead of `requirements.txt` everywhere to bypass `setup-python` cache limits for non-Python repositories. Remove the temporary `pyproject.toml` dummy after the fact.

## [2.26.4 (2024-01-30)](https://github.com/kdeldycke/workflows/compare/v2.26.3...v2.26.4)

- Generate a dummy `pyproject.toml` instead of `requirements.txt` to make our ruff local conf work.
Expand Down

0 comments on commit 89d73b1

Please sign in to comment.