Skip to content

Commit dc0e165

Browse files
authored
hatch-vcs-tunable: update workflows and fix remaining errors (#3)
Update all the workflows to have proper globbing (finally) and then fix the new errors that were detected when the checks finally actually ran.
1 parent 102d93c commit dc0e165

File tree

6 files changed

+129
-112
lines changed

6 files changed

+129
-112
lines changed
Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1+
name: 'pull request checking'
12
on:
23
pull_request_target:
34
types:
45
- opened
5-
- synchronized
6+
- synchronize
67

7-
jobs:
8-
which-paths:
9-
runs-on: ubuntu-latest
10-
outputs:
11-
HATCH_VCS_TUNABLE_DIFF: ${{ steps.hatch-vcs-tunable-diff.outputs.HATCH_VCS_TUNABLE_DIFF }}
12-
steps:
13-
- name: Fetch repo for diffing
14-
uses: actions/checkout@v3
15-
- name: Check if vcs-tunable-analysis changed
16-
uses: actions/get-diff-action@v6
17-
with:
18-
PATTERNS: |
19-
+hatch-vcs-tunable/**/*
20-
+.github/workflows/pull-request.yml
21-
- name: Set diff output for hatch-vcs-tunable
22-
id: hatch-vcs-tunable-diff
23-
run: |
24-
echo "HATCH_VCS_TUNABLE_DIFF=${GIT_DIFF_FILTERED}" >> $GITHUB_OUTPUT
25-
hatch-vcs-tunable-analysis:
26-
runs-on: ubuntu-latest
27-
needs: [which-paths]
28-
if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF }}
29-
steps:
30-
- name: Ask for news fragments
31-
if: ${{ !contains(needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF, changelog.d) }}
32-
run: |
33-
echo 'Please add a news fragment for your change.'
34-
exit 1
8+
jobs:
9+
which-paths:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
HATCH_VCS_TUNABLE_DIFF: ${{ steps.hatch-vcs-tunable-diff.outputs.HATCH_VCS_TUNABLE_DIFF }}
13+
steps:
14+
- name: Fetch repo for diffing
15+
uses: actions/checkout@v3
16+
- name: Check if vcs-tunable-analysis changed
17+
uses: technote-space/get-diff-action@v6
18+
with:
19+
PATTERNS: |
20+
hatch-vcs-tunable/**/*
21+
hatch-vcs-tunable/**/.*
22+
- name: Set diff output for hatch-vcs-tunable
23+
id: hatch-vcs-tunable-diff
24+
run: |
25+
echo "HATCH_VCS_TUNABLE_DIFF=\"${GIT_DIFF_FILTERED}\"" >> $GITHUB_OUTPUT
26+
hatch-vcs-tunable-analysis:
27+
runs-on: ubuntu-latest
28+
needs: [which-paths]
29+
if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF }}
30+
steps:
31+
- name: Ask for news fragments
32+
if: ${{ !contains(needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF, 'changelog.d') }}
33+
run: |
34+
echo 'Please add a news fragment for your change.'
35+
exit 1

.github/workflows/pull-request.yml

Lines changed: 94 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,101 @@
1+
name: 'linting and testing'
12
on:
23
pull_request:
34
types:
45
- opened
5-
- synchronized
6+
- synchronize
67

7-
jobs:
8-
which-paths:
9-
runs-on: ubuntu-latest
10-
outputs:
11-
HATCH_VCS_TUNABLE_DIFF: ${{ steps.hatch-vcs-tunable-diff.outputs.HATCH_VCS_TUNABLE_DIFF }}
12-
MANAGEMENT_DIFF: ${{ steps.management-diff.outputs.MANAGEMENT_DIFF }}
13-
steps:
14-
- name: Fetch repo for diffing
15-
uses: actions/checkout@v3
16-
- name: Check if vcs-tunable-analysis changed
17-
uses: actions/get-diff-action@v6
18-
with:
19-
PATTERNS: |
20-
+hatch-vcs-tunable/**/*
21-
+.github/workflows/pull-request.yml
22-
- name: Set diff output for hatch-vcs-tunable
23-
id: hatch-vcs-tunable-diff
24-
run: |
25-
echo "HATCH_VCS_TUNABLE_DIFF=${GIT_DIFF_FILTERED}" >> $GITHUB_OUTPUT
26-
- name: Check if repo management changed
27-
uses: actions/get-diff-action@v6
28-
with:
29-
PATTERNS: |
30-
-hatch-vcs-tunable/**/*
31-
- name: Set diff output for management
32-
id: management-diff
33-
run: |
34-
echo MANAGEMENT_DIFF=${GIT_DIFF_FILTERED}" >> $GITHUB_OUTPUT
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
3511

