diff --git a/.github/workflows/CI_macos_linux_windows_pixi.yml b/.github/workflows/CI_macos_linux_windows_pixi.yml index 7016e0ae9d3..6a48aeb7df7 100644 --- a/.github/workflows/CI_macos_linux_windows_pixi.yml +++ b/.github/workflows/CI_macos_linux_windows_pixi.yml @@ -1,50 +1,491 @@ name: CI - MacOS/Linux/Windows via Pixi on: - push: - branches: - - master - pull_request: - paths: - - 'pixi*' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + 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", }' jobs: - sofa-pixi: - name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} - runs-on: ${{ matrix.os }} - if: ${{ github.repository_owner == 'sofa-framework' }} + 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 "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 }}" + echo "" + echo "The following python version has been passed : ${{ inputs.python-version }}" + echo "--> only the default python version written in the pixi.toml can be used and will be forced here." + sofa-pixi: strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, macos-15-intel, windows-latest] - environment: [supported-plugins] - build_type: [Release] + fail-fast: false + matrix: + os: ${{ fromJson(inputs.builder-os) }} + build_type: [Release] + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} - Env ${{ inputs.preset }} ${{ matrix.build_type }} ${{ matrix.compiler }} 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" + + - name: Setup SOFA and clone CI + id: clone + 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 + + if [ -d "$SRC_DIR" ]; then + rm -rf "$SRC_DIR" + fi + + 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 clone -b ${{ inputs.sofa-branch-name }} --single-branch https://www.github.com/sofa-framework/sofa + cd sofa + 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 clone -b ${{ inputs.sofa-branch-name }} --single-branch https://www.github.com/sofa-framework/sofa + cd sofa + git checkout ${{ inputs.sofa-commit-sha }} + fi + + cd $WORKSPACE + + ## Clone CI and use ci-depends-on structure + echo "\033[33mWARNING, the ci repository is currently forced on bakpaul:26_09_final_jenkins_2_github_migration, delete the lines marked as \"TO DELETE\" and uncomment the ones marked as \"TO UNCOMMENT\" to go back into a normal behavior.\033[0m" + + ### TO DELETE ### + ci_branch=26_09_final_jenkins_2_github_migration + ci_repo_url="https://www.github.com/bakpaul/ci" + ### TO DELETE ### + + ### TO UNCOMMENT ### + #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 + ### TO UNCOMMENT ### + + 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//\"} + + + + ## Clone Regression and use ci-depends-on structure + regression_branch=${{ inputs.sofa-branch-name }} + regression_repo_url="https://www.github.com/sofa-framework/Regression" + + + # check if ci has a ci-depends-on + regression_ci_depends_on=$(echo "${{ inputs.ci-depends-on }}" | jq .Regression) + if [ -n "${{ inputs.ci-depends-on }}" ] && [ "$regression_ci_depends_on" != "null" ]; then + echo "ci-depends-on for Regression repository detected." + regression_repo_url=$(echo "${{ inputs.ci-depends-on }}" | jq .Regression.repo_url) + regression_branch=$(echo "${{ inputs.ci-depends-on }}" | jq .Regression.branch_name) + fi + echo "REGRESSION_BRANCH=$regression_branch" >> $GITHUB_ENV + + + echo "Cloning Regression from remote ${regression_repo_url}, selecting branch ${regression_branch}" + + REGRESSION_DIR=$WORKSPACE/Regression + echo "REGRESSION_DIR=$REGRESSION_DIR" >> $GITHUB_ENV + + git clone -b ${regression_branch//\"} --single-branch ${regression_repo_url//\"} + + + cd $WORKSPACE + + ## Setup build folder + mkdir $WORKSPACE/build + + 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." + 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 + - uses: prefix-dev/setup-pixi@v0.8.10 with: cache: false - environments: ${{ matrix.environment }} + manifest-path: sofa/pixi.toml + environments: ${{ inputs.preset }} - name: Build SOFA [MacOS/Linux/Windows] + id: build-step shell: bash -el {0} env: SOFA_BUILD_TYPE: ${{ matrix.build_type }} run: | - pixi run -e ${{ matrix.environment }} configure -DCMAKE_CUDA_ARCHITECTURES="75;89;120" - pixi run -e ${{ matrix.environment }} build + cd ${SRC_DIR} - - name: Testing - Run SOFA in batch mode [MacOS/Linux/Windows] - shell: bash -el {0} - env: - SOFA_BUILD_TYPE: ${{ matrix.build_type }} + + ## 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 ${{ inputs.preset }} configure $CMAKE_OPTIONS + pixi run -e ${{ inputs.preset }} build + + - name: Setup env for tests + shell: bash + if: always() && runner.os == 'Windows' + run: | + cd ${SRC_DIR} + + echo "Adding runtime related dependencies" + pixi add $(cat ${CI_DIR}/docker/python_extra_dependencies.txt) + pixi install -e ${{ inputs.preset }} + + echo "Refactoring environement variables to jump into powershell" + PIXI_PREFIX="$(pwd -W)/.pixi/envs/${{ inputs.preset }}/" + echo "VM_PYTHON3_EXECUTABLE=$PIXI_PREFIX/python.exe" >> $GITHUB_ENV + echo "PIXI_PREFIX=$PIXI_PREFIX" >> $GITHUB_ENV + + . ${CI_DIR}/scripts/setup-test-env.sh ${SOFA_BUILD_DIR} ${CI_DIR}/scripts default none + + + echo "BUILD_DIR=$(cd "$SOFA_BUILD_DIR" && pwd -W)" >> $GITHUB_ENV + echo "SRC_DIR=$(cd "$SRC_DIR" && pwd -W)" >> $GITHUB_ENV + echo "CI_DIR=$(cd "$CI_DIR" && pwd -W)" >> $GITHUB_ENV + echo "REGRESSION_DIR=$(cd "$REGRESSION_DIR" && pwd -W)" >> $GITHUB_ENV + echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV + echo "SOFA_ROOT=$SOFA_ROOT" >> $GITHUB_ENV + echo "RESULTS_DIR=$RESULTS_DIR" >> $GITHUB_ENV + echo "VM_MAX_PARALLEL_TESTS=$VM_MAX_PARALLEL_TESTS" >> $GITHUB_ENV + + + if [[ "$RUNNER_OS" == "Windows" ]]; then + #Activating pixi env in a git-bash terminal is broken, here we just want to consume it. + + echo "PIXI_PREFIX=$PIXI_PREFIX" >> $GITHUB_ENV + + echo "$PIXI_PREFIX" >> $GITHUB_PATH + echo "$PIXI_PREFIX/bin" >> $GITHUB_PATH + echo "$PIXI_PREFIX/Library/bin" >> $GITHUB_PATH + echo "$PIXI_PREFIX/Scripts" >> $GITHUB_PATH + echo "$PIXI_PREFIX/Library/mingw-w64/bin" >> $GITHUB_PATH + echo "$PIXI_PREFIX/Library/usr/bin" >> $GITHUB_PATH + echo "$PIXI_PREFIX/sofa-build/bin/" >> $GITHUB_PATH + fi + + exit 0 + + - name: Unit tests + id: unit-tests-step + if: always() && runner.os == 'Windows' && steps.build-step.outcome == 'success' && inputs.generate-binaries == false + shell: pwsh + run: | + Set-Location $env:SRC_DIR + + $UnitResultsDir = Join-Path $env:BUILD_DIR "tests_results\unit" + $env:UNIT_RESULTS_DIR = $UnitResultsDir # in case the script or child processes need it + + # Activate the environment in the terminal + pixi shell-hook --shell powershell -e ${{ inputs.preset }} | Out-String | Invoke-Expression + + python "$env:CI_DIR\scripts\tests\sofa_unit_tests.py" ` + --build-dir "$env:BUILD_DIR" ` + --results-dir "$UnitResultsDir" ` + -j $env:VM_MAX_PARALLEL_TESTS + + if (-not (Test-Path "$UnitResultsDir\*summary*")) { exit 1 } + + $crashes = $null + $failures = $null + foreach ($line in Get-Content "$UnitResultsDir\summary.txt") { + $key, $value = $line -split '=', 2 + switch ($key) { + 'crashes' { $crashes = $value } + 'failures' { $failures = $value } + } + } + + if ($crashes -ne '0') { exit 1 } + if ($failures -ne '0') { exit 1 } + + - name: Scene tests + id: scene-tests-step + if: always() && runner.os == 'Windows' && steps.build-step.outcome == 'success' && inputs.generate-binaries == false && inputs.with-all-tests == true + shell: pwsh + run: | + Set-Location $env:SRC_DIR + + $SceneResultsDir = Join-Path $env:BUILD_DIR "tests_results\scene" + $env:SCENE_RESULTS_DIR = $SceneResultsDir # in case the script or child processes need it + + # Activate the environment in the terminal + pixi shell-hook --shell powershell -e ${{ inputs.preset }} | Out-String | Invoke-Expression + + python "$env:CI_DIR\scripts\tests\sofa_scene_tests.py" ` + --src-dir "$env:SRC_DIR" ` + --build-dir "$env:BUILD_DIR" ` + --results-dir "$SceneResultsDir" ` + -j $env:VM_MAX_PARALLEL_TESTS + + if (-not (Test-Path "$SceneResultsDir\*summary*")) { exit 1 } + + $crashes = $null + $failures = $null + foreach ($line in Get-Content "$SceneResultsDir\summary.txt") { + $key, $value = $line -split '=', 2 + switch ($key) { + 'crashes' { $crashes = $value } + 'failures' { $failures = $value } + } + } + + if ($crashes -ne '0') { exit 1 } + if ($failures -ne '0') { exit 1 } + + - name: Regression tests + id: regression-tests-step + if: always() && runner.os == 'Windows' && steps.build-step.outcome == 'success' && inputs.generate-binaries == false && inputs.with-all-tests == true + shell: pwsh run: | - pixi run -e ${{ matrix.environment }} runSofa -g batch + Set-Location $env:SRC_DIR + + $RegResultsDir = Join-Path $env:BUILD_DIR "tests_results\regression" + $env:REG_RESULTS_DIR = $RegResultsDir # in case the script or child processes need it + + # Activate the environment in the terminal + pixi shell-hook --shell powershell -e ${{ inputs.preset }} | Out-String | Invoke-Expression + + python "$env:REGRESSION_DIR\SofaRegressionProgram\SofaRegressionProgram.py" ` + --input "$env:SRC_DIR/examples" ` + --input "$env:SRC_DIR\applications" ` + --input "$env:BUILD_DIR\external_directories\fetched" ` + --output-logs-errors "$RegResultsDir" ` + --legacy-regression ` + --verbose 2 ` + -j $env:VM_MAX_PARALLEL_TESTS + + if (-not (Test-Path "$RegResultsDir\*summary*")) { exit 1 } + + $crashes = $null + $failures = $null + foreach ($line in Get-Content "$RegResultsDir\summary.txt") { + $key, $value = $line -split '=', 2 + switch ($key) { + 'crashes' { $crashes = $value } + 'failures' { $failures = $value } + } + } + + if ($crashes -ne '0') { exit 1 } + if ($failures -ne '0') { exit 1 } + + + - name: Publish artifacts + if: always() && steps.build-step.outcome == 'success' && inputs.generate-binaries == true + uses: actions/upload-artifact@v4 + with: + name: binaries_${{ matrix.os }} + path: | + ${{ env.SOFA_BUILD_DIR }}/SOFA_v* + + + - name: Publish tests logs + id: publish-tests-logs + if: always() && runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + name: tests-logs_${{ matrix.os }} + path: | + ${{ env.SOFA_BUILD_DIR }}/tests_results/ + + + - name: Configure python for display + if: always() && runner.os == 'Windows' + shell: bash + run: | + python3 -m pip install prettytable + + - name: Summarize results + if: always() && runner.os == 'Windows' + shell: bash + run: | + + bold="\033[1m" + normal="\033[0m" + if [[ "${{ steps.clone.outcome }}" == "failure" ]]; then + echo "❌ Something whent wrong during the 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}Please check those actions logs${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 diff --git a/.github/workflows/CI_trigger_build_and_tests.yml b/.github/workflows/CI_trigger_build_and_tests.yml index da2efb038be..ebb9a7c2a03 100644 --- a/.github/workflows/CI_trigger_build_and_tests.yml +++ b/.github/workflows/CI_trigger_build_and_tests.yml @@ -28,10 +28,10 @@ on: preset: type: choice description: Which preset to use for compilation - options: + options: - standard - supported-plugins - - full + - full - standard-dev - supported-plugins-dev - full-dev @@ -39,16 +39,20 @@ on: builder-os: 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"]' - + options: + - '["ubuntu"]' + - '["macos"]' + - '["windows"]' + - '["ubuntu","macos"]' + - '["ubuntu","windows"]' + - '["macos","windows"]' + - '["ubuntu","macos","windows"]' + default: '["ubuntu","macos","windows"]' + # PR-related build (open, labels, push) pull_request: types: [opened, synchronize] - + # CI for dashboard master push: branches: @@ -78,8 +82,9 @@ 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 run: | @@ -96,8 +101,9 @@ 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' }} run: | @@ -122,7 +128,7 @@ jobs: fi fi echo "Python version $PYTHON is valid." - + # Save all information in environment variables echo "SOFA_BRANCH_NAME=${{ github.event.inputs.branch }}" >> $GITHUB_ENV echo "SOFA_COMMIT_SHA=HEAD" >> $GITHUB_ENV @@ -134,6 +140,21 @@ jobs: 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 @@ -148,8 +169,8 @@ jobs: - name: Check out code uses: actions/checkout@v5 with: - repository: sofa-framework/ci - ref: master + repository: bakpaul/ci + ref: 26_09_final_jenkins_2_github_migration path: ./ci - name: Check push on master case (e.g. merge) @@ -159,7 +180,8 @@ 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' }} @@ -170,11 +192,11 @@ jobs: PR_COMMIT_SHA: ${{ github.event.pull_request.head.sha }} run: | echo "This step runs only when a PR is opened or synchronized." - + # Trigger the Build action # Warning ! This script also changes ENV variables python ci/scripts/checkPRInfoBeforeBuild.py - + - name: Export environment variables as outputs id: export-vars run: | @@ -184,7 +206,7 @@ jobs: echo "Branch name should be either master or any release branch (e.g., v25.06)" exit 1 fi - + echo "SOFA_BRANCH_NAME=${SOFA_BRANCH_NAME}" >> $GITHUB_OUTPUT echo "SOFA_COMMIT_SHA=${SOFA_COMMIT_SHA}" >> $GITHUB_OUTPUT echo "PRESET=${PRESET}" >> $GITHUB_OUTPUT @@ -192,13 +214,14 @@ jobs: echo "CI_DEPENDS_ON=${CI_DEPENDS_ON}" >> $GITHUB_OUTPUT echo "WITH_ALL_TESTS=${WITH_ALL_TESTS}" >> $GITHUB_OUTPUT echo "FORCE_FULL_BUILD=${FORCE_FULL_BUILD}" >> $GITHUB_OUTPUT - echo "EXTERNAL_PLUGINS=${EXTERNAL_PLUGINS}" >> $GITHUB_OUTPUT - echo "ADDITIONNAL_CMAKE_FLAGS=${ADDITIONNAL_CMAKE_FLAGS}" >> $GITHUB_OUTPUT + echo "EXTERNAL_PLUGINS=${EXTERNAL_PLUGINS}" >> $GITHUB_OUTPUT + echo "ADDITIONNAL_CMAKE_FLAGS=${ADDITIONNAL_CMAKE_FLAGS}" >> $GITHUB_OUTPUT echo "GENERATE_BINARIES=${GENERATE_BINARIES}" >> $GITHUB_OUTPUT 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,7 +230,7 @@ jobs: # Trigger the build and sharing all parameters from filter_build > outputs build-on: needs: filter_build - if: ${{ github.repository_owner == 'sofa-framework' }} + if: ${{ github.repository_owner == 'sofa-framework' && needs.filter_build.outputs.SH_BUILDER_OS != '[]' }} uses: sofa-framework/sofa/.github/workflows/CI_build_and_test.yml@master with: sofa-branch-name: ${{ needs.filter_build.outputs.SOFA_BRANCH_NAME }} @@ -223,4 +246,25 @@ 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 == 'sofa-framework' && needs.filter_build.outputs.PIXI_BUILDER_OS != '[]' }} + uses: bakpaul/sofa/.github/workflows/CI_macos_linux_windows_pixi.yml@26_09_update_ci_with_new_test_scripts_and_pixi_based_ci_for_windows + 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 }} diff --git a/applications/plugins/SofaCUDA/examples/.scene-tests b/applications/plugins/SofaCUDA/examples/.scene-tests index f40de927183..cb5fb7f685f 100644 --- a/applications/plugins/SofaCUDA/examples/.scene-tests +++ b/applications/plugins/SofaCUDA/examples/.scene-tests @@ -35,18 +35,18 @@ ignore "TetrahedronFEM_with_SpringForceField.scn" ignore "CudaCorotationalFEMForceField.scn" ignore "CudaLinearSmallStrainFEMForceField.scn" -ignore "CudaCorotationalFEMForceField_hexa.scn" -ignore "CudaCorotationalFEMForceField_quad.scn" -ignore "CudaCorotationalFEMForceField_tetra.scn" -ignore "CudaCorotationalFEMForceField_triangle.scn" -ignore "CudaCorotationalFEMForceField_prism.scn" -ignore "CudaCorotationalFEMForceField_pyramid.scn" -ignore "CudaLinearSmallStrainFEMForceField_hexa.scn" -ignore "CudaLinearSmallStrainFEMForceField_quad.scn" -ignore "CudaLinearSmallStrainFEMForceField_tetra.scn" -ignore "CudaLinearSmallStrainFEMForceField_triangle.scn" -ignore "CudaLinearSmallStrainFEMForceField_prism.scn" -ignore "CudaLinearSmallStrainFEMForceField_pyramid.scn" -ignore "CorotationalFEMForceField_tetra_cpu_gpu.scn" -ignore "Tetrahedron_corotational.py" -ignore "Hexahedron_corotational.py" +ignore "ElementFEMForcefield/CudaCorotationalFEMForceField_hexa.scn" +ignore "ElementFEMForcefield/CudaCorotationalFEMForceField_quad.scn" +ignore "ElementFEMForcefield/CudaCorotationalFEMForceField_tetra.scn" +ignore "ElementFEMForcefield/CudaCorotationalFEMForceField_triangle.scn" +ignore "ElementFEMForcefield/CudaCorotationalFEMForceField_prism.scn" +ignore "ElementFEMForcefield/CudaCorotationalFEMForceField_pyramid.scn" +ignore "ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_hexa.scn" +ignore "ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_quad.scn" +ignore "ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_tetra.scn" +ignore "ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_triangle.scn" +ignore "ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_prism.scn" +ignore "ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_pyramid.scn" +ignore "ElementFEMForcefield/cpu-gpu_validation/CorotationalFEMForceField_tetra_cpu_gpu.scn" +ignore "ElementFEMForcefield/benchmarks/Tetrahedron_corotational.py" +ignore "ElementFEMForcefield/benchmarks/Hexahedron_corotational.py" diff --git a/development/scripts/pixi/activation.bat b/development/scripts/pixi/activation.bat index 581e19f9dbb..1b0c3ae7748 100644 --- a/development/scripts/pixi/activation.bat +++ b/development/scripts/pixi/activation.bat @@ -7,7 +7,7 @@ set CMAKE_EXPORT_COMPILE_COMMANDS=1 set CMAKE_COLOR_DIAGNOSTICS=1 :: Each environment have its dedicated build dir -set SOFA_BUILD_DIR=%CONDA_PREFIX%\sofa-build +if not defined SOFA_BUILD_DIR (set SOFA_BUILD_DIR=%CONDA_PREFIX%\sofa-build) :: Set default build value only if not previously set if not defined SOFA_CMAKE_PREFIX_PATH (set SOFA_CMAKE_PREFIX_PATH=%CONDA_PREFIX%) diff --git a/development/scripts/pixi/activation.sh b/development/scripts/pixi/activation.sh index 7006e4ea364..059d3b3580e 100644 --- a/development/scripts/pixi/activation.sh +++ b/development/scripts/pixi/activation.sh @@ -10,7 +10,13 @@ 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/examples/.scene-tests b/examples/.scene-tests index 7578544b692..ce795d51776 100644 --- a/examples/.scene-tests +++ b/examples/.scene-tests @@ -50,3 +50,6 @@ ignore "Benchmark/Performance/Bar16-fem-implicit-CudaVec3f.py" ignore "Benchmark/Performance/Bar16-spring-rk4-CudaVec3d.py" ignore "Benchmark/Performance/Bar16-spring-rk4-CudaVec3f.py" + +# Crash on windows +ignore "Component/Constraint/Lagrangian/PrecomputedConstraintCorrection.scn"