Took Sonarqube code smell ,regarding pointers instead of auto ,into c… #19892
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Windows CI (VCPKG and pre-compiled) | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - feature/* | |
| - features/* | |
| - fix/* | |
| - issue-* | |
| - release/* | |
| - doc/* | |
| - dependabot/** | |
| - tests/* | |
| schedule: | |
| - cron: '21 2 * * *' | |
| workflow_call: | |
| inputs: | |
| run-tests: | |
| required: true | |
| type: string | |
| target_branch: | |
| required: true | |
| type: string | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} | |
| RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }} | |
| RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }} | |
| REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}} | |
| jobs: | |
| build: | |
| env: | |
| # Indicates the location of the vcpkg as a Git submodule of the project repository. | |
| VCPKG_ROOT: ${{ github.workspace }}/vcpkg | |
| ORTOOLS_DIR: ${{ github.workspace }}/or-tools | |
| os: windows-2022 | |
| triplet: x64-windows-release | |
| # Caching strategy of VCPKG dependencies | |
| VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" | |
| runs-on: windows-2022 | |
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ env.REF }} | |
| - name: Config OR-Tools URL | |
| run: | | |
| echo "ORTOOLS_URL=https://github.com/rte-france/or-tools-rte/releases/download/$(cat ortools_tag)/ortools_cxx_windows-latest_static_sirius_Release.zip" >> $GITHUB_ENV | |
| shell: bash | |
| # Downloads ccache, and copies it to "cl.exe" in order to trick cmake into using it, | |
| # see ccache wiki for background on using it with MSVC: | |
| # https://github.com/ccache/ccache/wiki/MS-Visual-Studio | |
| - name: Install ccache | |
| shell: bash | |
| run: | | |
| ccacheVersion=4.11.3 | |
| ccacheFile=ccache-$ccacheVersion-windows-x86_64 | |
| curl -L -o ccache.zip https://github.com/ccache/ccache/releases/download/v$ccacheVersion/$ccacheFile.zip | |
| unzip ccache.zip | |
| rm ccache.zip | |
| mv $ccacheFile ccache | |
| cp ccache/ccache.exe ccache/cl.exe | |
| echo "${GITHUB_WORKSPACE}/ccache" >> $GITHUB_PATH | |
| - name: Restore ccache cache | |
| id: cache | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ${{ github.workspace }}/.ccache_windows | |
| key: ${{ env.os }}-${{ github.ref_name }} | |
| restore-keys: | | |
| ${{ env.os }}- | |
| - name: Configure ccache | |
| run: | | |
| ccache --set-config=cache_dir=${{ github.workspace }}/.ccache_windows | |
| ccache --set-config=max_size=500M | |
| ccache --set-config=compression=true | |
| ccache -p | |
| ccache -z | |
| - name: Install VCPKG | |
| shell: bash | |
| run: | | |
| git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.bat -disableMetrics | |
| - name: Restore vcpkg binary dir from cache | |
| id: cache-vcpkg-binary | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ${{ github.workspace }}/vcpkg_cache | |
| key: vcpkg-cache-windows-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} | |
| # Allows to restore a cache when deps have only partially changed (like adding a dependency) | |
| restore-keys: vcpkg-cache-windows- | |
| - name: Download pre-compiled librairies | |
| uses: ./.github/workflows/download-extract-precompiled-libraries-zip | |
| with: | |
| ortools-url: ${{env.ORTOOLS_URL}} | |
| ortools-dir: ${{env.ORTOOLS_DIR}} | |
| - name: Setup Python 3.12 | |
| uses: actions/setup-python@v6 | |
| id: setup-python | |
| with: | |
| architecture: 'x64' | |
| python-version: '3.12' | |
| - name: Install pip dependencies if necessary | |
| run: pip install -r src/tests/examples/requirements.txt | |
| - name: Enable git longpaths | |
| run: git config --system core.longpaths true | |
| - name: Configure | |
| shell: bash | |
| run: | | |
| cmake -B _build -S src \ | |
| -DCMAKE_PREFIX_PATH="${{ env.ORTOOLS_DIR }}/install" \ | |
| -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ | |
| -DVCPKG_TARGET_TRIPLET=${{ env.triplet }} \ | |
| -DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DBUILD_TESTING=ON \ | |
| -DBUILD_TOOLS=ON \ | |
| -DPython3_EXECUTABLE="${{ env.Python3_ROOT_DIR }}/python.exe" \ | |
| -DCMAKE_VS_GLOBALS="CLToolExe=cl.exe;CLToolPath=${GITHUB_WORKSPACE}/ccache;TrackFileAccess=false;UseMultiToolTask=true;DebugInformationFormat=OldStyle" | |
| - name: Build | |
| shell: bash | |
| run: | | |
| cmake --build _build --config Release -j$(nproc) | |
| - name: .zip creation | |
| if: ${{ success() }} | |
| shell: bash | |
| run: | | |
| cd _build | |
| FIXED_PATH=${ORTOOLS_DIR//\\//} | |
| VCPKG_BIN=vcpkg_installed/${triplet}/bin | |
| if [ -d "$VCPKG_BIN" ]; then | |
| for dll in "$VCPKG_BIN"/*.dll*; do | |
| if [ -f "$dll" ]; then | |
| cp -n "$dll" "${FIXED_PATH}/install/bin" | |
| fi | |
| done | |
| else | |
| echo "VCPKG bin directory not found: $VCPKG_BIN" | |
| fi | |
| cpack -G ZIP -D CPACK_INSTALLED_DIRECTORIES="${FIXED_PATH}/install/bin;bin" | |
| export ZIP_ARCHIVE_NAME=$(ls -1 *.zip) | |
| echo "ZIP_ARCHIVE_NAME=$ZIP_ARCHIVE_NAME" >> $GITHUB_ENV | |
| - name: Upload .zip | |
| if: ${{ success() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{env.ZIP_ARCHIVE_NAME}} | |
| path: _build/${{env.ZIP_ARCHIVE_NAME}} | |
| - name: Add OR-Tools to PATH | |
| run: echo "D:\a\Antares_Simulator\Antares_Simulator/or-tools/install/bin" | Out-File -Append -Encoding ascii $env:GITHUB_PATH | |
| - name: Read simtest version | |
| shell: bash | |
| run: | | |
| echo 'SIMTEST_JSON<<EOF' >> $GITHUB_ENV | |
| cat ./simtest.json >> $GITHUB_ENV | |
| echo 'EOF' >> $GITHUB_ENV | |
| - name: Export simtest version | |
| shell: bash | |
| run: | | |
| echo "SIMTEST=${{ fromJson(env.SIMTEST_JSON).version }}" >> $GITHUB_ENV | |
| - name: Init submodule Antares_Simulator_Tests_NR | |
| run: | | |
| git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests_NR | |
| - name: Run named mps tests | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && ! cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-named-mps | |
| os: ${{ env.os }} | |
| variant: "named-mps" | |
| - name: Run fast cucumber | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/cucumber-tests | |
| with: | |
| tags: "fast" | |
| - name: Run cucumber on modeler | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/cucumber-tests | |
| with: | |
| feature: "features/modeler-features" | |
| - name: Run unit and end-to-end tests | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && ! cancelled() }} | |
| run: | | |
| cd _build | |
| ctest -C Release --output-on-failure -L "unit|end-to-end" -LE ortools | |
| - name: Upload build on failure | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: MPS-diff | |
| path: ${{ github.workspace }}/src/tests/mps | |
| - name: Run tests for adequacy patch (CSR) | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && ! cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: adequacy-patch-CSR | |
| os: ${{ env.os }} | |
| - name: Run tests about infinity on BCs RHS | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-v830 | |
| os: ${{ env.os }} | |
| - name: Run MILP with CBC | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-milp | |
| variant: "milp-cbc" | |
| os: ${{ env.os }} | |
| - name: Run tests introduced in 8.6.0 | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-v860 | |
| os: ${{ env.os }} | |
| - name: Run tests introduced in 8.7.0 | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-v870 | |
| os: ${{ env.os }} | |
| - name: Run tests introduced in 9.1.0 | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-v910 | |
| os: ${{ env.os }} | |
| - name: Run tests introduced in 9.2.0 | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-v920 | |
| os: ${{ env.os }} | |
| - name: Run tests introduced in 9.3.0 | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-v930 | |
| os: ${{ env.os }} | |
| - name: Run short-tests | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: short-tests | |
| os: ${{ env.os }} | |
| - name: Run cucumber on v9.2 tests | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/cucumber-tests | |
| with: | |
| feature: "features/solver-features/tests_for_v9.2.feature" | |
| - name: Run mps tests | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-mps | |
| os: ${{ env.os }} | |
| - name: Run unfeasibility-related tests | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && ! cancelled() }} | |
| run: | | |
| cd _build | |
| ctest -C Release --output-on-failure -R "^unfeasible$" | |
| - name: Run parallel tests | |
| if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: valid-parallel | |
| os: ${{ env.os }} | |
| variant: "parallel" | |
| - name: Run medium-tests | |
| if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: medium-tests | |
| os: ${{ env.os }} | |
| - name: Run cucumber on medium-tests | |
| if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/cucumber-tests | |
| with: | |
| feature: "features/solver-features/medium_tests.feature" | |
| - name: Run long-tests-1 | |
| if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: long-tests-1 | |
| os: ${{ env.os }} | |
| - name: Run long-tests-2 | |
| if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: long-tests-2 | |
| os: ${{ env.os }} | |
| - name: Run long-tests-3 | |
| if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/run-tests | |
| with: | |
| simtest-tag: ${{ env.SIMTEST }} | |
| batch-name: long-tests-3 | |
| os: ${{ env.os }} | |
| - name: Run cucumber on hybrid studies | |
| if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} | |
| uses: ./.github/workflows/cucumber-tests | |
| with: | |
| feature: "features/solver-features/hybrid_studies.feature" | |
| - name: Barrier | |
| if: ${{ !success() }} | |
| run: exit 1 | |
| - name: Prepare files for solver-only archive | |
| shell: bash | |
| run: | | |
| cd _build | |
| FIXED_PATH=${ORTOOLS_DIR//\\//} | |
| cp ${FIXED_PATH}/install/bin/*.dll* solver/Release | |
| - name: Create solver-only archive | |
| shell: pwsh | |
| run: | | |
| cd _build | |
| Compress-Archive -Path solver/Release/antares-solver.exe, solver/Release/*.dll -DestinationPath antares-solver_windows.zip -Force | |
| - name: NSIS Installer creation | |
| shell: bash | |
| run: | | |
| rm -rf src/tests/resources/Antares_Simulator_Tests | |
| rm -rf src/tests/resources/Antares_Simulator_Tests_NR | |
| cd _build | |
| cpack -GNSIS | |
| export NSIS_NAME=$(ls *.exe) | |
| echo "NSIS_NAME=$NSIS_NAME" >> $GITHUB_ENV | |
| - name: Upload NSIS log on failure | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: NSISError.log | |
| path: _build/_CPack_Packages/win64/NSIS/NSISOutput.log | |
| - name: Installer upload | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: installer | |
| path: _build/${{env.NSIS_NAME}} | |
| - name: Publish assets | |
| if: ${{ env.IS_RELEASE == 'true' }} | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| tag: ${{ github.event.inputs.release_tag }} | |
| run: | | |
| gh release upload "$tag" _build/*.zip _build/*.exe | |
| shell: bash | |
| - name: Update continuous-delivery release | |
| if: github.ref == 'refs/heads/develop' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| mv _build/rte-antares-*-installer-64bits.exe _build/rte-antares-cd-installer-64bits.exe | |
| mv _build/rte-antares-*-installer-64bits.zip _build/rte-antares-cd-installer-64bits.zip | |
| gh release upload --clobber continuous-delivery _build/*.zip _build/*.exe | |
| - name: Cache vcpkg binary dir | |
| if: always() | |
| id: save-cache-vcpkg-binary | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: ${{ github.workspace }}/vcpkg_cache | |
| key: vcpkg-cache-windows-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} | |
| - name: Display ccache statistics | |
| run: ccache -s | |
| # Delete the old cache on hit to emulate a cache update. See | |
| # https://github.com/actions/cache/issues/342. | |
| - name: Delete old cache | |
| continue-on-error: true | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_DEBUG: api gh cache delete | |
| if: ${{ !cancelled() && steps.cache.outputs.cache-hit }} | |
| # Using `--repo` makes it so that this step doesn't require checking out the | |
| # repo first. | |
| run: gh cache delete --repo ${{ github.repository }} ${{ steps.cache.outputs.cache-primary-key }} | |
| - name: Save ccache cache | |
| if: ${{ !cancelled() }} | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: ${{ github.workspace }}/.ccache_windows | |
| key: ${{ steps.cache.outputs.cache-primary-key }} |