From 6326f7ad54d2451d04902ab003b8ab975cdbc4ad Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:35:52 +0100 Subject: [PATCH 01/17] Integrate PIXI ci, without tests and change filtering temporarly --- .../workflows/ci-macos-linux-windows-pixi.yml | 190 +++++++++++++++++- .github/workflows/trigger-build-and-tests.yml | 74 +++++-- 2 files changed, 244 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index 3dc4b7965e7..f28ee9b1beb 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -1,15 +1,88 @@ name: CI - MacOS/Linux/Windows via Pixi on: - push: - pull_request: - workflow_dispatch: + workflow_call: + inputs: + sofa-branch-name: + type: string + required: true + sofa-commit-sha: + type: string + required: true + pr-owner-url: + type: string + required: false + pr-branch-name: + type: string + required: false + pr-commit-sha: + type: string + required: false + preset: + type: string + required: true + python-version: + type: string + required: true + ci-depends-on: + type: string + required: false + with-all-tests: + type: boolean + required: false + default: false + force-full-build: + type: boolean + required: false + default: false + generate-binaries: + type: boolean + required: false + default: false + external-plugins: + type: string + required: false + additionnal-cmake-flags: + type: string + required: false + builder-os: + type: string + required: true + default: '["ubuntu-latest", "macos-latest", "macos-15-intel", "windows-latest"]' + dash-info: + type: string + required: false + default: 'NONE' + description: 'Json scructure with three parameters {"COMMIT_HASH":"fullhsashofthecommit", }' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: + display-inputs: + runs-on: ubuntu-latest + steps: + - name: Display + shell: bash + run: | + echo "Build and test launched with following parameters:" + echo "sofa-branch-name : ${{ inputs.sofa-branch-name }}" + echo "sofa-commit-sha : ${{ inputs.sofa-commit-sha }}" + echo "pr-owner-url : ${{ inputs.pr-owner-url }}" + echo "pr-branch-name : ${{ inputs.pr-branch-name }}" + echo "pr-commit-sha : ${{ inputs.pr-commit-sha }}" + echo "preset : ${{ inputs.preset }}" + echo "python-version : ${{ inputs.python-version }}" + echo "ci-depends-on : ${{ inputs.ci-depends-on }}" + echo "with-all-tests : ${{ inputs.with-all-tests }}" + echo "force-full-build : ${{ inputs.force-full-build }}" + echo "generate-binaries : ${{ inputs.generate-binaries }}" + echo "external-plugins : ${{ inputs.external-plugins }}" + echo "additionnal-cmake-flags : ${{ inputs.additionnal-cmake-flags }}" + echo "builder-os : ${{ inputs.builder-os }}" + sofa-pixi: name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} runs-on: ${{ matrix.os }} @@ -17,24 +90,129 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, macos-15-intel, windows-latest] - environment: [supported-plugins] + os: ${{ fromJson(inputs.builder-os) }} + environment: ${{ fromJson(inputs.preset) }} build_type: [Release] steps: - uses: actions/checkout@v4 + with: + ref: ${{ inputs.sofa-branch-name }} + path: sofa + + - run: git config --global user.email "<>" + - run: git config --global user.name "SOFA Bot" - uses: prefix-dev/setup-pixi@v0.8.10 with: cache: false environments: ${{ matrix.environment }} + - name: Setup SOFA and clone CI + shell: bash -el {0} + run: | + export WORKSPACE=$GITHUB_WORKSPACE + echo "WORKSPACE=$WORKSPACE" >> $GITHUB_ENV + + export SRC_DIR=$GITHUB_WORKSPACE/sofa + echo "SRC_DIR=$SRC_DIR" >> $GITHUB_ENV + + cd $SRC_DIR + if [ ! -z "${{ inputs.pr-owner-url }}" ]; then + echo "This is a PR, merging branch ${{ inputs.pr-branch-name }} from remote ${{ inputs.pr-owner-url }} into origin branch ${{ inputs.sofa-branch-name }}" + git remote add pr ${{ inputs.pr-owner-url }} + git fetch pr + + if [ "${{ inputs.pr-commit-sha }}" == "HEAD" ]; then + git merge ${{ inputs.pr-branch-name }} + else + git merge ${{ inputs.pr-commit-sha }} + fi + else + echo "This is not a PR: checking out sha ${{ inputs.sofa-commit-sha }} from branch ${{ inputs.sofa-branch-name }}" + git checkout ${{ inputs.sofa-commit-sha }} + fi + + cd $WORKSPACE + + ## Clone CI and use ci-depends-on structure + ci_branch=${{ inputs.sofa-branch-name }} + ci_repo_url="https://www.github.com/sofa-framework/ci" + + + # check if ci has a ci-depends-on + ci_ci_depends_on=$(echo "${{ inputs.ci-depends-on }}" | jq .ci) + if [ -n "${{ inputs.ci-depends-on }}" ] && [ "$ci_ci_depends_on" != "null" ]; then + echo "ci-depends-on for ci repository detected." + ci_repo_url=$(echo "${{ inputs.ci-depends-on }}" | jq .ci.repo_url) + ci_branch=$(echo "${{ inputs.ci-depends-on }}" | jq .ci.branch_name) + fi + echo "CI_BRANCH=$ci_branch" >> $GITHUB_ENV + + + echo "Cloning CI from remote ${ci_repo_url}, selecting branch ${ci_branch}" + + CI_DIR=$WORKSPACE/ci + echo "CI_DIR=$CI_DIR" >> $GITHUB_ENV + + git clone -b ${ci_branch//\"} --single-branch ${ci_repo_url//\"} + + cd $WORKSPACE + + ## Setup build folder + mkdir $WORKSPACE/build + + SOFA_BUILD_DIR=$WORKSPACE/build + echo "SOFA_BUILD_DIR=$SOFA_BUILD_DIR" >> $GITHUB_ENV + + if [ -n "${{ inputs.external-plugins }}" ]; then + echo "Setting up external plugins." + for plugin in ${{ inputs.external-plugins }}; do + plugin_base=${plugin%@*} + plugin_branch=${plugin##*@} + plugin_repo=$(basename "$plugin_base") + + echo "Adding line 'sofa_add_external(plugin $plugin_repo GIT_REF $plugin_branch GIT_REPOSITORY $plugin_base ON)' to file ${SRC_DIR}/applications/CMakeLists.txt" + echo "sofa_add_external(plugin $plugin_repo GIT_REF $plugin_branch GIT_REPOSITORY $plugin_base ON)" >> "${SRC_DIR}/applications/CMakeLists.txt" + done + fi + + + - name: Build SOFA [MacOS/Linux/Windows] shell: bash -el {0} env: SOFA_BUILD_TYPE: ${{ matrix.build_type }} run: | - pixi run -e ${{ matrix.environment }} build + cd ${SRC_DIR} + + + ## Deal with ci-depends-on + # Loop over each key-value pair in the JSON avoiding ci repository if inside + CMAKE_OPTIONS="${{inputs.additionnal-cmake-flags}}" + for key in $(echo "${{ inputs.ci-depends-on }}" | jq -r 'keys[]' | grep -v '^ci$'); do + + repo_url=$(echo "${{ inputs.ci-depends-on }}" | jq -r ".\"$key\".repo_url") + branch_name=$(echo "${{ inputs.ci-depends-on }}" | jq -r ".\"$key\".branch_name") + + # Format the CMake flags for this key and append to the result + fixed_name=$(echo "$key" | awk '{gsub(/\./, "_"); print toupper($0)}') + flag_repository="-D${fixed_name}_GIT_REPOSITORY=\"$repo_url\"" + flag_tag="-D${fixed_name}_GIT_TAG=\"$branch_name\"" + + # Append both flags to the result string with a space + CMAKE_OPTIONS="$CMAKE_OPTIONS $flag_repository $flag_tag " + done + + if [[ ! -n "$CMAKE_OPTIONS" ]]; then + echo "No ci-depends-on detected." + else + echo "Adding the following cmake variable : $CMAKE_OPTIONS" + fi + + ## Run build step + pixi run -e ${{ matrix.environment }} configure $CMAKE_OPTIONS + pixi run -e ${{ matrix.environment }} build - name: Testing - Run SOFA in batch mode [MacOS/Linux/Windows] shell: bash -el {0} diff --git a/.github/workflows/trigger-build-and-tests.yml b/.github/workflows/trigger-build-and-tests.yml index d25724995eb..cc03beaac29 100644 --- a/.github/workflows/trigger-build-and-tests.yml +++ b/.github/workflows/trigger-build-and-tests.yml @@ -40,10 +40,14 @@ on: type: choice description: On which OS run the binaries generation options: - - '["sh-ubuntu_gcc_release"]' - - '["sh-macos_clang_release"]' - - '["sh-ubuntu_gcc_release","sh-macos_clang_release"]' - default: '["sh-ubuntu_gcc_release","sh-macos_clang_release"]' + - '["ubuntu"]' + - '["macos"]' + - '["windows"]' + - '["ubuntu","macos"]' + - '["ubuntu","windows"]' + - '["macos","windows"]' + - '["ubuntu","macos","windows"]' + default: '["ubuntu","macos","windows"]' # PR-related build (open, labels, push) pull_request: @@ -63,7 +67,7 @@ jobs: # Filter build handling : push in master, commits in PR, comments in PR and dispatch filter_build: runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'sofa-framework' }} + if: ${{ github.repository_owner == 'bakpaul' }} outputs: SOFA_BRANCH_NAME: ${{ steps.export-vars.outputs.SOFA_BRANCH_NAME }} SOFA_COMMIT_SHA: ${{ steps.export-vars.outputs.SOFA_COMMIT_SHA }} @@ -78,7 +82,8 @@ jobs: PR_OWNER_URL: ${{ steps.export-vars.outputs.PR_OWNER_URL }} PR_BRANCH_NAME: ${{ steps.export-vars.outputs.PR_BRANCH_NAME }} PR_COMMIT_SHA: ${{ steps.export-vars.outputs.PR_COMMIT_SHA }} - BUILDER_OS: ${{ steps.export-vars.outputs.BUILDER_OS }} + SH_BUILDER_OS: ${{ steps.export-vars.outputs.SH_BUILDER_OS }} + PIXI_BUILDER_OS: ${{ steps.export-vars.outputs.PIXI_BUILDER_OS }} steps: - name: Default values of environment variables @@ -96,7 +101,8 @@ jobs: echo "PR_OWNER_URL=" >> $GITHUB_ENV # PR_OWNER_URL: "" echo "PR_BRANCH_NAME=" >> $GITHUB_ENV # PR_BRANCH_NAME: "" echo "PR_COMMIT_SHA=HEAD" >> $GITHUB_ENV # PR_COMMIT_SHA: "HEAD" - echo 'BUILDER_OS=["sh-ubuntu_gcc_release"]' >> $GITHUB_ENV # BUILDER_OS: ["sh-ubuntu_gcc_release"] + echo 'SH_BUILDER_OS=["sh-ubuntu_gcc_release","sh-macos_clang_release"]' >> $GITHUB_ENV # BUILDER_OS: ubuntu and maco + echo 'PIXI_BUILDER_OS=["windows-latest"]' >> $GITHUB_ENV # BUILDER_OS: windows - name: Run on dispatch if: ${{ github.event_name == 'workflow_dispatch' }} @@ -129,11 +135,26 @@ jobs: echo "PRESET=${{ github.event.inputs.preset }}" >> $GITHUB_ENV echo "PYTHON_VERSION=${{ github.event.inputs.python_version }}" >> $GITHUB_ENV echo "GENERATE_BINARIES=true" >> $GITHUB_ENV - echo 'BUILDER_OS=${{ github.event.inputs.builder-os }}' >> $GITHUB_ENV echo "FORCE_FULL_BUILD=true" >> $GITHUB_ENV echo "EXTERNAL_PLUGINS=${{ inputs.external-plugins }}" >> $GITHUB_ENV echo "ADDITIONNAL_CMAKE_FLAGS=${{ inputs.additionnal-cmake-flags }}" >> $GITHUB_ENV + if [[ "${{ inputs.builder-os}}" == *"windows"* ]]; then + echo 'PIXI_BUILDER_OS=["windows-latest"]' >> $GITHUB_ENV + else + echo 'PIXI_BUILDER_OS=[]' >> $GITHUB_ENV + fi + + if [[ "${{ inputs.builder-os}}" == *"ubuntu"* && "${{ inputs.builder-os}}" == *"macos"*]]; then + echo 'SH_BUILDER_OS=["sh-ubuntu_gcc_release","sh-macos_clang_release"]' >> $GITHUB_ENV + elif [[ "${{ inputs.builder-os}}" == *"ubuntu"* ]]; then + echo 'SH_BUILDER_OS=["sh-ubuntu_gcc_release"]' >> $GITHUB_ENV + elif [[ "${{ inputs.builder-os}}" == *"macos"* ]]; then + echo 'SH_BUILDER_OS=["sh-macos_clang_release"]' >> $GITHUB_ENV + else + echo 'SH_BUILDER_OS=[]' >> $GITHUB_ENV + fi + - name: Set up python uses: actions/setup-python@v5 @@ -159,7 +180,9 @@ jobs: echo "SOFA_COMMIT_SHA=${{ github.sha }}">> $GITHUB_ENV echo "WITH_ALL_TESTS=true" >> $GITHUB_ENV echo "FORCE_FULL_BUILD=true" >> $GITHUB_ENV - echo 'BUILDER_OS=["sh-ubuntu_gcc_release","sh-ubuntu_clang_release","sh-ubuntu_clang_debug","sh-fedora_clang_release","sh-macos_clang_release"]' >> $GITHUB_ENV + echo 'SH_BUILDER_OS=["sh-ubuntu_gcc_release","sh-ubuntu_clang_release","sh-ubuntu_clang_debug","sh-fedora_clang_release","sh-macos_clang_release"]' >> $GITHUB_ENV + echo 'PIXI_BUILDER_OS=["ubuntu-latest", "macos-latest", "macos-15-intel", "windows-latest"]' >> $GITHUB_ENV + - name: Run when PR is opened or a commit is pushed in a PR if: ${{ github.event_name == 'pull_request' }} @@ -179,7 +202,7 @@ jobs: id: export-vars run: | # Validate branch format (e.g., v25.06) - if [ [ ! "$SOFA_BRANCH_NAME" =~ ^v[0-9]{2}\.[0-9]{2}$ ] && [ "$SOFA_BRANCH_NAME" != "master" ] ]; then + if [[ ! "$SOFA_BRANCH_NAME" =~ ^v[0-9]{2}\.[0-9]{2}$ && "$SOFA_BRANCH_NAME" != "master" ]]; then echo "Error: Invalid branch name format: $SOFA_BRANCH_NAME." echo "Branch name should be either master or any release branch (e.g., v25.06)" exit 1 @@ -198,7 +221,8 @@ jobs: echo "PR_OWNER_URL=${PR_OWNER_URL}" >> $GITHUB_OUTPUT echo "PR_BRANCH_NAME=${PR_BRANCH_NAME}" >> $GITHUB_OUTPUT echo "PR_COMMIT_SHA=${PR_COMMIT_SHA}" >> $GITHUB_OUTPUT - echo "BUILDER_OS=${BUILDER_OS}" >> $GITHUB_OUTPUT + echo "SH_BUILDER_OS=${SH_BUILDER_OS}" >> $GITHUB_OUTPUT + echo "PIXI_BUILDER_OS=${PIXI_BUILDER_OS}" >> $GITHUB_OUTPUT # =============================================================== @@ -207,8 +231,8 @@ jobs: # Trigger the build and sharing all parameters from filter_build > outputs build-on: needs: filter_build - if: ${{ github.repository_owner == 'sofa-framework' }} - uses: sofa-framework/sofa/.github/workflows/build-and-test.yml@master + if: ${{ github.repository_owner == 'bakpaul' && needs.filter_build.outputs.SH_BUILDER_OS != '[]' }} + uses: bakpaul/sofa/.github/workflows/build-and-test.yml@master with: sofa-branch-name: ${{ needs.filter_build.outputs.SOFA_BRANCH_NAME }} sofa-commit-sha: ${{ needs.filter_build.outputs.SOFA_COMMIT_SHA }} @@ -223,4 +247,26 @@ jobs: pr-owner-url: ${{ needs.filter_build.outputs.PR_OWNER_URL }} pr-branch-name: ${{ needs.filter_build.outputs.PR_BRANCH_NAME }} pr-commit-sha: ${{ needs.filter_build.outputs.PR_COMMIT_SHA }} - builder-os: ${{ needs.filter_build.outputs.BUILDER_OS }} + builder-os: ${{ needs.filter_build.outputs.SH_BUILDER_OS }} + + # Trigger the build and sharing all parameters from filter_build > outputs + pixi-ci: + needs: filter_build + if: ${{ github.repository_owner == 'bakpaul' && needs.filter_build.outputs.PIXI_BUILDER_OS != '[]' }} + uses: bakpaul/sofa/.github/workflows/ci-macos-linux-windows-pixi.yml@master + with: + sofa-branch-name: ${{ needs.filter_build.outputs.SOFA_BRANCH_NAME }} + sofa-commit-sha: ${{ needs.filter_build.outputs.SOFA_COMMIT_SHA }} + preset: ${{ needs.filter_build.outputs.PRESET }} + python-version: ${{ needs.filter_build.outputs.PYTHON_VERSION }} + ci-depends-on: ${{ needs.filter_build.outputs.CI_DEPENDS_ON }} + with-all-tests: ${{ needs.filter_build.outputs.WITH_ALL_TESTS == 'true'}} + force-full-build: ${{ needs.filter_build.outputs.FORCE_FULL_BUILD == 'true'}} + external-plugins: ${{ needs.filter_build.outputs.EXTERNAL_PLUGINS }} + additionnal-cmake-flags: ${{ needs.filter_build.outputs.ADDITIONNAL_CMAKE_FLAGS }} + generate-binaries: ${{ needs.filter_build.outputs.GENERATE_BINARIES == 'true'}} + pr-owner-url: ${{ needs.filter_build.outputs.PR_OWNER_URL }} + pr-branch-name: ${{ needs.filter_build.outputs.PR_BRANCH_NAME }} + pr-commit-sha: ${{ needs.filter_build.outputs.PR_COMMIT_SHA }} + builder-os: ${{ needs.filter_build.outputs.PIXI_BUILDER_OS }} + From 2e83283b33141bcd5e2ac50a33919a6232540b04 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:41:21 +0100 Subject: [PATCH 02/17] put back filter for self hosted --- .github/workflows/ci-macos-linux-windows-pixi.yml | 1 - .github/workflows/trigger-build-and-tests.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index f28ee9b1beb..e4d9a8f66fa 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -59,7 +59,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - jobs: display-inputs: runs-on: ubuntu-latest diff --git a/.github/workflows/trigger-build-and-tests.yml b/.github/workflows/trigger-build-and-tests.yml index cc03beaac29..b21c6ff65c6 100644 --- a/.github/workflows/trigger-build-and-tests.yml +++ b/.github/workflows/trigger-build-and-tests.yml @@ -231,7 +231,7 @@ jobs: # Trigger the build and sharing all parameters from filter_build > outputs build-on: needs: filter_build - if: ${{ github.repository_owner == 'bakpaul' && needs.filter_build.outputs.SH_BUILDER_OS != '[]' }} + if: ${{ github.repository_owner == 'sofa-framework' && needs.filter_build.outputs.SH_BUILDER_OS != '[]' }} uses: bakpaul/sofa/.github/workflows/build-and-test.yml@master with: sofa-branch-name: ${{ needs.filter_build.outputs.SOFA_BRANCH_NAME }} From c9f402caa4648772027d996e45446f890abe0590 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:44:44 +0100 Subject: [PATCH 03/17] Try fix pixi strategy --- .github/workflows/ci-macos-linux-windows-pixi.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index e4d9a8f66fa..e1e89d9fb77 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -83,15 +83,15 @@ jobs: echo "builder-os : ${{ inputs.builder-os }}" sofa-pixi: - name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} - runs-on: ${{ matrix.os }} - strategy: fail-fast: false matrix: os: ${{ fromJson(inputs.builder-os) }} environment: ${{ fromJson(inputs.preset) }} build_type: [Release] + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} + steps: - uses: actions/checkout@v4 From a574be132258172c56387ba2b7f2bbceac7c02db Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:47:05 +0100 Subject: [PATCH 04/17] Remove matrix for environement --- .github/workflows/ci-macos-linux-windows-pixi.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index e1e89d9fb77..7fdb5f802ac 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -87,10 +87,9 @@ jobs: fail-fast: false matrix: os: ${{ fromJson(inputs.builder-os) }} - environment: ${{ fromJson(inputs.preset) }} build_type: [Release] runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} + name: ${{ matrix.os }} - Env ${{ inputs.preset }} ${{ matrix.build_type }} ${{ matrix.compiler }} steps: @@ -105,7 +104,7 @@ jobs: - uses: prefix-dev/setup-pixi@v0.8.10 with: cache: false - environments: ${{ matrix.environment }} + environments: ${{ inputs.preset }} - name: Setup SOFA and clone CI shell: bash -el {0} @@ -210,12 +209,12 @@ jobs: fi ## Run build step - pixi run -e ${{ matrix.environment }} configure $CMAKE_OPTIONS - pixi run -e ${{ matrix.environment }} build + pixi run -e ${{ inputs.preset }} configure $CMAKE_OPTIONS + pixi run -e ${{ inputs.preset }} build - name: Testing - Run SOFA in batch mode [MacOS/Linux/Windows] shell: bash -el {0} env: SOFA_BUILD_TYPE: ${{ matrix.build_type }} run: | - pixi run -e ${{ matrix.environment }} runSofa -g batch + pixi run -e ${{ inputs.preset }} runSofa -g batch From aa2a7dae9fff41c24aaf0afb2e48db89e4ee7688 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:52:18 +0100 Subject: [PATCH 05/17] Give right pixi toml path --- .github/workflows/ci-macos-linux-windows-pixi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index 7fdb5f802ac..126b8222082 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -104,6 +104,7 @@ jobs: - uses: prefix-dev/setup-pixi@v0.8.10 with: cache: false + manifest-path: sofa/pixi.toml environments: ${{ inputs.preset }} - name: Setup SOFA and clone CI From a6fa9585e202de071f9d226c63e99835ff00b5f6 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:55:24 +0100 Subject: [PATCH 06/17] dummy --- .github/workflows/ci-macos-linux-windows-pixi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index 126b8222082..3e6efe6dc68 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -183,9 +183,9 @@ jobs: env: SOFA_BUILD_TYPE: ${{ matrix.build_type }} run: | - cd ${SRC_DIR} + cd ${SRC_DIR} - + ## Deal with ci-depends-on # Loop over each key-value pair in the JSON avoiding ci repository if inside CMAKE_OPTIONS="${{inputs.additionnal-cmake-flags}}" From 4798340d84cc1c3b2a57c796cb3fa95e93dea5b7 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:35:52 +0100 Subject: [PATCH 07/17] Integrate PIXI ci, without tests and change filtering temporarly --- .../workflows/ci-macos-linux-windows-pixi.yml | 190 +++++++++++++++++- .github/workflows/trigger-build-and-tests.yml | 72 +++++-- 2 files changed, 243 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index 3dc4b7965e7..f28ee9b1beb 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -1,15 +1,88 @@ name: CI - MacOS/Linux/Windows via Pixi on: - push: - pull_request: - workflow_dispatch: + workflow_call: + inputs: + sofa-branch-name: + type: string + required: true + sofa-commit-sha: + type: string + required: true + pr-owner-url: + type: string + required: false + pr-branch-name: + type: string + required: false + pr-commit-sha: + type: string + required: false + preset: + type: string + required: true + python-version: + type: string + required: true + ci-depends-on: + type: string + required: false + with-all-tests: + type: boolean + required: false + default: false + force-full-build: + type: boolean + required: false + default: false + generate-binaries: + type: boolean + required: false + default: false + external-plugins: + type: string + required: false + additionnal-cmake-flags: + type: string + required: false + builder-os: + type: string + required: true + default: '["ubuntu-latest", "macos-latest", "macos-15-intel", "windows-latest"]' + dash-info: + type: string + required: false + default: 'NONE' + description: 'Json scructure with three parameters {"COMMIT_HASH":"fullhsashofthecommit", }' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: + display-inputs: + runs-on: ubuntu-latest + steps: + - name: Display + shell: bash + run: | + echo "Build and test launched with following parameters:" + echo "sofa-branch-name : ${{ inputs.sofa-branch-name }}" + echo "sofa-commit-sha : ${{ inputs.sofa-commit-sha }}" + echo "pr-owner-url : ${{ inputs.pr-owner-url }}" + echo "pr-branch-name : ${{ inputs.pr-branch-name }}" + echo "pr-commit-sha : ${{ inputs.pr-commit-sha }}" + echo "preset : ${{ inputs.preset }}" + echo "python-version : ${{ inputs.python-version }}" + echo "ci-depends-on : ${{ inputs.ci-depends-on }}" + echo "with-all-tests : ${{ inputs.with-all-tests }}" + echo "force-full-build : ${{ inputs.force-full-build }}" + echo "generate-binaries : ${{ inputs.generate-binaries }}" + echo "external-plugins : ${{ inputs.external-plugins }}" + echo "additionnal-cmake-flags : ${{ inputs.additionnal-cmake-flags }}" + echo "builder-os : ${{ inputs.builder-os }}" + sofa-pixi: name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} runs-on: ${{ matrix.os }} @@ -17,24 +90,129 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, macos-15-intel, windows-latest] - environment: [supported-plugins] + os: ${{ fromJson(inputs.builder-os) }} + environment: ${{ fromJson(inputs.preset) }} build_type: [Release] steps: - uses: actions/checkout@v4 + with: + ref: ${{ inputs.sofa-branch-name }} + path: sofa + + - run: git config --global user.email "<>" + - run: git config --global user.name "SOFA Bot" - uses: prefix-dev/setup-pixi@v0.8.10 with: cache: false environments: ${{ matrix.environment }} + - name: Setup SOFA and clone CI + shell: bash -el {0} + run: | + export WORKSPACE=$GITHUB_WORKSPACE + echo "WORKSPACE=$WORKSPACE" >> $GITHUB_ENV + + export SRC_DIR=$GITHUB_WORKSPACE/sofa + echo "SRC_DIR=$SRC_DIR" >> $GITHUB_ENV + + cd $SRC_DIR + if [ ! -z "${{ inputs.pr-owner-url }}" ]; then + echo "This is a PR, merging branch ${{ inputs.pr-branch-name }} from remote ${{ inputs.pr-owner-url }} into origin branch ${{ inputs.sofa-branch-name }}" + git remote add pr ${{ inputs.pr-owner-url }} + git fetch pr + + if [ "${{ inputs.pr-commit-sha }}" == "HEAD" ]; then + git merge ${{ inputs.pr-branch-name }} + else + git merge ${{ inputs.pr-commit-sha }} + fi + else + echo "This is not a PR: checking out sha ${{ inputs.sofa-commit-sha }} from branch ${{ inputs.sofa-branch-name }}" + git checkout ${{ inputs.sofa-commit-sha }} + fi + + cd $WORKSPACE + + ## Clone CI and use ci-depends-on structure + ci_branch=${{ inputs.sofa-branch-name }} + ci_repo_url="https://www.github.com/sofa-framework/ci" + + + # check if ci has a ci-depends-on + ci_ci_depends_on=$(echo "${{ inputs.ci-depends-on }}" | jq .ci) + if [ -n "${{ inputs.ci-depends-on }}" ] && [ "$ci_ci_depends_on" != "null" ]; then + echo "ci-depends-on for ci repository detected." + ci_repo_url=$(echo "${{ inputs.ci-depends-on }}" | jq .ci.repo_url) + ci_branch=$(echo "${{ inputs.ci-depends-on }}" | jq .ci.branch_name) + fi + echo "CI_BRANCH=$ci_branch" >> $GITHUB_ENV + + + echo "Cloning CI from remote ${ci_repo_url}, selecting branch ${ci_branch}" + + CI_DIR=$WORKSPACE/ci + echo "CI_DIR=$CI_DIR" >> $GITHUB_ENV + + git clone -b ${ci_branch//\"} --single-branch ${ci_repo_url//\"} + + cd $WORKSPACE + + ## Setup build folder + mkdir $WORKSPACE/build + + SOFA_BUILD_DIR=$WORKSPACE/build + echo "SOFA_BUILD_DIR=$SOFA_BUILD_DIR" >> $GITHUB_ENV + + if [ -n "${{ inputs.external-plugins }}" ]; then + echo "Setting up external plugins." + for plugin in ${{ inputs.external-plugins }}; do + plugin_base=${plugin%@*} + plugin_branch=${plugin##*@} + plugin_repo=$(basename "$plugin_base") + + echo "Adding line 'sofa_add_external(plugin $plugin_repo GIT_REF $plugin_branch GIT_REPOSITORY $plugin_base ON)' to file ${SRC_DIR}/applications/CMakeLists.txt" + echo "sofa_add_external(plugin $plugin_repo GIT_REF $plugin_branch GIT_REPOSITORY $plugin_base ON)" >> "${SRC_DIR}/applications/CMakeLists.txt" + done + fi + + + - name: Build SOFA [MacOS/Linux/Windows] shell: bash -el {0} env: SOFA_BUILD_TYPE: ${{ matrix.build_type }} run: | - pixi run -e ${{ matrix.environment }} build + cd ${SRC_DIR} + + + ## Deal with ci-depends-on + # Loop over each key-value pair in the JSON avoiding ci repository if inside + CMAKE_OPTIONS="${{inputs.additionnal-cmake-flags}}" + for key in $(echo "${{ inputs.ci-depends-on }}" | jq -r 'keys[]' | grep -v '^ci$'); do + + repo_url=$(echo "${{ inputs.ci-depends-on }}" | jq -r ".\"$key\".repo_url") + branch_name=$(echo "${{ inputs.ci-depends-on }}" | jq -r ".\"$key\".branch_name") + + # Format the CMake flags for this key and append to the result + fixed_name=$(echo "$key" | awk '{gsub(/\./, "_"); print toupper($0)}') + flag_repository="-D${fixed_name}_GIT_REPOSITORY=\"$repo_url\"" + flag_tag="-D${fixed_name}_GIT_TAG=\"$branch_name\"" + + # Append both flags to the result string with a space + CMAKE_OPTIONS="$CMAKE_OPTIONS $flag_repository $flag_tag " + done + + if [[ ! -n "$CMAKE_OPTIONS" ]]; then + echo "No ci-depends-on detected." + else + echo "Adding the following cmake variable : $CMAKE_OPTIONS" + fi + + ## Run build step + pixi run -e ${{ matrix.environment }} configure $CMAKE_OPTIONS + pixi run -e ${{ matrix.environment }} build - name: Testing - Run SOFA in batch mode [MacOS/Linux/Windows] shell: bash -el {0} diff --git a/.github/workflows/trigger-build-and-tests.yml b/.github/workflows/trigger-build-and-tests.yml index 2eafe835a41..c2a1a2730e6 100644 --- a/.github/workflows/trigger-build-and-tests.yml +++ b/.github/workflows/trigger-build-and-tests.yml @@ -40,10 +40,14 @@ on: type: choice description: On which OS run the binaries generation options: - - '["sh-ubuntu_gcc_release"]' - - '["sh-macos_clang_release"]' - - '["sh-ubuntu_gcc_release","sh-macos_clang_release"]' - default: '["sh-ubuntu_gcc_release","sh-macos_clang_release"]' + - '["ubuntu"]' + - '["macos"]' + - '["windows"]' + - '["ubuntu","macos"]' + - '["ubuntu","windows"]' + - '["macos","windows"]' + - '["ubuntu","macos","windows"]' + default: '["ubuntu","macos","windows"]' # PR-related build (open, labels, push) pull_request: @@ -63,7 +67,7 @@ jobs: # Filter build handling : push in master, commits in PR, comments in PR and dispatch filter_build: runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'sofa-framework' }} + if: ${{ github.repository_owner == 'bakpaul' }} outputs: SOFA_BRANCH_NAME: ${{ steps.export-vars.outputs.SOFA_BRANCH_NAME }} SOFA_COMMIT_SHA: ${{ steps.export-vars.outputs.SOFA_COMMIT_SHA }} @@ -78,7 +82,8 @@ jobs: PR_OWNER_URL: ${{ steps.export-vars.outputs.PR_OWNER_URL }} PR_BRANCH_NAME: ${{ steps.export-vars.outputs.PR_BRANCH_NAME }} PR_COMMIT_SHA: ${{ steps.export-vars.outputs.PR_COMMIT_SHA }} - BUILDER_OS: ${{ steps.export-vars.outputs.BUILDER_OS }} + SH_BUILDER_OS: ${{ steps.export-vars.outputs.SH_BUILDER_OS }} + PIXI_BUILDER_OS: ${{ steps.export-vars.outputs.PIXI_BUILDER_OS }} steps: - name: Default values of environment variables @@ -96,7 +101,8 @@ jobs: echo "PR_OWNER_URL=" >> $GITHUB_ENV # PR_OWNER_URL: "" echo "PR_BRANCH_NAME=" >> $GITHUB_ENV # PR_BRANCH_NAME: "" echo "PR_COMMIT_SHA=HEAD" >> $GITHUB_ENV # PR_COMMIT_SHA: "HEAD" - echo 'BUILDER_OS=["sh-ubuntu_gcc_release"]' >> $GITHUB_ENV # BUILDER_OS: ["sh-ubuntu_gcc_release"] + echo 'SH_BUILDER_OS=["sh-ubuntu_gcc_release","sh-macos_clang_release"]' >> $GITHUB_ENV # BUILDER_OS: ubuntu and maco + echo 'PIXI_BUILDER_OS=["windows-latest"]' >> $GITHUB_ENV # BUILDER_OS: windows - name: Run on dispatch if: ${{ github.event_name == 'workflow_dispatch' }} @@ -129,11 +135,26 @@ jobs: echo "PRESET=${{ github.event.inputs.preset }}" >> $GITHUB_ENV echo "PYTHON_VERSION=${{ github.event.inputs.python_version }}" >> $GITHUB_ENV echo "GENERATE_BINARIES=true" >> $GITHUB_ENV - echo 'BUILDER_OS=${{ github.event.inputs.builder-os }}' >> $GITHUB_ENV echo "FORCE_FULL_BUILD=true" >> $GITHUB_ENV echo "EXTERNAL_PLUGINS=${{ inputs.external-plugins }}" >> $GITHUB_ENV echo "ADDITIONNAL_CMAKE_FLAGS=${{ inputs.additionnal-cmake-flags }}" >> $GITHUB_ENV + if [[ "${{ inputs.builder-os}}" == *"windows"* ]]; then + echo 'PIXI_BUILDER_OS=["windows-latest"]' >> $GITHUB_ENV + else + echo 'PIXI_BUILDER_OS=[]' >> $GITHUB_ENV + fi + + if [[ "${{ inputs.builder-os}}" == *"ubuntu"* && "${{ inputs.builder-os}}" == *"macos"*]]; then + echo 'SH_BUILDER_OS=["sh-ubuntu_gcc_release","sh-macos_clang_release"]' >> $GITHUB_ENV + elif [[ "${{ inputs.builder-os}}" == *"ubuntu"* ]]; then + echo 'SH_BUILDER_OS=["sh-ubuntu_gcc_release"]' >> $GITHUB_ENV + elif [[ "${{ inputs.builder-os}}" == *"macos"* ]]; then + echo 'SH_BUILDER_OS=["sh-macos_clang_release"]' >> $GITHUB_ENV + else + echo 'SH_BUILDER_OS=[]' >> $GITHUB_ENV + fi + - name: Set up python uses: actions/setup-python@v5 @@ -159,7 +180,9 @@ jobs: echo "SOFA_COMMIT_SHA=${{ github.sha }}">> $GITHUB_ENV echo "WITH_ALL_TESTS=true" >> $GITHUB_ENV echo "FORCE_FULL_BUILD=true" >> $GITHUB_ENV - echo 'BUILDER_OS=["sh-ubuntu_gcc_release","sh-ubuntu_clang_release","sh-ubuntu_clang_debug","sh-fedora_clang_release","sh-macos_clang_release"]' >> $GITHUB_ENV + echo 'SH_BUILDER_OS=["sh-ubuntu_gcc_release","sh-ubuntu_clang_release","sh-ubuntu_clang_debug","sh-fedora_clang_release","sh-macos_clang_release"]' >> $GITHUB_ENV + echo 'PIXI_BUILDER_OS=["ubuntu-latest", "macos-latest", "macos-15-intel", "windows-latest"]' >> $GITHUB_ENV + - name: Run when PR is opened or a commit is pushed in a PR if: ${{ github.event_name == 'pull_request' }} @@ -198,7 +221,8 @@ jobs: echo "PR_OWNER_URL=${PR_OWNER_URL}" >> $GITHUB_OUTPUT echo "PR_BRANCH_NAME=${PR_BRANCH_NAME}" >> $GITHUB_OUTPUT echo "PR_COMMIT_SHA=${PR_COMMIT_SHA}" >> $GITHUB_OUTPUT - echo "BUILDER_OS=${BUILDER_OS}" >> $GITHUB_OUTPUT + echo "SH_BUILDER_OS=${SH_BUILDER_OS}" >> $GITHUB_OUTPUT + echo "PIXI_BUILDER_OS=${PIXI_BUILDER_OS}" >> $GITHUB_OUTPUT # =============================================================== @@ -207,8 +231,8 @@ jobs: # Trigger the build and sharing all parameters from filter_build > outputs build-on: needs: filter_build - if: ${{ github.repository_owner == 'sofa-framework' }} - uses: sofa-framework/sofa/.github/workflows/build-and-test.yml@master + if: ${{ github.repository_owner == 'bakpaul' && needs.filter_build.outputs.SH_BUILDER_OS != '[]' }} + uses: bakpaul/sofa/.github/workflows/build-and-test.yml@master with: sofa-branch-name: ${{ needs.filter_build.outputs.SOFA_BRANCH_NAME }} sofa-commit-sha: ${{ needs.filter_build.outputs.SOFA_COMMIT_SHA }} @@ -223,4 +247,26 @@ jobs: pr-owner-url: ${{ needs.filter_build.outputs.PR_OWNER_URL }} pr-branch-name: ${{ needs.filter_build.outputs.PR_BRANCH_NAME }} pr-commit-sha: ${{ needs.filter_build.outputs.PR_COMMIT_SHA }} - builder-os: ${{ needs.filter_build.outputs.BUILDER_OS }} + builder-os: ${{ needs.filter_build.outputs.SH_BUILDER_OS }} + + # Trigger the build and sharing all parameters from filter_build > outputs + pixi-ci: + needs: filter_build + if: ${{ github.repository_owner == 'bakpaul' && needs.filter_build.outputs.PIXI_BUILDER_OS != '[]' }} + uses: bakpaul/sofa/.github/workflows/ci-macos-linux-windows-pixi.yml@master + with: + sofa-branch-name: ${{ needs.filter_build.outputs.SOFA_BRANCH_NAME }} + sofa-commit-sha: ${{ needs.filter_build.outputs.SOFA_COMMIT_SHA }} + preset: ${{ needs.filter_build.outputs.PRESET }} + python-version: ${{ needs.filter_build.outputs.PYTHON_VERSION }} + ci-depends-on: ${{ needs.filter_build.outputs.CI_DEPENDS_ON }} + with-all-tests: ${{ needs.filter_build.outputs.WITH_ALL_TESTS == 'true'}} + force-full-build: ${{ needs.filter_build.outputs.FORCE_FULL_BUILD == 'true'}} + external-plugins: ${{ needs.filter_build.outputs.EXTERNAL_PLUGINS }} + additionnal-cmake-flags: ${{ needs.filter_build.outputs.ADDITIONNAL_CMAKE_FLAGS }} + generate-binaries: ${{ needs.filter_build.outputs.GENERATE_BINARIES == 'true'}} + pr-owner-url: ${{ needs.filter_build.outputs.PR_OWNER_URL }} + pr-branch-name: ${{ needs.filter_build.outputs.PR_BRANCH_NAME }} + pr-commit-sha: ${{ needs.filter_build.outputs.PR_COMMIT_SHA }} + builder-os: ${{ needs.filter_build.outputs.PIXI_BUILDER_OS }} + From 02a5d57f8b2a31fce61f2c6e3b5d7042bfb8f8d5 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:41:21 +0100 Subject: [PATCH 08/17] put back filter for self hosted --- .github/workflows/ci-macos-linux-windows-pixi.yml | 1 - .github/workflows/trigger-build-and-tests.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index f28ee9b1beb..e4d9a8f66fa 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -59,7 +59,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - jobs: display-inputs: runs-on: ubuntu-latest diff --git a/.github/workflows/trigger-build-and-tests.yml b/.github/workflows/trigger-build-and-tests.yml index c2a1a2730e6..fdad107500a 100644 --- a/.github/workflows/trigger-build-and-tests.yml +++ b/.github/workflows/trigger-build-and-tests.yml @@ -231,7 +231,7 @@ jobs: # Trigger the build and sharing all parameters from filter_build > outputs build-on: needs: filter_build - if: ${{ github.repository_owner == 'bakpaul' && needs.filter_build.outputs.SH_BUILDER_OS != '[]' }} + if: ${{ github.repository_owner == 'sofa-framework' && needs.filter_build.outputs.SH_BUILDER_OS != '[]' }} uses: bakpaul/sofa/.github/workflows/build-and-test.yml@master with: sofa-branch-name: ${{ needs.filter_build.outputs.SOFA_BRANCH_NAME }} From b810c0004ce2b7c5f496ab735af170eedb8d561b Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:44:44 +0100 Subject: [PATCH 09/17] Try fix pixi strategy --- .github/workflows/ci-macos-linux-windows-pixi.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index e4d9a8f66fa..e1e89d9fb77 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -83,15 +83,15 @@ jobs: echo "builder-os : ${{ inputs.builder-os }}" sofa-pixi: - name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} - runs-on: ${{ matrix.os }} - strategy: fail-fast: false matrix: os: ${{ fromJson(inputs.builder-os) }} environment: ${{ fromJson(inputs.preset) }} build_type: [Release] + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} + steps: - uses: actions/checkout@v4 From e62124a9ff939f0449bcbab25db6714999898878 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:47:05 +0100 Subject: [PATCH 10/17] Remove matrix for environement --- .github/workflows/ci-macos-linux-windows-pixi.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index e1e89d9fb77..7fdb5f802ac 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -87,10 +87,9 @@ jobs: fail-fast: false matrix: os: ${{ fromJson(inputs.builder-os) }} - environment: ${{ fromJson(inputs.preset) }} build_type: [Release] runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} + name: ${{ matrix.os }} - Env ${{ inputs.preset }} ${{ matrix.build_type }} ${{ matrix.compiler }} steps: @@ -105,7 +104,7 @@ jobs: - uses: prefix-dev/setup-pixi@v0.8.10 with: cache: false - environments: ${{ matrix.environment }} + environments: ${{ inputs.preset }} - name: Setup SOFA and clone CI shell: bash -el {0} @@ -210,12 +209,12 @@ jobs: fi ## Run build step - pixi run -e ${{ matrix.environment }} configure $CMAKE_OPTIONS - pixi run -e ${{ matrix.environment }} build + pixi run -e ${{ inputs.preset }} configure $CMAKE_OPTIONS + pixi run -e ${{ inputs.preset }} build - name: Testing - Run SOFA in batch mode [MacOS/Linux/Windows] shell: bash -el {0} env: SOFA_BUILD_TYPE: ${{ matrix.build_type }} run: | - pixi run -e ${{ matrix.environment }} runSofa -g batch + pixi run -e ${{ inputs.preset }} runSofa -g batch From 38c1807aaca7fe9947f3fca26ab0774a946f2c6f Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 5 Jan 2026 17:52:18 +0100 Subject: [PATCH 11/17] Give right pixi toml path --- .github/workflows/ci-macos-linux-windows-pixi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index 7fdb5f802ac..126b8222082 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -104,6 +104,7 @@ jobs: - uses: prefix-dev/setup-pixi@v0.8.10 with: cache: false + manifest-path: sofa/pixi.toml environments: ${{ inputs.preset }} - name: Setup SOFA and clone CI From f11a61746de2ac9d0d8c91a6dce4be2dd2fe70ed Mon Sep 17 00:00:00 2001 From: bakpaul Date: Fri, 13 Feb 2026 10:43:41 +0100 Subject: [PATCH 12/17] Add tests for pixi based CI --- .../workflows/ci-macos-linux-windows-pixi.yml | 141 +++++++++++++++++- 1 file changed, 136 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index 126b8222082..5515a4bb0b5 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -179,6 +179,7 @@ jobs: - name: Build SOFA [MacOS/Linux/Windows] + id: build-step shell: bash -el {0} env: SOFA_BUILD_TYPE: ${{ matrix.build_type }} @@ -213,9 +214,139 @@ jobs: pixi run -e ${{ inputs.preset }} configure $CMAKE_OPTIONS pixi run -e ${{ inputs.preset }} build - - name: Testing - Run SOFA in batch mode [MacOS/Linux/Windows] - shell: bash -el {0} - env: - SOFA_BUILD_TYPE: ${{ matrix.build_type }} + + - name: Unit tests + id: unit-tests-step + if: always() && steps.build-step.outcome == 'success' && inputs.generate-binaries == false + shell: bash + run: | + # If os has got docker then use it + # Here no need to fetch it because it has already been taken care of in the build step + + echo "Launching unit test suite." + bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "UNIT" + + if [[ "$(cd "${{ env.SOFA_BUILD_DIR }}/tests_results/" && find . -maxdepth 1 -type f)" == *"unit-tests_"* ]]; then + exit 1 + fi + + - name: Scene tests + id: scene-tests-step + if: always() && matrix.os == 'windows-latest' && steps.build-step.outcome == 'success' && inputs.generate-binaries == false && inputs.with-all-tests == true + shell: bash + run: | + # If os has got docker then use it + # Here no need to fetch it because it has already been taken care of in the build step + + echo "Launching scene test suite." + bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "SCENE" + + if [[ "$(cd "${{ env.SOFA_BUILD_DIR }}/tests_results/" && find . -maxdepth 1 -type f)" == *"scene-tests_"* ]]; then + exit 1 + fi + + - name: Regression tests + id: regression-tests-step + if: always() && matrix.os == 'windows-latest' && steps.build-step.outcome == 'success' && inputs.generate-binaries == false && inputs.with-all-tests == true + shell: bash + run: | + # If os has got docker then use it + # Here no need to fetch it because it has already been taken care of in the build step + + echo "Launching regression test suite" + bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "REGRESSION" + + if [[ "$(cd "${{ env.SOFA_BUILD_DIR }}/tests_results/" && find . -maxdepth 1 -type f)" == *"regression-tests_"* ]]; then + exit 1 + fi + + + - name: Publish artifacts + if: steps.build-step.outcome == 'success' && inputs.generate-binaries == true + uses: actions/upload-artifact@v4 + with: + name: binaries_${{ env.BUILDER_OS }} + path: | + ${{ env.SOFA_BUILD_DIR }}/SOFA_v* + + + - name: Publish build logs + id: publish-build-logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: build-logs_${{ env.BUILDER_OS }} + path: | + ${{ env.LOG_DIR }}/make-output.txt + ${{ env.LOG_DIR }}/cmake-output.txt + + + - name: Publish tests logs + id: publish-tests-logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: tests-logs_${{ env.BUILDER_OS }} + path: | + ${{ env.SOFA_BUILD_DIR }}/tests_results/ + + + - name: Summarize results + if: always() + shell: bash run: | - pixi run -e ${{ inputs.preset }} runSofa -g batch + bold="\033[1m" + normal="\033[0m" + if [[ "${{ steps.configure.outcome }}" == "failure" || "${{ steps.clone.outcome }}" == "failure" ]]; then + echo "❌ Something whent wrong during the configure or clone steps..." + echo -e "${bold}Please check those actions logs${normal}" + exit 1 + else + echo "✅ Setup OK." + fi + + if [[ "${{ steps.build-step.outcome }}" == "failure" ]]; then + echo "❌ Build step failed" + echo -e "${bold}You can download all logs here : ${{ steps.publish-build-logs.outputs.artifact-url }}${normal}" + exit 1 + else + echo "✅ Build OK." + fi + + if [[ "${{ inputs.generate-binaries }}" == "false" ]]; then + if [[ "$(cd "${{ env.SOFA_BUILD_DIR }}/tests_results/" && find . -maxdepth 1 -type f)" != "" ]]; then + echo "❌ Tests have resulted in : " + echo "" + python3 ${{ env.CI_DIR }}/scripts/generate-tests-table.py "${{ env.SOFA_BUILD_DIR }}/tests_results/" + echo "" + echo "#----------------------------------------#" + echo "#---------------Quick Logs---------------#" + echo "#----------------------------------------#" + for testType in 'unit' 'scene' 'regression'; + do + for errorType in 'errors' 'crashes' 'failures'; + do + if [ -f "${{ env.SOFA_BUILD_DIR }}/tests_results/${testType}-tests_${errorType}" ]; then + capitalized="$(echo "${testType:0:1}" | tr '[:lower:]' '[:upper:]')${testType:1}" + echo "" + echo -e "${bold}${capitalized} ${errorType}:${normal}" + echo "" + cat "${{ env.SOFA_BUILD_DIR }}/tests_results/${testType}-tests_${errorType}" + echo "" + echo "#----------------------------------------#" + fi + done + done + echo -e "${bold}You can download all logs here : ${{ steps.publish-tests-logs.outputs.artifact-url }}${normal}" + exit 1 + elif [[ "${{ steps.unit-tests-step.outcome }}" == "failure" || "${{ steps.scene-tests-step.outcome }}" == "failure" || "${{ steps.regression-tests-step.outcome }}" == "failure" ]]; then + echo "❌ Something whent wrong during one of the tests steps" + echo -e "${bold}Please check this action logs, and download tests logs here: ${{ steps.publish-tests-logs.outputs.artifact-url }}${normal}" + exit 1 + else + echo "✅ Tests where successful : " + echo "" + python3 ${{ env.CI_DIR }}/scripts/generate-tests-table.py "${{ env.SOFA_BUILD_DIR }}/tests_results/" + echo "" + fi + fi From 4077e2652e25b872c63b5f26169c6f0717f98f65 Mon Sep 17 00:00:00 2001 From: bakpaul Date: Fri, 13 Feb 2026 15:05:15 +0100 Subject: [PATCH 13/17] Force build and install dir if already setup --- development/scripts/pixi/activation.sh | 9 ++++++++- pixi.toml | 18 +++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/development/scripts/pixi/activation.sh b/development/scripts/pixi/activation.sh index 7006e4ea364..c1b5e81c661 100644 --- a/development/scripts/pixi/activation.sh +++ b/development/scripts/pixi/activation.sh @@ -10,7 +10,14 @@ export CMAKE_COLOR_DIAGNOSTICS=1 # Set default build value only if not previously set export CMAKE_PREFIX_PATH=$CONDA_PREFIX # Each environment have its dedicated build dir -export SOFA_BUILD_DIR=$CONDA_PREFIX/sofa-build + +if [[ -z "$SOFA_BUILD_DIR" ]]; then + export SOFA_BUILD_DIR=$CONDA_PREFIX/sofa-build +fi +if [[ -z "$SOFA_INSTALL_PREFIX" ]]; then + export SOFA_INSTALL_PREFIX=$CONDA_PREFIX/ +fi + export SOFA_BUILD_TYPE=${SOFA_BUILD_TYPE:=Release} export SOFA_PYTHON_EXECUTABLE=${SOFA_PYTHON_EXECUTABLE:=$CONDA_PREFIX/bin/python} export SOFA_BUILD_RELEASE_PACKAGE_WITH_PIXI=0 diff --git a/pixi.toml b/pixi.toml index 713971d0197..c25173aba76 100644 --- a/pixi.toml +++ b/pixi.toml @@ -158,7 +158,7 @@ configure = { cmd = [ "cmake", "$SOFA_BUILD_DIR", "-S", ".", - "-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX", + "-DCMAKE_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX", "-DCMAKE_BUILD_TYPE=$SOFA_BUILD_TYPE", "--preset", "conda-core"] } @@ -171,7 +171,7 @@ configure = { cmd = [ "cmake", "$SOFA_BUILD_DIR", "-S", ".", - "-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX", + "-DCMAKE_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX", "-DCMAKE_BUILD_TYPE=$SOFA_BUILD_TYPE", "--preset", "minimal"] } @@ -184,7 +184,7 @@ configure = { cmd = [ "cmake", "$SOFA_BUILD_DIR", "-S", ".", - "-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX", + "-DCMAKE_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX", "-DCMAKE_BUILD_TYPE=$SOFA_BUILD_TYPE", "--preset", "standard", @@ -199,7 +199,7 @@ configure = { cmd = [ "cmake", "-S", ".", "-DCMAKE_VERBOSE_MAKEFILE=ON", - "-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX", + "-DCMAKE_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX", "-DCMAKE_BUILD_TYPE=$SOFA_BUILD_TYPE", "--preset", "supported-plugins", @@ -216,7 +216,7 @@ configure = { cmd = [ "cmake", "-S", ".", "-DCMAKE_VERBOSE_MAKEFILE=ON", - "-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX", + "-DCMAKE_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX", "-DCMAKE_BUILD_TYPE=$SOFA_BUILD_TYPE", "-DPLUGIN_SOFACUDA=$SOFA_PLUGIN_SOFACUDA", "-DSOFACUDA_ENABLE_NATIVE_ARCHITECTURE=ON", @@ -234,7 +234,7 @@ configure = { cmd = [ "cmake", "$SOFA_BUILD_DIR", "-S", ".", - "-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX", + "-DCMAKE_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX", "-DCMAKE_BUILD_TYPE=$SOFA_BUILD_TYPE", "--preset", "minimal-dev"] } @@ -247,7 +247,7 @@ configure = { cmd = [ "cmake", "$SOFA_BUILD_DIR", "-S", ".", - "-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX", + "-DCMAKE_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX", "-DCMAKE_BUILD_TYPE=$SOFA_BUILD_TYPE", "--preset", "standard-dev", @@ -261,7 +261,7 @@ configure = { cmd = [ "cmake", "$SOFA_BUILD_DIR", "-S", ".", - "-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX", + "-DCMAKE_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX", "-DCMAKE_BUILD_TYPE=$SOFA_BUILD_TYPE", "--preset", "supported-plugins-dev", @@ -277,7 +277,7 @@ configure = { cmd = [ "cmake", "$SOFA_BUILD_DIR", "-S", ".", - "-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX", + "-DCMAKE_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX", "-DCMAKE_BUILD_TYPE=$SOFA_BUILD_TYPE", "--preset", "full-dev", From a13f269f59cf72c29eaa774b7656346c7cb73ec4 Mon Sep 17 00:00:00 2001 From: bakpaul Date: Fri, 13 Feb 2026 16:07:18 +0100 Subject: [PATCH 14/17] Add installation of prettytable --- .../workflows/ci-macos-linux-windows-pixi.yml | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index 5515a4bb0b5..6489113b631 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -163,6 +163,8 @@ jobs: SOFA_BUILD_DIR=$WORKSPACE/build echo "SOFA_BUILD_DIR=$SOFA_BUILD_DIR" >> $GITHUB_ENV + SOFA_INSTALL_PREFIX=$WORKSPACE/install + echo "SOFA_INSTALL_PREFIX=$SOFA_INSTALL_PREFIX" >> $GITHUB_ENV if [ -n "${{ inputs.external-plugins }}" ]; then echo "Setting up external plugins." @@ -175,6 +177,10 @@ jobs: echo "sofa_add_external(plugin $plugin_repo GIT_REF $plugin_branch GIT_REPOSITORY $plugin_base ON)" >> "${SRC_DIR}/applications/CMakeLists.txt" done fi + + #Get right python executable + pixi shell + echo "VM_PYTHON3_EXECUTABLE=$SOFA_PYTHON_EXECUTABLE" >> $GITHUB_ENV @@ -220,8 +226,8 @@ jobs: if: always() && steps.build-step.outcome == 'success' && inputs.generate-binaries == false shell: bash run: | - # If os has got docker then use it - # Here no need to fetch it because it has already been taken care of in the build step + #Activate pixi shell + pixi shell echo "Launching unit test suite." bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "UNIT" @@ -235,8 +241,8 @@ jobs: if: always() && matrix.os == 'windows-latest' && steps.build-step.outcome == 'success' && inputs.generate-binaries == false && inputs.with-all-tests == true shell: bash run: | - # If os has got docker then use it - # Here no need to fetch it because it has already been taken care of in the build step + #Activate pixi shell + pixi shell echo "Launching scene test suite." bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "SCENE" @@ -250,8 +256,8 @@ jobs: if: always() && matrix.os == 'windows-latest' && steps.build-step.outcome == 'success' && inputs.generate-binaries == false && inputs.with-all-tests == true shell: bash run: | - # If os has got docker then use it - # Here no need to fetch it because it has already been taken care of in the build step + #Activate pixi shell + pixi shell echo "Launching regression test suite" bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "REGRESSION" @@ -291,10 +297,15 @@ jobs: ${{ env.SOFA_BUILD_DIR }}/tests_results/ + - name: Configure python for display + run: | + pip install prettytable + - name: Summarize results if: always() shell: bash run: | + bold="\033[1m" normal="\033[0m" if [[ "${{ steps.configure.outcome }}" == "failure" || "${{ steps.clone.outcome }}" == "failure" ]]; then From 427ff217b82a184ec315bf003717a1c644012fa8 Mon Sep 17 00:00:00 2001 From: bakpaul Date: Fri, 13 Feb 2026 16:30:15 +0100 Subject: [PATCH 15/17] Fix ci --- .../workflows/ci-macos-linux-windows-pixi.yml | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index 6489113b631..8ea52126983 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -178,10 +178,6 @@ jobs: done fi - #Get right python executable - pixi shell - echo "VM_PYTHON3_EXECUTABLE=$SOFA_PYTHON_EXECUTABLE" >> $GITHUB_ENV - - name: Build SOFA [MacOS/Linux/Windows] @@ -220,12 +216,23 @@ jobs: pixi run -e ${{ inputs.preset }} configure $CMAKE_OPTIONS pixi run -e ${{ inputs.preset }} build + - name: Setup env for tests + shell: bash + run: | + cd ${SRC_DIR} + + #Get right python executable + pixi shell + echo "VM_PYTHON3_EXECUTABLE=$SOFA_PYTHON_EXECUTABLE" >> $GITHUB_ENV + - name: Unit tests id: unit-tests-step if: always() && steps.build-step.outcome == 'success' && inputs.generate-binaries == false shell: bash run: | + cd ${SRC_DIR} + #Activate pixi shell pixi shell @@ -241,8 +248,10 @@ jobs: if: always() && matrix.os == 'windows-latest' && steps.build-step.outcome == 'success' && inputs.generate-binaries == false && inputs.with-all-tests == true shell: bash run: | + cd ${SRC_DIR} + #Activate pixi shell - pixi shell + pixi shel echo "Launching scene test suite." bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "SCENE" @@ -256,8 +265,10 @@ jobs: if: always() && matrix.os == 'windows-latest' && steps.build-step.outcome == 'success' && inputs.generate-binaries == false && inputs.with-all-tests == true shell: bash run: | + cd ${SRC_DIR} + #Activate pixi shell - pixi shell + pixi shel echo "Launching regression test suite" bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "REGRESSION" @@ -275,17 +286,6 @@ jobs: path: | ${{ env.SOFA_BUILD_DIR }}/SOFA_v* - - - name: Publish build logs - id: publish-build-logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: build-logs_${{ env.BUILDER_OS }} - path: | - ${{ env.LOG_DIR }}/make-output.txt - ${{ env.LOG_DIR }}/cmake-output.txt - - name: Publish tests logs id: publish-tests-logs From ecae66fd4724e18227df422329be7c67788e1545 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Thu, 5 Mar 2026 18:17:07 +0100 Subject: [PATCH 16/17] Fix typo --- .github/workflows/ci-macos-linux-windows-pixi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index 8ea52126983..f2bdebc4e85 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -251,7 +251,7 @@ jobs: cd ${SRC_DIR} #Activate pixi shell - pixi shel + pixi shell echo "Launching scene test suite." bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "SCENE" @@ -268,7 +268,7 @@ jobs: cd ${SRC_DIR} #Activate pixi shell - pixi shel + pixi shell echo "Launching regression test suite" bash ${CI_DIR}/scripts/test.sh "${SOFA_BUILD_DIR}" "${SRC_DIR}" "${CI_DIR}/scripts/" "" "${{ inputs.python-version }}" "REGRESSION" From 0a566a8a3e917b66e1f8d441be66acea1bb020d0 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Thu, 5 Mar 2026 18:23:00 +0100 Subject: [PATCH 17/17] dummy2 --- .github/workflows/ci-macos-linux-windows-pixi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-macos-linux-windows-pixi.yml b/.github/workflows/ci-macos-linux-windows-pixi.yml index f2bdebc4e85..efea88984f9 100644 --- a/.github/workflows/ci-macos-linux-windows-pixi.yml +++ b/.github/workflows/ci-macos-linux-windows-pixi.yml @@ -110,6 +110,7 @@ jobs: - name: Setup SOFA and clone CI shell: bash -el {0} run: | + export WORKSPACE=$GITHUB_WORKSPACE echo "WORKSPACE=$WORKSPACE" >> $GITHUB_ENV