From ca10b65335d10419be64efc8e94a150fe8349904 Mon Sep 17 00:00:00 2001
From: CABEL Tristan <tristan.cabel@inria.fr>
Date: Fri, 8 Sep 2023 13:07:53 +0200
Subject: [PATCH] update to latest dtk

---
 .gitlab-ci.yml                     | 245 ++++++++++++++++++++++++++++-
 pkg/env/dtk-imaging-python.yaml    |  22 +--
 pkg/recipe/conda_build_config.yaml |   9 +-
 pkg/recipe/meta.yaml               |  24 +--
 4 files changed, 267 insertions(+), 33 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 15bf41f..4d2c4aa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,19 +1,250 @@
+#
+# dtk group slaves:
+#
+# - osx      : dtk-macos-catalina.ci / sRZVDkCbN
+# - osx-arm64: catalysis-zie         / j5KdEV2ss
+# - linux    : dtk-centos-7.ci       / 3q8t4dgGP
+# - windows  : dtk-win10.ci          / eNDyiy5uY
+#
+#
+
+#
+# global variables
+#variables:
+
 build-osx:
   stage: build
-  tags: 
+  needs: []
+  tags:
     - osx
   only:
-    -  qt6
+    - feature/gitlab-runners
+    - merge_requests
   script:
     - source /Users/ci/Miniconda3/etc/profile.d/conda.sh
+    - conda env remove -n $CI_PROJECT_NAME
+    - conda env update -f pkg/env/$CI_PROJECT_NAME.yaml
+    - conda activate $CI_PROJECT_NAME
+    - conda install -c conda-forge cmake
+    - rm -fr build
+    - mkdir build
+    - cd build
+    - cmake ..
+    - make
+    - make install
+  artifacts:
+    paths:
+      - build/
+
+build-osx-arm64:
+  stage: build
+  needs: []
+  tags:
+    - osx-arm64
+  only:
+    - feature/gitlab-runners
+    - merge_requests
+    - manuel_trigger_arm
+  script:
+    - source $HOME/miniconda3/etc/profile.d/conda.sh
     - conda activate base
-    - conda mambabuild --no-force-upload --python=3.7 --python=3.9 --python=3.10 --user dtk-forge6 -c dtk-forge6 -c conda-forge pkg/recipe
- 
+    - conda env remove -n $CI_PROJECT_NAME
+    - conda env update -f pkg/env/$CI_PROJECT_NAME.yaml
+    - conda activate $CI_PROJECT_NAME
+    - conda install -c conda-forge cmake
+    - rm -fr build
+    - mkdir build
+    - cd build
+    - cmake ..
+    - make
+    - make install
+  artifacts:
+    paths:
+      - build/
+
+build-windows:
+  stage: build
+  needs: []
+  tags:
+    - windows
+  only:
+    - feature/gitlab-runners
+    - merge_requests
+  script:
+    - . C:\Users\ci\Miniconda3\shell\condabin\conda-hook.ps1
+    - conda env remove -n $CI_PROJECT_NAME
+    - (Remove-Item "C:\Users\ci\Miniconda3\envs\$CI_PROJECT_NAME" -ErrorAction Ignore -Recurse)
+    - conda env update -f pkg/env/$CI_PROJECT_NAME.yaml
+    - conda activate $CI_PROJECT_NAME
+    - conda install -c conda-forge cmake
+    - (Remove-Item  "build" -ErrorAction Ignore -Recurse)
+    - mkdir build
+    - cd build
+    - cmake ..
+    - cmake --build . --config Release --target install
+  artifacts:
+    paths:
+      - build/
+
 build-linux:
+  stage: build
+  needs: []
   tags:
     - linux
-  stage: build
   only:
-    -  qt6
+    - feature/gitlab-runners
+    - merge_requests
   script:
