Skip to content

Commit 10ea8f4

Browse files
committed
Update GitHub workflows to use pypa/hatch@install
1 parent caa4db6 commit 10ea8f4

File tree

2 files changed

+51
-46
lines changed
  • .github/workflows
  • {{cookiecutter.package_name}}/.github/workflows

2 files changed

+51
-46
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,61 @@ name: Python Package Workflow
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches:
6+
- master
67
pull_request:
7-
branches: [ master ]
8+
branches:
9+
- master
810

911
jobs:
1012
build:
1113

12-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-24.04
1315
strategy:
1416
matrix:
1517
python-version: ["3.11", "3.12", "3.13"]
1618

1719
steps:
18-
- uses: actions/checkout@v3
19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v4
21-
with:
22-
python-version: ${{ matrix.python-version }}
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install -r requirements.txt
27-
- name: Cache pip dependencies
28-
uses: actions/cache@v3
29-
with:
30-
path: ~/.cache/pip # This path is specific to Ubuntu
31-
# Check for a cache hit for the corresponding dev requirements file
32-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
33-
restore-keys: |
34-
${{ runner.os }}-pip-
35-
${{ runner.os }}-
36-
- name: Generate example project
37-
run: |
38-
cookiecutter --no-input . package_name=example
39-
- name: Check example project
40-
run: |
41-
cd example
42-
make venv
43-
. venv/bin/activate
44-
make help
45-
make style
46-
make check-style
47-
make check-static-analysis
48-
make test
49-
make test-verbose
50-
make coverage
51-
make check-docs
52-
make docs
53-
make dist
54-
make dist-test
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install Hatch
28+
uses: pypa/hatch@install
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -r requirements.txt
34+
35+
- name: Cache pip dependencies
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.cache/pip # This path is specific to Ubuntu
39+
# Check for a cache hit for the corresponding dev requirements file
40+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
41+
restore-keys: |
42+
${{ runner.os }}-pip-
43+
${{ runner.os }}-
44+
45+
- name: Generate example project
46+
run: |
47+
cookiecutter --no-input . package_name=example
48+
49+
- name: Check example project
50+
run: |
51+
cd example
52+
make help
53+
make style
54+
make check-style
55+
make check-static-analysis
56+
make test
57+
make test-verbose
58+
make coverage
59+
make check-docs
60+
make docs
61+
make dist
62+
make dist-test

{{cookiecutter.package_name}}/.github/workflows/ci.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
with:
2525
python-version: ${{ env.PYTHON_VERSION }}
2626

27+
- name: Install Hatch
28+
uses: pypa/hatch@install
29+
2730
- name: Cache pip dependencies and hatch environments
2831
id: cache
2932
uses: actions/cache@v4
@@ -36,12 +39,6 @@ jobs:
3639
key: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pip-hatch-${{ hashFiles('pyproject.toml') }}
3740
restore-keys: ${{ runner.os }}-${{ env.PYTHON_VERSION }}-pip-hatch-
3841

39-
- name: Install dependencies
40-
if: steps.cache.outputs.cache-hit != 'true'
41-
run: |
42-
python -m pip install -U pip
43-
python -m pip install hatch
44-
4542
- name: Check code style
4643
run: hatch run style:check
4744

0 commit comments

Comments
 (0)