Skip to content

Commit 60d1271

Browse files
committed
Upgrade setup-python and use cache
1 parent ae07f28 commit 60d1271

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

.github/workflows/python-package.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ jobs:
3939
steps:
4040
- uses: actions/checkout@v4
4141
- name: Set up Python ${{ matrix.python-version }}
42-
uses: actions/setup-python@v4
42+
uses: actions/setup-python@v5
4343
with:
4444
python-version: ${{ matrix.python-version }}
45+
cache: 'pip'
4546
- name: Install Linux dependencies for Python 2
4647
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '2.7' }}
4748
run: |
@@ -52,16 +53,10 @@ jobs:
5253
run: |
5354
sudo apt update
5455
sudo apt install python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 gnome-keyring
55-
- name: Install PyGObject on Linux
56-
if: ${{ matrix.os == 'ubuntu-latest' }}
57-
run: |
58-
python -m pip install --upgrade pip
59-
python -m pip install pygobject
6056
- name: Install Python dependencies
6157
run: |
6258
python -m pip install --upgrade pip
63-
python -m pip install pylint tox pytest
64-
pip install .
59+
pip install -r requirements.txt
6560
- name: Lint
6661
if: ${{ matrix.lint == 'true' }}
6762
run: |
@@ -100,9 +95,10 @@ jobs:
10095
steps:
10196
- uses: actions/checkout@v4
10297
- name: Set up Python 3.9
103-
uses: actions/setup-python@v4
98+
uses: actions/setup-python@v5
10499
with:
105100
python-version: 3.9
101+
cache: 'pip'
106102
- name: Build a package for release
107103
run: |
108104
python -m pip install build --user

requirements.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Github actions/setup-python might need a requirements.txt to cache dependencies
2+
# https://github.com/actions/setup-python?tab=readme-ov-file#caching-packages-dependencies
3+
pygobject; sys_platform == 'linux'
4+
pylint
5+
tox
6+
pytest
7+
-e .

0 commit comments

Comments
 (0)