Skip to content

Commit 5420c21

Browse files
committed
ci(pytest): Use apt and brew caches
1 parent 3bdc120 commit 5420c21

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/workflows/pytest.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ jobs:
5252
enable-cache: true
5353
cache-dependency-glob: "pyproject.toml"
5454

55+
- name: Cache apt packages (Linux)
56+
if: matrix.os == 'ubuntu-latest'
57+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
58+
with:
59+
path: /var/cache/apt/archives
60+
key: apt-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('.github/workflows/pytest.yml') }}
61+
restore-keys: |
62+
apt-${{ runner.os }}-py${{ matrix.python-version }}-
63+
apt-${{ runner.os }}-
64+
5565
- name: Install system dependencies for GUI testing on linux
5666
if: matrix.os == 'ubuntu-latest'
5767
run: |
@@ -67,9 +77,18 @@ jobs:
6777
fi
6878
python3 --version && python3 -c "import tkinter; print(tkinter.TclVersion, tkinter.TkVersion)"
6979
80+
- name: Cache Homebrew packages (macOS)
81+
if: matrix.os == 'macos-latest'
82+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
83+
with:
84+
path: ~/Library/Caches/Homebrew
85+
key: brew-${{ runner.os }}-python-tk-${{ hashFiles('.github/workflows/pytest.yml') }}
86+
restore-keys: |
87+
brew-${{ runner.os }}-python-tk-
88+
7089
- name: Install system dependencies for GUI testing on macOS
7190
if: matrix.os == 'macos-latest'
72-
run: brew install python-tk
91+
run: brew list python-tk &>/dev/null || brew install python-tk
7392

7493
- name: Ensure Tcl/Tk search paths
7594
if: matrix.os == 'ubuntu-latest'

0 commit comments

Comments
 (0)