Skip to content

Commit

Permalink
Use uv to install tools
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Jun 5, 2024
1 parent 43531f5 commit fe28503
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 32 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/autofix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ jobs:
**/pyproject.toml
*requirements.txt
requirements/*.txt
- name: Install pip
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt
- name: Install Ruff, blacken-docs and autopep8
run: >
python -m pip install --requirement
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/format-python.txt
run: |
uv venv --system
uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/format-python.txt
- name: Run autopep8
if: needs.project-metadata.outputs.python_files
# Ruff is not wrapping comments: https://github.com/astral-sh/ruff/issues/7414
Expand All @@ -149,6 +149,7 @@ jobs:
# - --aggressive is requires to force autopep8 to consider comments.
# Explicit list of files is provided, as autopep8 is not able to handle find files in ".github" subdirectory.
run: >
source .venv/bin/activate &&
autopep8 --recursive --in-place --max-line-length 88 --select E501 --aggressive
${{ needs.project-metadata.outputs.python_files }}
- name: Optional Ruff config
Expand Down Expand Up @@ -206,11 +207,13 @@ jobs:
cat ./ruff.toml
- name: Run Ruff check
run: >
source .venv/bin/activate &&
ruff check --config ./ruff.toml
- name: Run Ruff format
# XXX: Ruff is planning to support linting and formatting in one unified command at one point.
# See: https://github.com/astral-sh/ruff/issues/8232
run: |
run: >
source .venv/bin/activate &&
ruff format --config ./ruff.toml
- name: Remove temporary Ruff config
run: |
Expand All @@ -225,6 +228,7 @@ jobs:
# TODO: replace blacken-docs by ruff. See: https://github.com/astral-sh/ruff/issues/8237
# https://github.com/astral-sh/ruff/issues/3792
run: >

Check failure on line 230 in .github/workflows/autofix.yaml

View workflow job for this annotation

GitHub Actions / lint-github-action

shellcheck reported issue in this script: SC2015:info:1:27: Note that A && B || C is not if-then-else. C may run when A is true
source .venv/bin/activate &&
blacken-docs
--line-length 88
${{ needs.project-metadata.outputs.blacken_docs_params }}
Expand Down
37 changes: 23 additions & 14 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,23 @@ jobs:
**/pyproject.toml
*requirements.txt
requirements/*.txt
- name: Install pip
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt
- name: Install bump-my-version
run: >
python -m pip install --requirement
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/changelog.txt
run: |
uv venv --system
uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/changelog.txt
- name: ${{ matrix.part }} version bump
# TODO: get configuration URL once https://github.com/callowayproject/bump-my-version/issues/148 is addressed,
# so we can factorize projects' pyproject.toml files to kdeldycke/workflow/pyproject.toml .
run: |
run: >
source .venv/bin/activate &&
bump-my-version bump --verbose ${{ matrix.part }}
- name: Extract version
id: get_version
run: |
run: >
source .venv/bin/activate &&
echo "new_version=$( bump-my-version show current_version )" >> "$GITHUB_OUTPUT"
- name: Print version
run: |
Expand Down Expand Up @@ -119,16 +121,17 @@ jobs:
**/pyproject.toml
*requirements.txt
requirements/*.txt
- name: Install pip
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt
- name: Install bump-my-version
run: >
python -m pip install --requirement
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/changelog.txt
run: |
uv venv --system
uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/changelog.txt
- name: Extract version
id: get_version
run: |
run: >
source .venv/bin/activate &&
echo "current_version=$( bump-my-version show current_version )" >> "$GITHUB_OUTPUT"
- name: Print version
run: |
Expand All @@ -140,26 +143,30 @@ jobs:
# This hack could be removed if we manage to encode these search and replace patterns into bump-my-version's
# TOML.
run: >
source .venv/bin/activate &&
RELEASE_DEFAULT_BRANCH="main" &&
bump-my-version replace --no-configured-files --ignore-missing-version
--search "/workflows/$RELEASE_DEFAULT_BRANCH/"
--replace "/workflows/v{current_version}/"
./.github/workflows/*.yaml
- name: Set release date in changelog
run: >
source .venv/bin/activate &&
bump-my-version replace --no-configured-files
--search " (unreleased)"
--replace " ({utcnow:%Y-%m-%d})"
./changelog.md
- name: Update comparison URL in changelog
run: >
source .venv/bin/activate &&
bump-my-version replace --no-configured-files
--search "...main"
--replace "...v{current_version}"
./changelog.md
- name: Remove first warning message in changelog
# Matches first occurrence of a multi-line block of text delimited by triple-backticks (```<anything>```).
run: >
source .venv/bin/activate &&
bump-my-version replace --no-configured-files --ignore-missing-version
--regex --search "^\\\`\\\`\\\`.*?\\\`\\\`\\\`\\n\\n"
--replace ""
Expand All @@ -181,6 +188,7 @@ jobs:
# This hack could be removed if we manage to encode these search and replace patterns into bump-my-version's
# TOML.
run: >
source .venv/bin/activate &&
RELEASE_DEFAULT_BRANCH="main" &&
bump-my-version replace --no-configured-files --ignore-missing-version
--search "/workflows/v{current_version}/"
Expand All @@ -193,7 +201,8 @@ jobs:
- name: Version bump
# TODO: get configuration URL once https://github.com/callowayproject/bump-my-version/issues/148 is addressed,
# so we can factorize projects' pyproject.toml files to kdeldycke/workflow/pyproject.toml .
run: |
run: >
source .venv/bin/activate &&
bump-my-version bump --verbose patch
- name: Commit post-release version bump
run: |
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,20 +221,20 @@ jobs:
**/pyproject.toml
*requirements.txt
requirements/*.txt
- name: Install pip
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt
- name: Install pipdeptree and Poetry on system
run: >
python -m pip install --requirement
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/pipdeptree.txt
--requirement
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/build.txt
run: |
uv venv --system
uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/pipdeptree.txt \
-r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/build.txt
- name: Install project with Poetry
run: |
poetry install --only main --no-interaction
- name: Run pipdeptree for debug
run: >
source .venv/bin/activate &&
pipdeptree --python auto ${{ needs.project-metadata.outputs.package_name
&& format('--packages {0}', needs.project-metadata.outputs.package_name)}}
- name: Create dir structure
Expand All @@ -244,6 +244,7 @@ jobs:
# See: https://github.com/tox-dev/pipdeptree/issues/107
- name: Generate graph
run: >
source .venv/bin/activate &&
pipdeptree --python auto ${{ needs.project-metadata.outputs.package_name
&& format('--packages {0}', needs.project-metadata.outputs.package_name)}}
--mermaid > ${{ inputs.dependency-graph-output }}
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,16 @@ jobs:
if: steps.setup_python_hack.outputs.tmp_deps_file
run: |
rm ./pyproject.toml
- name: Install pip
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/uv.txt
- name: Install yamllint
run: >
python -m pip install --requirement
https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/yamllint.txt
run: |
uv venv --system
uv pip install -r https://raw.githubusercontent.com/kdeldycke/workflows/main/requirements/yamllint.txt
- name: Run yamllint
run: |
source .venv/bin/activate &&
yamllint --strict --config-data "{rules: {line-length: {max: 120}}}" --format github .
lint-zsh:
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.
```

- Use `uv` to install tools.

## [3.5.6 (2024-06-05)](https://github.com/kdeldycke/workflows/compare/v3.5.5...v3.5.6)

- Use `uv` to install `mdformat`.
Expand Down

0 comments on commit fe28503

Please sign in to comment.