Skip to content

Commit 896b7b6

Browse files
committed
CI: Use ccache
1 parent 7a5e1d8 commit 896b7b6

File tree

9 files changed

+47
-15
lines changed

9 files changed

+47
-15
lines changed

.github/actions/build_pandas/action.yml renamed to .github/actions/build-pandas/action.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ description: Rebuilds the C extensions and installs pandas
33
runs:
44
using: composite
55
steps:
6-
7-
- name: Environment Detail
8-
run: |
9-
micromamba info
10-
micromamba list
11-
shell: bash -el {0}
6+
- name: Set up Ccache
7+
uses: ./.github/actions/setup-ccache
128

139
- name: Build Pandas
1410
if : ${{ runner.os != 'Windows' }}
1511
run: |
16-
pip install -e . --no-build-isolation -v
12+
python -m pip install . --no-build-isolation -v
1713
shell: bash -el {0}
1814

1915
- name: Build Pandas (Windows)
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Setup sccache
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Make cache key
6+
id: cache-key
7+
run: |
8+
key="${{ runner.os }}--${{ runner.arch }}--${{ github.workflow }}"
9+
# Date: Daily invalidation of all ccaches as an extra safety measure.
10+
key="$key--$(/bin/date -u '+%Y%m%d')"
11+
# Python version: Separate caches for each Python version. This reduces the number of cache misses.
12+
key="$key--$(python -V)"
13+
# Cache version: Bump this number to manually invalidate the cache.
14+
key="$key--0"
15+
16+
echo "cache-key=$key" >> $GITHUB_OUTPUT
17+
shell: bash
18+
19+
# On Windows, for some reason the default temporary directory provided to sccache
20+
# may become read-only at some point. Work around by having a private tempdir.
21+
- name: Fix Windows temporary directory
22+
id: mktemp
23+
run: echo "tmpdir=$(cygpath -w $(mktemp -d))" >> $GITHUB_OUTPUT
24+
shell: bash
25+
if: ${{ runner.os == 'Windows' }}
26+
27+
- name: Setup sccache
28+
uses: hendrikmuhs/[email protected]
29+
with:
30+
variant: sccache
31+
key: ${{ steps.cache-key.outputs.cache-key }}
32+
env:
33+
TMP: "${{ steps.mktemp.outputs.tmpdir }}"

.github/actions/setup-conda/action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ runs:
1919
run: |
2020
grep -q ' - pyarrow' ${{ inputs.environment-file }}
2121
sed -i"" -e "s/ - pyarrow/ - pyarrow=${{ inputs.pyarrow-version }}/" ${{ inputs.environment-file }}
22+
echo ::group::Patched environment.yml contents
2223
cat ${{ inputs.environment-file }}
24+
echo ::endgroup::
2325
shell: bash
2426
if: ${{ inputs.pyarrow-version }}
2527

.github/workflows/code-checks.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262

6363
- name: Build Pandas
6464
id: build
65-
uses: ./.github/actions/build_pandas
65+
uses: ./.github/actions/build-pandas
6666

6767
# The following checks are independent of each other and should still be run if one fails
6868
- name: Check for no warnings when building single-page docs
@@ -125,7 +125,7 @@ jobs:
125125

126126
- name: Build Pandas
127127
id: build
128-
uses: ./.github/actions/build_pandas
128+
uses: ./.github/actions/build-pandas
129129

130130
- name: Run ASV benchmarks
131131
run: |

.github/workflows/docbuild-and-upload.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
uses: ./.github/actions/setup-conda
4545

4646
- name: Build Pandas
47-
uses: ./.github/actions/build_pandas
47+
uses: ./.github/actions/build-pandas
4848

4949
- name: Set up maintainers cache
5050
uses: actions/cache@v3

.github/workflows/macos-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
pyarrow-version: ${{ matrix.os == 'macos-latest' && '9' || '' }}
5757

5858
- name: Build Pandas
59-
uses: ./.github/actions/build_pandas
59+
uses: ./.github/actions/build-pandas
6060

6161
- name: Test
6262
uses: ./.github/actions/run-tests

.github/workflows/ubuntu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jobs:
173173
pyarrow-version: ${{ matrix.pyarrow_version }}
174174

175175
- name: Build Pandas
176-
uses: ./.github/actions/build_pandas
176+
uses: ./.github/actions/build-pandas
177177

178178
- name: Test
179179
uses: ./.github/actions/run-tests

environment.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ dependencies:
7171
- asv>=0.5.1
7272

7373
## The compiler packages are meta-packages and install the correct compiler (activation) packages on the respective platforms.
74-
#- c-compiler
75-
#- cxx-compiler
74+
- c-compiler
75+
- cxx-compiler
76+
- sccache
7677

7778
# code checks
7879
- black=22.10.0

scripts/generate_pip_deps_from_conda.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import toml
2121
import yaml
2222

23-
EXCLUDE = {"python", "c-compiler", "cxx-compiler"}
23+
EXCLUDE = {"python", "c-compiler", "cxx-compiler", "sccache"}
2424
REMAP_VERSION = {"tzdata": "2022.1"}
2525
RENAME = {
2626
"pytables": "tables",

0 commit comments

Comments
 (0)