36-
hatch-vcs-tunable-analysis:
37-
if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF }}
38-
runs-on: ubuntu-latest
39-
needs: [which-paths]
40-
steps:
41-
- name: Install python
42-
uses: actions/setup-python@v5
43-
with:
44-
python-version: 3.10
45-
- name: Set up python environment
46-
run: |
47-
python -m install pipx
48-
pipx install hatch
49-
- name: Fetch repo
50-
uses: actions/checkout@v3
51-
- name: Create default env
52-
run: hatch env create default
53-
working-directory: hatch-vcs-tunable
54-
- name: Check formatting
55-
run: hatch run format --check
56-
working-directory: hatch-vcs-tunable
57-
- name: Lint
58-
run: hatch run lint
59-
working-directory: hatch-vcs-tunable
60-
- name: Check types
61-
run: hatch run check
62-
- name: Quick tests
63-
run: hatch run test
12+
jobs:
13+
which-paths:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
HATCH_VCS_TUNABLE_DIFF: ${{ steps.hatch-vcs-tunable-diff.outputs.HATCH_VCS_TUNABLE_DIFF }}
17+
MANAGEMENT_DIFF: ${{ steps.management-diff.outputs.MANAGEMENT_DIFF }}
18+
steps:
19+
- name: Fetch repo for diffing
20+
uses: actions/checkout@v3
21+
- name: Check if vcs-tunable-analysis changed
22+
uses: technote-space/get-diff-action@v6
23+
with:
24+
PATTERNS: |
25+
hatch-vcs-tunable/**/*
26+
hatch-vcs-tunable/**/.*
27+
FILES: |
28+
.github/workflows/pull-request.yml
29+
- name: Set diff output for hatch-vcs-tunable
30+
id: hatch-vcs-tunable-diff
31+
run: |
32+
echo "HATCH_VCS_TUNABLE_DIFF=\"$(echo ${GIT_DIFF_FILTERED} | sed 's/ *$//')\"" >> $GITHUB_OUTPUT
33+
- name: Check if repo management changed
34+
uses: technote-space/get-diff-action@v6
35+
with:
36+
PATTERNS: |
37+
**/*
38+
.*
39+
.*/**/*
40+
!hatch-vcs-tunable/**/*
41+
- name: Set diff output for management
42+
id: management-diff
43+
run: |
44+
echo "MANAGEMENT_DIFF=\"$(echo ${GIT_DIFF_FILTERED} | set 's/ *$//')\"" >> $GITHUB_OUTPUT
6445
65-
hatch-vcs-tunable-tests:
66-
if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF }}
67-
needs: [which-paths, hatch-vcs-tunable-analysis]
68-
runs-on: ${{ matrix.env }}
69-
strategy:
70-
fail-fast: true
71-
matrix:
72-
os: [ubuntu-latest, windows-latest, macos-latest]
73-
steps:
74-
- name: Install python
75-
uses: actions/setup-python@v5
76-
with:
77-
python-version: 3.10
78-
- name: Set up python environment
79-
run: |
80-
python -m install pipx
81-
pipx install hatch
82-
- name: Fetch repo
83-
uses: actions/checkout@v3
84-
- name: Create default env
85-
run: hatch env create test
86-
- name: Run all tests
87-
run: hatch run test:test
46+
hatch-vcs-tunable-analysis:
47+
if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF != '""' }}
48+
runs-on: ubuntu-latest
49+
needs: [which-paths]
50+
steps:
51+
- name: Install python
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: '3.10'
55+
- name: Set up python environment
56+
run: |
57+
python -m pip install pipx
58+
pipx install hatch
59+
- name: Fetch repo
60+
uses: actions/checkout@v3
61+
- name: Create default env
62+
run: hatch env create default
63+
working-directory: hatch-vcs-tunable
64+
- name: Check formatting
65+
run: hatch run format --check
66+
working-directory: hatch-vcs-tunable
67+
- name: Lint
68+
run: hatch run lint
69+
working-directory: hatch-vcs-tunable
70+
- name: Check types
71+
run: hatch run check
72+
working-directory: hatch-vcs-tunable
73+
- name: Quick tests
74+
run: hatch run test
75+
working-directory: hatch-vcs-tunable
76+
77+
hatch-vcs-tunable-tests:
78+
if: ${{ needs.which-paths.outputs.HATCH_VCS_TUNABLE_DIFF != '""' }}
79+
needs: [which-paths, hatch-vcs-tunable-analysis]
80+
runs-on: ${{ matrix.os }}
81+
strategy:
82+
fail-fast: true
83+
matrix:
84+
os: [ubuntu-latest, windows-latest, macos-latest]
85+
steps:
86+
- name: Install python
87+
uses: actions/setup-python@v5
88+
with:
89+
python-version: '3.10'
90+
- name: Set up python environment
91+
run: |
92+
python -m pip install pipx
93+
pipx install hatch
94+
- name: Fetch repo
95+
uses: actions/checkout@v3
96+
- name: Create test env
97+
run: hatch env create test
98+
working-directory: hatch-vcs-tunable
99+
- name: Run all tests
100+
run: hatch run test:test
101+
working-directory: hatch-vcs-tunable

hatch-vcs-tunable/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# hatch-vcs-tunable
22

3-
[![PyPI - Version](https://img.shields.io/pypi/v/hatch-git-version-tunable.svg)](https://pypi.org/project/hatch-git-version-tunable)
4-
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-git-version-tunable.svg)](https://pypi.org/project/hatch-git-version-tunable)
3+
[![PyPI - Version](https://img.shields.io/pypi/v/hatch-git-version-tunable.svg)](https://pypi.org/project/hatch-vcs-tunable)
4+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-git-version-tunable.svg)](https://pypi.org/project/hatch-vcs-tunable)
55
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
66
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
77

hatch-vcs-tunable/src/hatch_vcs_tunable/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
from ._version import __version__, __version_tuple__
66

7-
__ALL__ = ['__version__', '__version_tuple__']
7+
__all__ = ["__version__", "__version_tuple__"]

hatch-vcs-tunable/src/hatch_vcs_tunable/version_source.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44
"""A version source extending hatch_vcs with the ability to set configuration from the environment."""
5+
from __future__ import annotations
56
from os import environ
67
from collections import deque
78
from typing import Iterable

hatch-vcs-tunable/tests/test_version_source.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
from __future__ import annotations
56
import pytest
67

78
from hatch_vcs_tunable.version_source import TunableVCSVersionSource

0 commit comments

Comments
 (0)