-    - mamba build --no-force-upload --python=3.7 --python=3.9 --python=3.10 --user dtk-forge6 -c dtk-forge6 -c conda-forge pkg/recipe
+    - source /builds/miniconda3/etc/profile.d/conda.sh
+    - conda env remove -n $CI_PROJECT_NAME
+    - mamba env update -f pkg/env/$CI_PROJECT_NAME.yaml
+    - conda activate gcc-dtk
+    - conda activate --stack $CI_PROJECT_NAME
+    - rm -fr build
+    - mkdir build
+    - cd build
+    - cmake ..
+    - make
+    - make install
+  artifacts:
+    paths:
+      - build/
+
+ctest-linux:
+  stage: test
+  needs: ["build-linux"]
+  tags:
+    - linux
+  only:
+    - feature/gitlab-runners
+    - merge_requests
+  script:
+    - source /builds/miniconda3/etc/profile.d/conda.sh
+    - conda activate gcc-dtk
+    - conda activate --stack $CI_PROJECT_NAME
+    - cd build
+    - ctest -T test --timeout 120 --output-junit ../ctest-junit.xml || true
+  artifacts:
+    when: always
+    reports:
+      junit: ./ctest-junit.xml
+  # dependencies:
+  #   - build-linux
+
+ctest-osx-arm64:
+  stage: test
+  needs: ["build-osx-arm64"]
+  tags:
+    - osx-arm64
+  only:
+    - feature/gitlab-runners
+    - merge_requests
+  script:
+    - conda activate $CI_PROJECT_NAME
+    - cd build
+    - ctest -T test --timeout 120 --output-junit ../ctest-junit.xml || true
+  artifacts:
+    when: always
+    reports:
+      junit: ./ctest-junit.xml
+  # dependencies:
+  #   - build-osx-arm64
+
+ctest-osx:
+  stage: test
+  needs: ["build-osx"]
+  tags:
+    - osx
+  only:
+    - feature/gitlab-runners
+    - merge_requests
+  script:
+    - source /Users/ci/Miniconda3/etc/profile.d/conda.sh
+    - conda activate $CI_PROJECT_NAME
+    - cd build
+    - ctest -T test --timeout 120 --output-junit ../ctest-junit.xml || true
+  artifacts:
+    when: always
+    reports:
+      junit: ./ctest-junit.xml
+  # dependencies:
+  #   - build-osx
+
+ctest-windows:
+  stage: test
+  needs: ["build-windows"]
+  tags:
+    - windows
+  only:
+    - feature/gitlab-runners
+    - merge_requests
+  script:
+    - . C:\Users\ci\Miniconda3\shell\condabin\conda-hook.ps1
+    - conda activate $CI_PROJECT_NAME
+    - cd build
+    - ctest -T test --timeout 120 --output-junit ..\ctest-junit.xml
+  artifacts:
+    when: always
+    reports:
+      junit: ./ctest-junit.xml
+  # dependencies:
+  #   - build-windows
+
+build-conda-osx:
+  stage: deploy
+  needs: ["ctest-osx"]
+  tags:
+    - osx
+  only:
+#    - master
+    - feature/gitlab-runners
+  script:
+    - source /Users/ci/Miniconda3/etc/profile.d/conda.sh
+    - conda activate base
+    - conda mambabuild --token $ANACONDA_TOKEN --user dtk-forge6 -c dtk-forge6 -c conda-forge pkg/recipe/.
+  # dependencies:
+  #   - ctest-osx
+
+build-conda-osx-arm64:
+  stage: deploy
+  needs: ["ctest-osx-arm64"]
+  tags:
+    - osx-arm64
+  only:
+#    - master
+    - feature/gitlab-runners
+  script:
+    - conda activate base
+    - conda mambabuild --token $ANACONDA_TOKEN --user dtk-forge6 -c dtk-forge6 -c conda-forge pkg/recipe/.
+  # dependencies:
+  #   - ctest-osx-arm64
+
+build-conda-windows:
+  stage: deploy
+  needs: ["ctest-windows"]
+  tags:
+    - windows
+  only:
+#    - master
+    - feature/gitlab-runners
+  script:
+    - . C:\Users\ci\Miniconda3\shell\condabin\conda-hook.ps1
+    - conda activate base
+    - conda mambabuild --token $ANACONDA_TOKEN --user dtk-forge6 -c dtk-forge6 -c conda-forge pkg/recipe/.
+  # dependencies:
+  #   - ctest-windows
+
+build-conda-linux:
+  stage: deploy
+  needs: ["ctest-linux"]
+  tags:
+    - linux
+  only:
+#    - master
+    - feature/gitlab-runners
+  script:
+    - source /builds/miniconda3/etc/profile.d/conda.sh
+    - conda activate base
+    - conda mambabuild --token $ANACONDA_TOKEN --user dtk-forge6 -c dtk-forge6 -c conda-forge pkg/recipe/.
+  # dependencies:
+  #   - ctest-linux
diff --git a/pkg/env/dtk-imaging-python.yaml b/pkg/env/dtk-imaging-python.yaml
index 3e40650..4ccb7fe 100644
--- a/pkg/env/dtk-imaging-python.yaml
+++ b/pkg/env/dtk-imaging-python.yaml
@@ -1,14 +1,14 @@
-name:         dtk-imaging-python
+name: dtk-imaging-python
 channels:
