From 212472691255aa13c1ddf6cda7aafbf0c64baa31 Mon Sep 17 00:00:00 2001 From: Julien Lamy Date: Sun, 14 Apr 2024 14:20:16 +0200 Subject: [PATCH] Add Conda CI --- .ci/build/conda.py | 8 ++++++++ .ci/build/post_build.py | 9 ++++----- .ci/deb/post_build | 38 ------------------------------------- .github/workflows/build.yml | 20 +++++++++++++++---- 4 files changed, 28 insertions(+), 47 deletions(-) create mode 100644 .ci/build/conda.py delete mode 100755 .ci/deb/post_build diff --git a/.ci/build/conda.py b/.ci/build/conda.py new file mode 100644 index 0000000..ffe47cf --- /dev/null +++ b/.ci/build/conda.py @@ -0,0 +1,8 @@ +import subprocess +import sys + +conda = sys.argv[1] if len(sys.argv) >= 2 else "conda" + +subprocess.check_call([ + conda, "install", "--yes", "-c", "conda-forge", + "boost", "cmake", "dcmtk", "icu", "jsoncpp", "ninja", "pybind11"]) diff --git a/.ci/build/post_build.py b/.ci/build/post_build.py index d2cf928..02be62f 100644 --- a/.ci/build/post_build.py +++ b/.ci/build/post_build.py @@ -35,11 +35,10 @@ os.environ["PYTHONPATH"] = os.pathsep.join([ *os.environ.get("PYTHONPATH", "").split(os.pathsep), python_lib_dir]) -os.environ |= { - "ODIL_OWN_AET": "LOCAL", - "ODIL_PEER_HOST_NAME": "127.0.0.1", - "ODIL_PEER_PORT": "11112", - "ODIL_PEER_AET": "REMOTE"} +os.environ["ODIL_OWN_AET"] = "LOCAL" +os.environ["ODIL_PEER_HOST_NAME"] = "127.0.0.1" +os.environ["ODIL_PEER_PORT"] = "11112" +os.environ["ODIL_PEER_AET"] = "REMOTE" os.environ["PATH"] = os.pathsep.join([ *os.environ["PATH"].split(os.pathsep), os.path.join(workspace, "tests/tools")]) diff --git a/.ci/deb/post_build b/.ci/deb/post_build deleted file mode 100755 index 58cbffc..0000000 --- a/.ci/deb/post_build +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -v - -export WORKSPACE=${WORKSPACE:?} -export BUILD_DIR="${WORKSPACE}/${BUILD_DIR:-build}" -export INSTALL_DIR="${WORKSPACE}/${INSTALL_DIR:-install}" - -PYTHON=$(awk -F= '$0 ~ /^PYTHON_EXECUTABLE:/ { print $2 }' ${BUILD_DIR}/CMakeCache.txt) - -export LD_LIBRARY_PATH=${INSTALL_DIR}/lib -export PYTHONPATH=${INSTALL_DIR}/$(${PYTHON} -c 'import os; import sysconfig; print(sysconfig.get_path("purelib", {"posix":"posix_prefix", "nt":"nt"}[os.name], {"base": "."}))') - -export ODIL_OWN_AET=LOCAL -export ODIL_PEER_HOST_NAME=127.0.0.1 -export ODIL_PEER_PORT=11112 -export ODIL_PEER_AET=REMOTE -export PATH=${WORKSPACE}/tests/tools:${PATH} - -cd "${WORKSPACE}/tests/data" -dcmqridx ./ dataset.dcm -dcmqrscp -ll error -c dcmqrscp.config 11112 & -sleep 1 - -cd "${BUILD_DIR}" - -ctest --output-on-failure -R1=$? - -${PYTHON} -m unittest discover -s ${WORKSPACE}/tests/wrappers/ -R2=$? - -kill %1 -cd "${WORKSPACE}/tests/data" -rm -f index.dat RAW_*.dcm - -RETURNCODE=$(if test ${R2} -gt ${R1}; then echo ${R2} ; else echo ${R1}; fi) -exit ${RETURNCODE} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b741dce..2278cb9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,16 +10,20 @@ jobs: fail-fast: false matrix: include: - - { 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" } + - { 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" } + - { os: "ubuntu-latest", packaging: "conda", cmake_options: "-DCMAKE_CXX_STANDARD=17", python: "python" } # - name: "macOS 11 (Big Sur) + Homebrew" # os: macos-11 # ci_type: brew env: WORKSPACE: "${{ github.workspace }}" CMAKE_OPTIONS: "${{ matrix.cmake_options }}" + defaults: + run: + shell: ${{ contains(matrix.os, 'windows') && 'pwsh' || 'bash -l {0}' }} steps: - name: Provision (Debian, Ubuntu) # Install Python and Git. macOS workers already have this, however for @@ -29,6 +33,14 @@ jobs: DEBIAN_FRONTEND=noninteractive apt-get install -y git python3 if: ${{ contains(matrix.packaging, 'apt') }} + - name: Provision (Micromamba) + uses: mamba-org/setup-micromamba@v1 + with: + init-shell: bash powershell + environment-name: dicomifier + create-args: python=3.11 + if: ${{ contains(matrix.packaging, 'conda') }} + - name: Checkout latest revision uses: actions/checkout@v4