Skip to content

Commit

Permalink
CI config for Jammy build (arm64+amd64)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoup authored and craigds committed Jan 16, 2024
1 parent ef73406 commit 557897e
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .buildkite/_compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
set -eu

DEB_VER=$1

source /etc/lsb-release

apt-get update -y
apt-get install -y --no-install-recommends \
file \
libcurl4-openssl-dev \
libgeotiff-dev \
libgdal-dev

declare -a CMAKE_EXTRA=()

if [ "$DISTRIB_CODENAME" == "bionic" ]; then
apt-get install -y --no-install-recommends gcc-8 g++-8
CMAKE_EXTRA+=(
"-DCMAKE_C_COMPILER=gcc-8"
"-DCMAKE_CXX_COMPILER=g++-8"
)
fi

# install modern cmake
CMAKE_VER=3.24.1
echo "Installing CMake v${CMAKE_VER}/$(uname -m) ..."
curl --silent --show-error --fail -L \
"https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-$(uname -m).sh" \
>/tmp/cmake-install.sh
/bin/sh /tmp/cmake-install.sh --exclude-subdir --prefix=/usr --skip-license

cd /mnt/build

# configure
echo "+++ Configuring..."
cmake -S /src -B . \
"${CMAKE_EXTRA[@]}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_PLUGIN_PGPOINTCLOUD=OFF \
-DWITH_TESTS=NO \
-DCMAKE_INSTALL_PREFIX=/usr \
[email protected] \
-DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON \
-DCPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS=ON \
-DCPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY='>=' \
-DCPACK_DEBIAN_FILE_NAME=DEB-DEFAULT

# compile
echo "--- Compiling..."
cmake --build . --verbose

# compile
echo "--- Testing..."
ctest --output-on-failure

# build deb
echo "+++ Packaging..."
cpack -G DEB -R "${DEB_VER}"

cp -v pdal_*.deb /builds/
43 changes: 43 additions & 0 deletions .buildkite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -eux

if which ggrep; then
# so we can run this locally on MacOS
# (run `brew install grep` to install this)
GREP=ggrep
else
GREP=grep
fi

PDAL_VER="$(${GREP} -Po '(?<=project\(PDAL VERSION )\d+\.\d+\.\d+' CMakeLists.txt)"

DIST=$1
DEB_BASE_VERSION="${PDAL_VER}"
DEB_VERSION="${DEB_BASE_VERSION}+kx-ci${BUILDKITE_BUILD_NUMBER-0}-$(git show -s --date=format:%Y%m%d --format=git%cd.%h)"
echo "Debian Package Version: ${DEB_VERSION}"

if [ -n "${BUILDKITE_AGENT_ACCESS_TOKEN-}" ]; then
buildkite-agent meta-data set deb-base-version "$DEB_BASE_VERSION"
buildkite-agent meta-data set deb-version "$DEB_VERSION"
echo -e ":debian: Package Version: \`${DEB_VERSION}\`" |
buildkite-agent annotate --style info --context deb-version
fi

BUILDS_DIR=$(realpath "./builds")
mkdir -p "${BUILDS_DIR}"

SRC_DIR=$(realpath "$(dirname -- "${BASH_SOURCE[0]}")/..")

echo "Building for $DIST/$(uname -m) ..."
docker pull "${ECR}/kx-base-${DIST}-py3-build"
docker run --rm -it \
-v "${SRC_DIR}:/src" \
-v "${BUILDS_DIR}:/builds" \
--tmpfs /tmp:exec \
${BUILD_DOCKER_OPTS-} \
--mount type=volume,target=/mnt/build \
-w /src \
"${ECR}/kx-base-${DIST}-py3-build" \
${2-/src/.buildkite/_compile.sh "${DEB_VERSION}"}

echo "✅ debs are in ${BUILDS_DIR} ---"
53 changes: 53 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
steps:
- label: ":debian: arm64/{{ matrix.os }}: Build & Package"
command: .buildkite/build.sh {{ matrix.os }}
agents:
queue: "default_arm64"
artifact_paths:
- "builds/*"
matrix:
setup:
os:
- jammy

- label: ":debian: amd64/{{ matrix.os }}: Build & Package"
command: .buildkite/build.sh {{ matrix.os }}
agents:
queue: "default"
artifact_paths:
- "builds/*"
matrix:
setup:
os:
- jammy

- block: "Release?"
prompt: "Release to archive?"

- label: ":debian: Publish debs"
command:
- >
aptly-upload
--aptly-url https://apt-repo.kx.gd
--retries 3
--repo kx-builds-{{ matrix.os }}
--series {{ matrix.os }}
build-{{ matrix.os }}/*.deb
retry:
automatic: true
plugins:
artifacts#v1.2.0:
download:
- "build-{{ matrix.os }}/*.deb"
docker#v1.4.0:
image: "${ECR}/ci-tools"
always-pull: true
workdir: /src
environment:
- APTLY_UNAME
- APTLY_PASSWD
matrix:
setup:
os:
- jammy

0 comments on commit 557897e

Please sign in to comment.