From a8a7eddca98298b3caaa9365e4b1e111b106c5a0 Mon Sep 17 00:00:00 2001 From: Iain Russell Date: Fri, 19 Dec 2025 14:53:47 +0000 Subject: [PATCH 1/6] Add CD workflow for building a conda package for local server --- .cd/.conda/build.sh | 83 ++++++++++++++++++++++++++++++++++++ .cd/.conda/meta.yaml | 64 +++++++++++++++++++++++++++ .github/cd-config.yml | 7 +++ .github/workflows/all-cd.yml | 26 +++++++++++ .github/workflows/ci.yml | 2 + 5 files changed, 182 insertions(+) create mode 100644 .cd/.conda/build.sh create mode 100644 .cd/.conda/meta.yaml create mode 100644 .github/cd-config.yml create mode 100644 .github/workflows/all-cd.yml diff --git a/.cd/.conda/build.sh b/.cd/.conda/build.sh new file mode 100644 index 000000000..47e65b0c0 --- /dev/null +++ b/.cd/.conda/build.sh @@ -0,0 +1,83 @@ + +#!/usr/bin/env bash + +set -e # Abort on error. +set -x # Display executed commands + +ENABLE_SSL=ON +ENABLE_PYTHON=ON +ENABLE_HTTP=ON +ENABLE_UDP=ON +ENABLE_UI=ON + +# find the boost libs/includes we need +export LDFLAGS="$LDFLAGS -L$PREFIX/lib -Wl,-rpath,$PREFIX/lib" +export CFLAGS="$CFLAGS -fPIC -I$PREFIX/include" + + +if [[ $(uname) == Darwin && ${target_platform} == osx-64 ]]; then + # Disable use of std::aligned_alloc by boost, as this is not available on macOS 10.9 + export CXXFLAGS="$CXXFLAGS -DBOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC" + + # https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk + export CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" + + # Disable ecflow_http build, as it uses C++17 features only available on macOS 10.12+ + ENABLE_HTTP=OFF + # Disable ecflow_udp build, as it uses C++17 features only available on macOS 10.13+ + ENABLE_UDP=OFF +fi + +# Diagnostic information +${CXX} --version +${CXX} -dM -E - < +HERE + +export UNDEF_LOOKUP=0 +if [[ $(uname) == Darwin ]]; then + export UNDEF_LOOKUP=1 +fi + +mkdir build && cd build + +conda info + +echo "which python" +which python +echo "python version" +python --version + +cmake ${CMAKE_ARGS} \ + -D CMAKE_INSTALL_PREFIX=$PREFIX \ + -D ENABLE_PYTHON=$ENABLE_PYTHON \ + -D ENABLE_SSL=$ENABLE_SSL \ + -D ENABLE_HTTP=$ENABLE_HTTP \ + -D ENABLE_UDP=$ENABLE_UDP \ + -D ENABLE_UI=$ENABLE_UI \ + -D BOOST_ROOT=$PREFIX \ + -D ECBUILD_LOG_LEVEL=DEBUG \ + -D ENABLE_STATIC_BOOST_LIBS=OFF \ + -D Python3_FIND_STRATEGY=LOCATION \ + -D Python3_EXECUTABLE=$PYTHON \ + -D ENABLE_PYTHON_UNDEF_LOOKUP=$UNDEF_LOOKUP \ + -D Cereal_INCLUDE_DIRS=../3rdparty/cereal/include \ + -D JSON_INCLUDE_DIRS=../3rdparty/json/include \ + -D HTTPLIB_INCLUDE_DIRS=../3rdparty/cpp-httplib/include \ + .. + +make -j $CPU_COUNT VERBOSE=1 + + +# only run certain tests +if [[ $(uname) == Linux ]]; then + echo "1,2,3,4,5,6,7,8" > ./test_list.txt +elif [[ $(uname) == Darwin ]]; then + echo "1,2,3,4,5,6,8" > ./test_list.txt +fi + +if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" || "${CROSSCOMPILING_EMULATOR}" != "" ]]; then +ctest -VV -I ./test_list.txt +fi + +make install diff --git a/.cd/.conda/meta.yaml b/.cd/.conda/meta.yaml new file mode 100644 index 000000000..d2b0253a6 --- /dev/null +++ b/.cd/.conda/meta.yaml @@ -0,0 +1,64 @@ +{% set name = "ecFlow" %} +{% set git_tag = environ.get('GIT_DESCRIBE_TAG', '0.0.0').lstrip('v') %} +{% set version = git_tag.replace('-', '') | lower %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + path: ../.. + +build: + number: 0 + skip: true # [win] + +requirements: + build: + - python # [build_platform != target_platform] + - cross-python_{{ target_platform }} # [build_platform != target_platform] + - cmake + - make + - {{ compiler('c') }} + - {{ stdlib("c") }} + - {{ compiler('cxx') }} + - {{ cdt('mesa-libgl-devel') }} # [linux] + - {{ cdt('mesa-dri-drivers') }} # [linux] + - {{ cdt('libselinux') }} # [linux] + - {{ cdt('libxdamage') }} # [linux] + - {{ cdt('libxfixes') }} # [linux] + - {{ cdt('libxxf86vm') }} # [linux] + - {{ cdt('libxcb') }} # [linux] + - {{ cdt('libxext') }} # [linux] + - {{ cdt('libxau') }} # [linux] + host: + - python + - libboost-python-devel + - qt-main + - xorg-libxfixes # [linux] + - zlib # [linux] + - libxcrypt # [linux] + run: + - python + - qt-main + - libboost-python-devel + - zlib # [linux] + - libxcrypt # [linux] + +test: + commands: + - ecflow_client --help + - ecflow_server --help + - ecflow_standalone -v + +about: + home: https://ecflow.readthedocs.io/en/latest/ + license: Apache-2.0 + license_family: Apache + license_file: LICENSE + summary: ECMWF ecFlow + +extra: + recipe-maintainers: + - marcosbento + - iainrussell \ No newline at end of file diff --git a/.github/cd-config.yml b/.github/cd-config.yml new file mode 100644 index 000000000..600749c2a --- /dev/null +++ b/.github/cd-config.yml @@ -0,0 +1,7 @@ +builds: + - name: "conda-build" + type: "conda" + enabled: true + +release: + enabled: true \ No newline at end of file diff --git a/.github/workflows/all-cd.yml b/.github/workflows/all-cd.yml new file mode 100644 index 000000000..bcfc17ce4 --- /dev/null +++ b/.github/workflows/all-cd.yml @@ -0,0 +1,26 @@ +name: All CD + +on: + push: + tags: + - 'v?[0-9]+.[0-9]+.[0-9]+' + - 'v?[0-9]+.[0-9]+.[0-9]+-*' + branches: + - '*' + pull_request: + types: [opened, synchronize, reopened, labeled] + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-and-release: + if: | + startsWith(github.ref, 'refs/tags/') || + github.ref_name == github.event.repository.default_branch || + (github.event.pull_request.base.ref == github.event.repository.default_branch && github.event.label.name == 'approved-for-cd') + uses: ecmwf/reusable-workflows/.github/workflows/main-cd.yml@v2 + with: + ref_name: ${{ github.ref_name }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 954e8c77b..960165124 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,8 @@ on: - 'develop' tags-ignore: - '**' + paths-ignore: + - ".cd/**" # Trigger the workflow on pull request pull_request: ~ From 8232a36f1b964dbd166d2769950d327924e9480c Mon Sep 17 00:00:00 2001 From: Iain Russell Date: Thu, 8 Jan 2026 10:31:32 +0000 Subject: [PATCH 2/6] CD conda: add ecbuild as dependency --- .cd/.conda/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cd/.conda/meta.yaml b/.cd/.conda/meta.yaml index d2b0253a6..5c4df38ea 100644 --- a/.cd/.conda/meta.yaml +++ b/.cd/.conda/meta.yaml @@ -19,6 +19,7 @@ requirements: - cross-python_{{ target_platform }} # [build_platform != target_platform] - cmake - make + - ecbuild - {{ compiler('c') }} - {{ stdlib("c") }} - {{ compiler('cxx') }} From 02a291a9c1553ba9e3e3fdbbe8edb0ca117a9967 Mon Sep 17 00:00:00 2001 From: Iain Russell Date: Thu, 8 Jan 2026 10:38:12 +0000 Subject: [PATCH 3/6] CD conda: add build config --- .cd/.conda/conda_build_config_common.yaml | 20 ++++++++++++++++++++ .cd/.conda/conda_build_config_py312.yaml | 2 ++ .github/cd-config.yml | 1 + 3 files changed, 23 insertions(+) create mode 100644 .cd/.conda/conda_build_config_common.yaml create mode 100644 .cd/.conda/conda_build_config_py312.yaml diff --git a/.cd/.conda/conda_build_config_common.yaml b/.cd/.conda/conda_build_config_common.yaml new file mode 100644 index 000000000..f2929c90e --- /dev/null +++ b/.cd/.conda/conda_build_config_common.yaml @@ -0,0 +1,20 @@ +c_compiler: +- gcc +c_compiler_version: +- '15' +c_stdlib: +- sysroot +c_stdlib_version: +- '2.17' +cdt_name: +- conda +cxx_compiler: +- gxx +cxx_compiler_version: +- '15' +pin_run_as_build: + python: + min_pin: x.x + max_pin: x.x +qt_main: +- '5.15' \ No newline at end of file diff --git a/.cd/.conda/conda_build_config_py312.yaml b/.cd/.conda/conda_build_config_py312.yaml new file mode 100644 index 000000000..bfd3a64c1 --- /dev/null +++ b/.cd/.conda/conda_build_config_py312.yaml @@ -0,0 +1,2 @@ +python: +- 3.12.* *_cpython \ No newline at end of file diff --git a/.github/cd-config.yml b/.github/cd-config.yml index 600749c2a..a1fd52b8d 100644 --- a/.github/cd-config.yml +++ b/.github/cd-config.yml @@ -2,6 +2,7 @@ builds: - name: "conda-build" type: "conda" enabled: true + conda_build_args: "--no-anaconda-upload -m .cd/.conda/conda_build_config_common.yaml -m .cd/.conda/conda_build_config_py312.yaml" release: enabled: true \ No newline at end of file From 422acdd110a56c0e891342ae079f98b804f6f411 Mon Sep 17 00:00:00 2001 From: Iain Russell Date: Thu, 8 Jan 2026 10:48:11 +0000 Subject: [PATCH 4/6] CD conda: add build config --- .github/cd-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/cd-config.yml b/.github/cd-config.yml index a1fd52b8d..2820ba645 100644 --- a/.github/cd-config.yml +++ b/.github/cd-config.yml @@ -2,7 +2,7 @@ builds: - name: "conda-build" type: "conda" enabled: true - conda_build_args: "--no-anaconda-upload -m .cd/.conda/conda_build_config_common.yaml -m .cd/.conda/conda_build_config_py312.yaml" + conda_build_args: "-m .cd/.conda/conda_build_config_common.yaml -m .cd/.conda/conda_build_config_py312.yaml --no-anaconda-upload" release: enabled: true \ No newline at end of file From 7aa80f111c3f5bebe180d9b62962e8cf94acd0e1 Mon Sep 17 00:00:00 2001 From: Iain Russell Date: Thu, 8 Jan 2026 10:52:56 +0000 Subject: [PATCH 5/6] CD conda: add build config --- .github/cd-config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/cd-config.yml b/.github/cd-config.yml index 2820ba645..1bd26fdf4 100644 --- a/.github/cd-config.yml +++ b/.github/cd-config.yml @@ -2,7 +2,8 @@ builds: - name: "conda-build" type: "conda" enabled: true - conda_build_args: "-m .cd/.conda/conda_build_config_common.yaml -m .cd/.conda/conda_build_config_py312.yaml --no-anaconda-upload" + config: + conda_build_args: "-m .cd/.conda/conda_build_config_common.yaml -m .cd/.conda/conda_build_config_py312.yaml --no-anaconda-upload" release: enabled: true \ No newline at end of file From 9502e8542ccbc450fb267b949843eddcba6705fb Mon Sep 17 00:00:00 2001 From: Iain Russell Date: Thu, 8 Jan 2026 15:13:44 +0000 Subject: [PATCH 6/6] CD conda: debug --- .github/workflows/all-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all-cd.yml b/.github/workflows/all-cd.yml index bcfc17ce4..2252d3114 100644 --- a/.github/workflows/all-cd.yml +++ b/.github/workflows/all-cd.yml @@ -20,7 +20,7 @@ jobs: startsWith(github.ref, 'refs/tags/') || github.ref_name == github.event.repository.default_branch || (github.event.pull_request.base.ref == github.event.repository.default_branch && github.event.label.name == 'approved-for-cd') - uses: ecmwf/reusable-workflows/.github/workflows/main-cd.yml@v2 + uses: ecmwf/reusable-workflows/.github/workflows/main-cd.yml@debug-cd-conda with: ref_name: ${{ github.ref_name }} secrets: inherit \ No newline at end of file