-  - dtk-forge
+  - dtk-forge6
   - conda-forge
 dependencies:
-    - cmake >=3.14.0
-    - qt >=5.9.0
-    - python=3.7.*
-    - dtk-core >=2.5.3
-    - dtk-core-python >=2.5.3
-    - dtk-imaging >=2.0.0
-    - dtk-script >=2.3.0
-    - swig >=4.0.1
-    - numpy >=1.18.1
+    - cmake >=3.21.0
+    - qt6-main >=6.5
+    - python=3.9
+    - dtk-core >=2.13
+    - dtk-core-python >=2.8
+    - dtk-imaging >=2.0.4
+    - dtk-script >=2.5
+    - swig >=4.1
+    - numpy >=1.22
diff --git a/pkg/recipe/conda_build_config.yaml b/pkg/recipe/conda_build_config.yaml
index 859c10b..04f8f8a 100644
--- a/pkg/recipe/conda_build_config.yaml
+++ b/pkg/recipe/conda_build_config.yaml
@@ -2,7 +2,10 @@ numpy:
   - 1.22
 cdt_name: cos7             # [linux]
 MACOSX_DEPLOYMENT_TARGET:  # [osx]
-  - '10.14'                # [osx]
+  - '10.15'                # [osx]
 MACOSX_SDK_VERSION:        # [osx and x86_64]
-  - '10.14'                # [osx and x86_64]
-
+  - '10.15'                # [osx and x86_64]
+python:
+  - 3.9
+  - 3.10
+  - 3.11
diff --git a/pkg/recipe/meta.yaml b/pkg/recipe/meta.yaml
index 6ce7776..5c95b08 100644
--- a/pkg/recipe/meta.yaml
+++ b/pkg/recipe/meta.yaml
@@ -10,7 +10,7 @@ build:
 
 requirements:
   build:
-    - cmake >=3.14.0
+    - cmake >=3.21.0
     - numpy {{numpy}}                    # [osx]
     - python                             # [osx]
     - {{ compiler('cxx') }}
@@ -42,20 +42,20 @@ requirements:
     - {{ cdt('libxfixes-devel') }}       # [linux]
     - {{ cdt('libxxf86vm') }}            # [linux]
   host:
-    - qt >=5.9.0
-    - dtk-core >=2.5.3
-    - dtk-core-python >=2.5.3
-    - dtk-imaging >=2.0.1
-    - dtk-script >=2.3.1
-    - swig >=4.0.1
+    - qt6-main >=6.5
+    - dtk-core >=2.13
+    - dtk-core-python >=2.8
+    - dtk-imaging >=2.0.4
+    - dtk-script >=2.5
+    - swig >=4.1
     - numpy {{numpy}}
     - python
   run:
-    - qt >=5.9.0
-    - dtk-core >=2.5.3
-    - dtk-core-python >=2.5.3
-    - dtk-imaging >=2.0.1
-    - dtk-script >=2.3.1
+    - qt6-main >=6.5
+    - dtk-core >=2.13
+    - dtk-core-python >=2.8
+    - dtk-imaging >=2.0.4
+    - dtk-script >=2.5
     - numpy {{numpy}}
     - python
 
-- 
GitLab