Skip to content

Commit 214dfe0

Browse files
authored
CI: build Linux arm64 in a CentOS 7 container (#570)
- unify Linux native build CI - remove vcpkg caching as it is not working anymore - limit parallelization to the amount of logical cpu cores - remove ability to cross-compile as it is currently broken with jemalloc/mimalloc - bump the minimum required version of cmake to align with vcpkg
1 parent 6c79cce commit 214dfe0

File tree

3 files changed

+18
-45
lines changed

3 files changed

+18
-45
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ permissions:
1818

1919
jobs:
2020

21-
# Note that vcpkg dependencies takes the majority of the build time.
22-
# We cache them using GitHub Actions cache, making the scripts below a bit more complex.
2321
check-format:
2422
if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id
2523
name: Check format
@@ -90,12 +88,6 @@ jobs:
9088
echo "root=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_OUTPUT
9189
shell: bash
9290

93-
# Get cmake version, which is used by the CentOS 7 container.
94-
- name: Get cmake version
95-
id: cmake-info
96-
run: echo "version=$(cmake --version | head -n1 | awk '{print $3}')" >> $GITHUB_OUTPUT
97-
shell: bash
98-
9991
# Ensure vcpkg builtin registry is up-to-date
10092
- name: Update vcpkg builtin registry
10193
working-directory: ${{ steps.vcpkg-info.outputs.root }}
@@ -116,22 +108,13 @@ jobs:
116108
run: |
117109
./bootstrap-vcpkg.bat
118110
119-
# Setup a CentOS 7 container to build on Linux x64 for backwards compatibility.
111+
# Setup a CentOS 7 container to build on Linux for backwards compatibility.
120112
- name: Start CentOS container and install toolchain
121-
if: runner.os == 'Linux' && matrix.arch == 'x64'
113+
if: runner.os == 'Linux'
122114
run: |
123-
docker run -d --name centos --entrypoint tail -v $PWD:$PWD -v $VCPKG_INSTALLATION_ROOT:$VCPKG_INSTALLATION_ROOT quay.io/pypa/manylinux2014_x86_64 -f /dev/null
115+
docker run -d --name centos --entrypoint tail -v $PWD:$PWD -v $VCPKG_INSTALLATION_ROOT:$VCPKG_INSTALLATION_ROOT quay.io/pypa/manylinux2014_$(uname -m) -f /dev/null
124116
docker exec centos sh -c "yum install -y devtoolset-10 rh-git227 httpd24-curl flex bison perl-Data-Dumper perl-IPC-Cmd && \
125-
curl -fsSL -o /tmp/cmake.sh https://github.com/Kitware/CMake/releases/download/v${{ steps.cmake-info.outputs.version }}/cmake-${{ steps.cmake-info.outputs.version }}-linux-x86_64.sh && \
126-
sh /tmp/cmake.sh --skip-license --prefix=/usr/local && \
127-
rm /tmp/cmake.sh"
128-
129-
# Install arm64 cross-compilation toolchain if required
130-
- name: Install arm64 cross-compilation toolchain
131-
if: runner.os == 'Linux' && matrix.arch == 'arm64'
132-
run: |
133-
sudo apt-get update
134-
sudo apt install g++-aarch64-linux-gnu
117+
uv tool install ninja"
135118
136119
# Install vcpkg dependencies
137120
- name: Install vcpkg build dependencies (macOS)
@@ -147,25 +130,19 @@ jobs:
147130
if: runner.os == 'Windows'
148131
uses: microsoft/setup-msbuild@v2
149132

150-
# Expose GitHub Runtime environment variables for vcpkg caching.
151-
- name: Expose GitHub Runtime
152-
uses: crazy-max/ghaction-github-runtime@v3
153-
154133
# Compile ParquetSharp and C++ dependencies (and upload the native library as an artifact).
155-
- name: Compile native ParquetSharp library (Unix)
156-
if: runner.os == 'Linux' || runner.os == 'macOS'
134+
- name: Compile native ParquetSharp library (Linux)
135+
if: runner.os == 'Linux'
157136
run: |
158-
if [ "${{ runner.os }}" == "Linux" ] && [ "${{ matrix.arch }}" == "x64" ]; then
159-
exec="docker exec -w $PWD -e GITHUB_ACTIONS -e ACTIONS_CACHE_URL -e ACTIONS_RUNTIME_TOKEN -e VCPKG_BINARY_SOURCES -e VCPKG_INSTALLATION_ROOT centos scl enable devtoolset-10 rh-git227 httpd24 --"
160-
fi
161-
$exec ./build_unix.sh ${{ matrix.arch }}
162-
env:
163-
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
137+
docker exec -w $PWD -e GITHUB_ACTIONS -e VCPKG_INSTALLATION_ROOT centos \
138+
scl enable devtoolset-10 rh-git227 httpd24 -- \
139+
sh -c 'PATH=$(uv tool dir --bin):$PATH ./build_unix.sh'
140+
- name: Compile native ParquetSharp library (macOS)
141+
if: runner.os == 'macOS'
142+
run: ./build_unix.sh
164143
- name: Compile native ParquetSharp library (Windows)
165144
if: runner.os == 'Windows'
166145
run: ./build_windows.ps1
167-
env:
168-
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
169146
- name: Upload vcpkg arrow logs
170147
if: success() || failure()
171148
uses: actions/upload-artifact@v4
@@ -184,7 +161,7 @@ jobs:
184161
path: bin
185162

186163
- name: Stop CentOS container
187-
if: runner.os == 'Linux' && matrix.arch == 'x64'
164+
if: runner.os == 'Linux'
188165
run: docker rm -f centos
189166

190167
# Download all native shared libraries and create the nuget package.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.8)
1+
cmake_minimum_required(VERSION 3.10)
22
project(ParquetSharp)
33

44
# Exclude MinSizeRel and RelWithDebugInfo, to simplify integration with C#

build_unix.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
case ${1:-$(uname -m)} in
4+
case $(uname -m) in
55
x86_64|x64)
66
vcpkg_arch=x64
77
linux_arch=x86_64
@@ -21,15 +21,11 @@ esac
2121
case $(uname) in
2222
Linux)
2323
os=linux
24-
[ -f /etc/redhat-release ] && platform=redhat-linux || platform=linux-gnu
25-
options="-D CMAKE_SYSTEM_PROCESSOR=$linux_arch \
26-
-D CMAKE_C_COMPILER=$(which $linux_arch-$platform-gcc) \
27-
-D CMAKE_CXX_COMPILER=$(which $linux_arch-$platform-g++) \
28-
-D CMAKE_STRIP=$(which $linux_arch-$platform-strip 2>/dev/null || which strip)"
24+
nproc=$(nproc)
2925
;;
3026
Darwin)
3127
os=osx
32-
options="-D CMAKE_OSX_ARCHITECTURES=$osx_arch"
28+
nproc=$(sysctl -n hw.logicalcpu)
3329
if ! which brew >/dev/null || [ ! -x $(brew --prefix)/opt/bison/bin/bison ]
3430
then
3531
echo 'The version of bison provided with macOS is too old.'
@@ -86,5 +82,5 @@ do
8682
echo ">> Building ParquetSharpNative $build_type for $triplet"
8783
build_dir=build/$triplet-$(tr A-Z a-z <<<$build_type)
8884
cmake -B $build_dir -S . -D VCPKG_TARGET_TRIPLET=$triplet -D CMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake -D CMAKE_BUILD_TYPE=$build_type $options
89-
cmake --build $build_dir -j
85+
cmake --build $build_dir -j ${nproc}
9086
done

0 commit comments

Comments
 (0)