Skip to content

Commit

Permalink
Use architecture in save/restore cache keys
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Paine <[email protected]>
  • Loading branch information
timkpaine committed Feb 3, 2024
1 parent 6da3434 commit 6373797
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
10 changes: 6 additions & 4 deletions .github/actions/setup-caches/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ runs:
# Setup CCache
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}-${{ runner.arch }}

- name: Setup ccache in shell
shell: bash
Expand All @@ -33,8 +35,8 @@ runs:
path: |
~/Library/Caches/Homebrew/*
~/Library/Caches/Homebrew/downloads/*
key: brew-
restore-keys: brew-
key: brew-${{ runner.os }}-${{ runner.arch }}-
restore-keys: brew-${{ runner.os }}-${{ runner.arch }}-
if: ${{ runner.os == 'macOS' }}

################
Expand All @@ -54,6 +56,6 @@ runs:
path: |
~/vcpkg_cache
~/vcpkg_download_cache
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-${{ runner.os }}
key: vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('vcpkg.json') }}
restore-keys: vcpkg-${{ runner.os }}-${{ runner.arch }}-
if: ${{ runner.os != 'Windows' }}
4 changes: 2 additions & 2 deletions .github/actions/setup-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ runs:
- name: Install python dependencies
shell: bash
run: make requirements
if: ${{ runner.os == 'Linux' }} # skip on linux, in docker
if: ${{ runner.os == 'Linux' }}

################
# Linux # NOTE: skip for manylinux image
# - name: Linux init steps
# shell: bash
# run: make dependencies-vcpkg
# if: ${{ runner.os == 'Linux' }} # skip
# if: ${{ runner.os == 'Linux' }} # skip

################
# Mac
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ jobs:
uses: ./.github/actions/setup-dependencies
with:
cibuildwheel: '${{ matrix.cibuildwheel }}'
if: ${{ runner.os == 'macOS' }}

########
# Linux
Expand All @@ -271,6 +272,7 @@ jobs:
env:
CIBW_BUILD: "${{ matrix.cibuildwheel }}-manylinux*"
CIBW_ENVIRONMENT_LINUX: CSP_MANYLINUX="ON" CCACHE_DIR="/host/home/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="/host${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="/host${{ env.VCPKG_DOWNLOADS }}"
CIBW_BUILD_VERBOSITY: 3
if: ${{ runner.os == 'Linux' }}

########
Expand All @@ -281,16 +283,25 @@ jobs:
CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*"
CIBW_ENVIRONMENT_MACOS: CC="/usr/local/bin/gcc-13" CXX="/usr/local/bin/g++-13" CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}"
CIBW_ARCHS_MACOS: x86_64
CIBW_BUILD_VERBOSITY: 3
if: ${{ matrix.os == 'macos-12' }}

- name: Python Build Steps (arm)
- name: Python Build Steps (Macos arm)
run: make dist-py-cibw
env:
CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*"
CIBW_ENVIRONMENT_MACOS: CC="/usr/local/bin/gcc-13" CXX="/usr/local/bin/g++-13" CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}"
CIBW_ENVIRONMENT_MACOS: PATH="/opt/homebrew/opt/bison/bin/:$PATH" CC="/opt/homebrew/bin/gcc-13" CXX="/opt/homebrew/bin/g++-13" CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}"
CIBW_ARCHS_MACOS: arm64
CIBW_BUILD_VERBOSITY: 3
if: ${{ matrix.os == 'macos-14' }}

- name: Debug 14 build
run: |
cat /Users/runner/work/csp/csp/vcpkg/buildtrees/detect_compiler/config-arm64-osx-rel-CMakeCache.txt.log
cat /Users/runner/work/csp/csp/vcpkg/buildtrees/detect_compiler/config-arm64-osx-rel-out.log
cat /Users/runner/work/csp/csp/vcpkg/buildtrees/detect_compiler/config-arm64-osx-rel-err.log
if: ${{ matrix.os == 'macos-14' && always() }}

##########
# Windows
- name: Python Build Steps (Windows vc14.3)
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,17 @@ clean: ## clean the repository
.PHONY: dependencies-mac dependencies-debian dependencies-fedora dependencies-vcpkg dependencies-win

dependencies-mac: ## install dependencies for mac
HOMEBREW_NO_AUTO_UPDATE=1 brew install bison cmake flex # gcc@12
HOMEBREW_NO_AUTO_UPDATE=1 brew install bison cmake flex make ninja # gcc@13
brew unlink bison flex && brew link --force bison flex

dependencies-debian: ## install dependencies for linux
apt-get install -y automake bison cmake curl flex ninja-build tar unzip zip
# libabsl-dev libarrow-dev libparquet-dev libthrift-dev

dependencies-fedora: ## install dependencies for linux
yum install -y automake bison cmake curl flex perl-IPC-Cmd tar unzip zip

dependencies-vcpkg: ## install dependnecies via vcpkg
cd vcpkg && ./bootstrap-vcpkg.sh && ./vcpkg install --debug
cd vcpkg && ./bootstrap-vcpkg.sh && ./vcpkg install

dependencies-win: ## install dependnecies via windows (vcpkg)
cd vcpkg && ./bootstrap-vcpkg.bat && ./vcpkg install
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ test-requires = [
]

[tool.cibuildwheel.linux]
before-all ="make dependencies-fedora && make dependencies-vcpkg"
before-all ="make dependencies-fedora"
environment = {CSP_MANYLINUX="ON"}
repair-wheel-command = "auditwheel -v show {wheel} && LD_LIBRARY_PATH=/project/csp/lib auditwheel -v repair -w {dest_dir} {wheel}"
skip = "*i686 musllinux*"

[tool.cibuildwheel.macos]
before-all ="make dependencies-mac && make dependencies-vcpkg"
before-all ="make dependencies-mac"
archs = "x86_64" # NOTE: we use gcc and we cannot cross compile for now
environment = {CFLAGS="-I/usr/local/include -L/usr/local/lib", CXXFLAGS="-I/usr/local/include -L/usr/local/lib", LDFLAGS="-L/usr/local/lib"}

Expand Down

0 comments on commit 6373797

Please sign in to comment.