Skip to content

Commit

Permalink
Rewrite apt-based CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lamyj committed Apr 14, 2024
1 parent f10b3c9 commit a9e7e51
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 22 deletions.
15 changes: 15 additions & 0 deletions .ci/build/apt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
import subprocess

os.environ["DEBIAN_FRONTEND"] = "noninteractive"

subprocess.check_call(["apt-get", "update"])

subprocess.check_call([
"apt-get", "-y", "--no-install-recommends", "install",
"build-essential", "cmake", "ninja-build", "pkg-config", "python3",
"libboost-dev", "libboost-date-time-dev", "libboost-exception-dev",
"libboost-log-dev", "libboost-filesystem-dev", "libboost-regex-dev",
"libdcmtk-dev", "libicu-dev", "libjsoncpp-dev", "zlib1g-dev",
"pybind11-dev", "python3-pybind11", "python3-dev",
"libboost-test-dev", "dcmtk"])
25 changes: 25 additions & 0 deletions .ci/build/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import subprocess
import sys

print(f"Building with {sys.executable}")

workspace = os.environ["WORKSPACE"]
build_dir = os.environ.get("BUILD_DIR", os.path.join(workspace, "build"))
install_dir = os.environ.get("INSTALL_DIR", os.path.join(workspace, "install"))

for dir in [build_dir, install_dir]:
if not os.path.isdir(dir):
os.makedirs(dir)

subprocess.check_call(
[
"cmake",
"-G", "Ninja",
"-DPython_EXECUTABLE={}".format(sys.executable),
"-DCMAKE_INSTALL_PREFIX={}".format(install_dir),
*([os.environ["CMAKE_OPTIONS"]] if "CMAKE_OPTIONS" in os.environ else []),
workspace],
cwd=build_dir)

subprocess.check_call(["ninja", "install"], cwd=build_dir)
42 changes: 20 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,33 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
container: debian:bullseye
ci_type: deb
- os: ubuntu-latest
container: debian:bookworm
ci_type: deb
cmake_options: "-DCMAKE_CXX_STANDARD=17"
- os: ubuntu-latest
container: ubuntu:focal
ci_type: deb
- os: ubuntu-latest
container: ubuntu:jammy
ci_type: deb
cmake_options: "-DCMAKE_CXX_STANDARD=17"
- { os: "ubuntu-latest", container: "debian:bullseye", packaging: "apt", python: "python3" }
- { os: "ubuntu-latest", container: "debian:bookworm", packaging: "apt", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python3" }
- { os: "ubuntu-latest", container: "ubuntu:focal", packaging: "apt", python: "python3" }
- { os: "ubuntu-latest", container: "ubuntu:jammy", packaging: "apt", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python3" }
# - name: "macOS 11 (Big Sur) + Homebrew"
# os: macos-11
# ci_type: brew
# start_worker: ""
# worker: ""
# stop_worker: ""
env:
WORKSPACE: "${{ github.workspace }}"
CMAKE_OPTIONS: "${{ matrix.cmake_options }}"
steps:
- name: Provision (Debian, Ubuntu)
# Install Python and Git. macOS workers already have this, however for
# Linux we are running in minimal containers.
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y git python3
if: ${{ contains(matrix.packaging, 'apt') }}

- name: Checkout latest revision
uses: actions/checkout@v4
- name: Configure the build
run: ./.ci/${{ matrix.ci_type}}/install

- name: Set-up (${{ matrix.packaging }})
run: ${{ matrix.python }} .ci/build/${{ matrix.packaging }}.py

- name: Build
run: ./.ci/${{ matrix.ci_type}}/build
- name: Run tests
run: ./.ci/${{ matrix.ci_type}}/post_build
run: ${{ matrix.python }} ./.ci/build/build.py

# - name: Run tests
# run: ./.ci/${{ matrix.ci_type}}/post_build

0 comments on commit a9e7e51

Please sign in to comment.