Skip to content

Commit f865ada

Browse files
committed
ci: cache brew/conda/pip to speed up macOS and Windows CI
1 parent e21d592 commit f865ada

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

.github/workflows/unittest.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,27 @@ jobs:
2626
uses: actions/setup-python@v4
2727
with:
2828
python-version: ${{ matrix.python-version }}
29+
- name: Cache Homebrew (macOS)
30+
if: runner.os == 'macOS'
31+
uses: actions/cache@v4
32+
with:
33+
path: |
34+
/opt/homebrew/Cellar/openfst
35+
/opt/homebrew/include/fst
36+
/opt/homebrew/lib/libfst*
37+
key: brew-openfst-${{ runner.os }}
2938
- name: Install openfst (macOS)
3039
if: runner.os == 'macOS'
3140
run: |
32-
brew install openfst
41+
brew install openfst || true
3342
echo "CPLUS_INCLUDE_PATH=/opt/homebrew/include:$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
3443
echo "LIBRARY_PATH=/opt/homebrew/lib:$LIBRARY_PATH" >> $GITHUB_ENV
44+
- name: Cache pip (non-Windows)
45+
if: runner.os != 'Windows'
46+
uses: actions/cache@v4
47+
with:
48+
path: ~/.cache/pip
49+
key: pip-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
3550
- name: Install dependencies (non-Windows)
3651
if: runner.os != 'Windows'
3752
run: |
@@ -43,6 +58,13 @@ jobs:
4358
with:
4459
python-version: ${{ matrix.python-version }}
4560
activate-environment: test
61+
use-only-tar-bz2: true
62+
- name: Cache Conda (Windows)
63+
if: runner.os == 'Windows'
64+
uses: actions/cache@v4
65+
with:
66+
path: C:\Miniconda\envs\test
67+
key: conda-${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
4668
- name: Install dependencies (Windows)
4769
if: runner.os == 'Windows'
4870
shell: bash -el {0}

0 commit comments

Comments
 (0)