From 7884a4c98722855245ff63ae6e6c096ea915f3a7 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Tue, 25 Jun 2024 16:29:44 +0200 Subject: [PATCH 01/15] Remove storagecycle --- src/libs/antares/study/parts/short-term-storage/properties.cpp | 3 --- src/libs/antares/study/parts/short-term-storage/properties.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/src/libs/antares/study/parts/short-term-storage/properties.cpp b/src/libs/antares/study/parts/short-term-storage/properties.cpp index d09b99c65a..d9d9963674 100644 --- a/src/libs/antares/study/parts/short-term-storage/properties.cpp +++ b/src/libs/antares/study/parts/short-term-storage/properties.cpp @@ -98,9 +98,6 @@ bool Properties::loadKey(const IniFile::Property* p) if (p->key == "name") return p->value.to(this->name); - if (p->key == "storagecycle") - return p->value.to(this->cycleDuration); - if (p->key == "initiallevel") return valueForOptional(this->initialLevel); diff --git a/src/libs/antares/study/parts/short-term-storage/properties.h b/src/libs/antares/study/parts/short-term-storage/properties.h index 933904a4e7..4d566d0d53 100644 --- a/src/libs/antares/study/parts/short-term-storage/properties.h +++ b/src/libs/antares/study/parts/short-term-storage/properties.h @@ -68,8 +68,6 @@ class Properties bool initialLevelOptim = false; // Efficiency factor between 0 and 1 double efficiencyFactor = 1; - // Cycle duration, 1 <= cycleDuration <= 168 - unsigned int cycleDuration; // Used to sort outputs Group group = Group::Other1; // cluster name From e84fa836d1b213ac0d1a72e416522d3868c94fc3 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Tue, 25 Jun 2024 16:36:22 +0200 Subject: [PATCH 02/15] Remove storagecycle from save --- src/libs/antares/study/parts/short-term-storage/properties.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/antares/study/parts/short-term-storage/properties.cpp b/src/libs/antares/study/parts/short-term-storage/properties.cpp index d9d9963674..0b997a2e77 100644 --- a/src/libs/antares/study/parts/short-term-storage/properties.cpp +++ b/src/libs/antares/study/parts/short-term-storage/properties.cpp @@ -146,7 +146,6 @@ bool Properties::saveToFolder(const std::string& folder) const s->add("withdrawalnominalcapacity", this->withdrawalNominalCapacity); s->add("efficiency", this->efficiencyFactor); - s->add("storagecycle", this->cycleDuration); s->add("initialleveloptim", this->initialLevelOptim); From c2339dbe6cd3ab9550ec1177e56809bcda90ff23 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Tue, 25 Jun 2024 16:36:59 +0200 Subject: [PATCH 03/15] revision number --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4477e83a10..17cb3478a9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable # Version set(ANTARES_VERSION_HI 8) set(ANTARES_VERSION_LO 6) -set(ANTARES_VERSION_REVISION 7) +set(ANTARES_VERSION_REVISION 8) set(ANTARES_VERSION_YEAR 2024) project(antares From 3bb5d2c77dd2a6581312729916d2594a6bb243f4 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Wed, 26 Jun 2024 14:29:26 +0200 Subject: [PATCH 04/15] remove cache --- .github/workflows/windows-vcpkg.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index e130ad9c69..6c022c26f7 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -48,23 +48,6 @@ jobs: run: | git submodule update --init vcpkg - # Restore both vcpkg and its artifacts from the GitHub cache service. - - name: Restore vcpkg and its artifacts. - uses: actions/cache@v3 - with: - # The first path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. - path: | - ${{ env.VCPKG_ROOT }} - !${{ env.VCPKG_ROOT }}/buildtrees - !${{ env.VCPKG_ROOT }}/packages - !${{ env.VCPKG_ROOT }}/downloads - # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. - # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. - # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). - key: | - ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }} - - name : Install deps with VCPKG run: | cd vcpkg From b26d9644418cc9b73d292242341066cf97d23587 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Thu, 27 Jun 2024 10:45:47 +0200 Subject: [PATCH 05/15] use cache --- .github/workflows/windows-vcpkg.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 6c022c26f7..e130ad9c69 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -48,6 +48,23 @@ jobs: run: | git submodule update --init vcpkg + # Restore both vcpkg and its artifacts from the GitHub cache service. + - name: Restore vcpkg and its artifacts. + uses: actions/cache@v3 + with: + # The first path is the location of vcpkg (it contains the vcpkg executable and data files). + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }} + - name : Install deps with VCPKG run: | cd vcpkg From 42751ae554cf39becd739427a10b96fc2851abe7 Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:56:00 +0200 Subject: [PATCH 06/15] Use windows-vcpkg.yml@develop --- .github/workflows/windows-vcpkg.yml | 503 +++++++++++++++++----------- 1 file changed, 315 insertions(+), 188 deletions(-) diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index e130ad9c69..4eb484b8d0 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -10,204 +10,331 @@ on: - issue-* - release/* - doc/* + - dependabot/* + 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: - windows: - - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest] - buildtype: [release] - include: - - os: windows-latest - triplet: x64-windows - vcpkgPackages: wxwidgets boost-test - test-platform: windows-2022 + 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 - ORTOOLS_URL: "https://github.com/rte-france/or-tools/releases/download/v9.5-rte2.0/ortools_cxx_windows-latest_static_sirius.zip" - RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule'}} + os: windows-latest + test-platform: windows-2022 + vcpkgPackages: wxwidgets boost-test + triplet: x64-windows-release + # Caching strategy of VCPKG dependencies + VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" + + runs-on: windows-latest steps: - - uses: actions/checkout@v3 - - name: Config OR-Tools URL - run: | + - uses: actions/checkout@v4 + with: + ref: ${{ env.REF }} + + - name: Config OR-Tools URL + run: | echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_windows-latest_static_sirius.zip" >> $GITHUB_ENV - shell: bash + shell: bash - - name: Pre-requisites - shell: cmd - run: | + - name: Pre-requisites + shell: cmd + run: | choco install wget unzip zip --no-progress - - name : Init VCPKG submodule - run: | - git submodule update --init vcpkg - - # Restore both vcpkg and its artifacts from the GitHub cache service. - - name: Restore vcpkg and its artifacts. - uses: actions/cache@v3 - with: - # The first path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. - path: | - ${{ env.VCPKG_ROOT }} - !${{ env.VCPKG_ROOT }}/buildtrees - !${{ env.VCPKG_ROOT }}/packages - !${{ env.VCPKG_ROOT }}/downloads - # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. - # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. - # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). - key: | - ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }} - - - name : Install deps with VCPKG - run: | - cd vcpkg - ./bootstrap-vcpkg.sh - vcpkg install ${{matrix.vcpkgPackages}} --triplet ${{matrix.triplet}} - rm -rf buildtrees packages downloads - shell: bash - - - name: Read antares-deps version - id: antares-deps-version - uses: notiz-dev/github-action-json-property@release - with: - path: 'antares-deps-version.json' - prop_path: 'antares_deps_version' - - - name: Download pre-compiled librairies - uses: ./.github/workflows/download-extract-precompiled-libraries-zip - with: - antares-deps-version: ${{steps.antares-deps-version.outputs.prop}} - os: ${{matrix.os}} - ortools-url: ${{env.ORTOOLS_URL}} - ortools-dir: ${{env.ORTOOLS_DIR}} - - - name: Setup Python 3.12 - uses: actions/setup-python@v4 - with: - architecture: 'x64' - python-version: '3.12' - - - name: Install pip dependencies if necessary - run: pip install -r src/tests/examples/requirements.txt - - - name: Init submodule - run: | - git submodule update --init --recursive src - - - name: Enable git longpaths - run: git config --system core.longpaths true - - - name: Configure - shell: bash - run: | - cmake -B _build -S src \ - -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ - -DCMAKE_PREFIX_PATH="${{ env.ORTOOLS_DIR }}/install" \ - -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ - -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=ON \ - -DBUILD_not_system=OFF - - - name: Build - shell: bash - run: | - cmake --build _build --config Release -j2 - - - name: Run unfeasibility-related tests - run: | - cd _build - ctest -C Release --output-on-failure -R unfeasible - - - name: Run unit and end-to-end tests - run: | - cd _build - ctest -C ${{ matrix.buildtype }} --output-on-failure -L "unit|end-to-end" -LE ortools - - - name: Upload build on failure - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: MPS-diff - path: ${{ github.workspace }}/src/tests/mps - - # simtest - - name: Read simtest version - id: simtest-version - uses: notiz-dev/github-action-json-property@release - with: - path: 'simtest.json' - prop_path: 'version' - - - name: Run tests for adequacy patch (CSR) - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: adequacy-patch-CSR - os: ${{ matrix.test-platform }} - - - name: Run tests about infinity on BCs RHS - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-v830 - os: ${{ matrix.test-platform }} - - - name: Run short-tests - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: short-tests - os: ${{ matrix.test-platform }} - - - name: Run mps tests - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-mps - os: ${{ matrix.test-platform }} - - - name: Solver archive creation - shell: bash - run: | - cd _build - zip -r antares-solver_windows.zip solver/Release/antares-*-solver.exe solver/Release/*.dll - - - name: NSIS Installer creation - shell: bash - run: | - rm -rf src/tests/resources/Antares_Simulator_Tests - rm -rf src/tests/resources/NonRegTests - 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@v3 - with: - name: NSISError.log - path: _build/_CPack_Packages/win64/NSIS/NSISOutput.log - - - name: .zip creation - run: | - cd _build - cpack -G ZIP - - - name: Installer upload - uses: actions/upload-artifact@v3 - with: - path: _build/${{env.NSIS_NAME}} - - - name: Archive upload - uses: actions/upload-artifact@v3 - with: - path: _build/*.zip + # 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: | + wget https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3-windows-x86_64.zip -O ccache.zip + unzip ccache.zip + rm ccache.zip + mv ccache-4.8.3-windows-x86_64 ccache + cp ccache/ccache.exe ccache/cl.exe + echo "${GITHUB_WORKSPACE}/ccache" >> $GITHUB_PATH + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: windows + + - 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@v4 + 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: Read antares-deps version + id: antares-deps-version + uses: notiz-dev/github-action-json-property@release + with: + path: 'antares-deps-version.json' + prop_path: 'antares_deps_version' + + - name: Download pre-compiled librairies + uses: ./.github/workflows/download-extract-precompiled-libraries-zip + with: + antares-deps-version: ${{steps.antares-deps-version.outputs.prop}} + os: ${{env.os}} + ortools-url: ${{env.ORTOOLS_URL}} + ortools-dir: ${{env.ORTOOLS_DIR}} + + - name: Setup Python 3.12 + uses: actions/setup-python@v5 + 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: Init submodule + run: | + git submodule update --init src/antares-deps + git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests + + - name: Enable git longpaths + run: git config --system core.longpaths true + + - name: Configure + shell: bash + run: | + cmake -B _build -S src \ + -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ + -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 \ + -DBUILD_not_system=OFF \ + -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) + # simtest + - name: Read simtest version + id: simtest-version + uses: notiz-dev/github-action-json-property@release + with: + path: 'simtest.json' + prop_path: 'version' + + - name: Run named mps tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-named-mps + os: ${{ env.test-platform }} + variant: "named-mps" + + - name: Run unfeasibility-related tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + run: | + cd _build + ctest -C Release --output-on-failure -R "^unfeasible$" + + - name: Run unit and end-to-end tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + 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@v4 + with: + name: MPS-diff + path: ${{ github.workspace }}/src/tests/mps + + - name: Run tests for adequacy patch (CSR) + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: adequacy-patch-CSR + os: ${{ env.test-platform }} + + - name: Run tests about infinity on BCs RHS + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-v830 + os: ${{ env.test-platform }} + + - name: Run MILP with CBC + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-milp + variant: "milp-cbc" + os: ${{ env.test-platform }} + + - name: Run tests introduced in v860 + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-v860 + os: ${{ env.test-platform }} + + - name: Run tests introduced in v870 + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-v870 + os: ${{ env.test-platform }} + + - name: Run tests introduced in v910 + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-v910 + os: ${{ env.test-platform }} + + - name: Run short-tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: short-tests + os: ${{ env.test-platform }} + + - name: Run mps tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-mps + os: ${{ env.test-platform }} + + - name: Run parallel tests + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-parallel + os: ${{ env.test-platform }} + variant: "parallel" + + - name: Run medium-tests + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: medium-tests + os: ${{ env.test-platform }} + + - name: Run long-tests-1 + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: long-tests-1 + os: ${{ env.test-platform }} + + - name: Run long-tests-2 + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: long-tests-2 + os: ${{ env.test-platform }} + + - name: Run long-tests-3 + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: long-tests-3 + os: ${{ env.test-platform }} + + - name: Solver archive creation + shell: bash + run: | + cd _build + zip -r antares-solver_windows.zip solver/Release/antares-solver.exe solver/Release/*.dll + + - name: NSIS Installer creation + shell: bash + run: | + rm -rf src/tests/resources/Antares_Simulator_Tests + 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@v4 + with: + name: NSISError.log + path: _build/_CPack_Packages/win64/NSIS/NSISOutput.log + + - name: .zip creation + run: | + cd _build + cpack -G ZIP + + - name: Installer upload + uses: actions/upload-artifact@v4 + 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: Cache vcpkg binary dir + if: always() + id: save-cache-vcpkg-binary + uses: actions/cache/save@v4 + with: + path: ${{ github.workspace }}/vcpkg_cache + key: vcpkg-cache-windows-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} From ac948b8f73dde19106427257b240100292cb0235 Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:56:11 +0200 Subject: [PATCH 07/15] Remove 8.6+ tests --- .github/workflows/windows-vcpkg.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 4eb484b8d0..bb0762b9cd 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -216,22 +216,6 @@ jobs: batch-name: valid-v860 os: ${{ env.test-platform }} - - name: Run tests introduced in v870 - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-v870 - os: ${{ env.test-platform }} - - - name: Run tests introduced in v910 - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-v910 - os: ${{ env.test-platform }} - - name: Run short-tests if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} uses: ./.github/workflows/run-tests From c54cdf7cc5ce3b877a2f6bb7cc5434c34eb9c5be Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:42:55 +0200 Subject: [PATCH 08/15] Checkout develop more --- src/CMakeLists.txt | 82 ++++++++++++++++++++++++++-------------------- src/vcpkg.json | 32 ++++++++++++++++++ 2 files changed, 79 insertions(+), 35 deletions(-) create mode 100644 src/vcpkg.json diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 17cb3478a9..2e06542ce0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,6 +4,11 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable set(ANTARES_VERSION_HI 8) set(ANTARES_VERSION_LO 6) set(ANTARES_VERSION_REVISION 8) + +# Beta release +set(ANTARES_BETA 0) +set(ANTARES_RC 0) + set(ANTARES_VERSION_YEAR 2024) project(antares @@ -13,9 +18,6 @@ set(ANTARES_PUBLISHER "RTE France") set(ANTARES_WEBSITE "https://antares-simulator.org/") set(ANTARES_ONLINE_DOC "https://antares-simulator.readthedocs.io/") -# Beta release -set(ANTARES_BETA 0) -set(ANTARES_RC 0) # OR-Tools tag file(READ "../ortools_tag" ORTOOLS_TAG) @@ -33,7 +35,7 @@ include(CheckCXXCompilerFlag) include(CMakeDependentOption) include(FetchContent) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) if (DEFINED VCPKG_ROOT) include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) @@ -174,11 +176,25 @@ endif () option(BUILD_UI "Build antares ui simulator" ON) message(STATUS "Build antares ui simulator: ${BUILD_UI}") +option(BUILD_TOOLS "Build antares tools" OFF) +message(STATUS "Build antares tools: ${BUILD_TOOLS}") + option(BUILD_ORTOOLS "Build OR-Tools" OFF) -message(STATUS "Build OR-Tools ${BUILD_ORTOOLS}") +message(STATUS "Build OR-Tools: ${BUILD_ORTOOLS}") option(BUILD_MINIZIP "Build minizip" OFF) -message(STATUS "Build minizip ${BUILD_MINIZIP}") +message(STATUS "Build minizip: ${BUILD_MINIZIP}") + +option(WITH_ANTLR4 "With antlr4" OFF) +message(STATUS "With antlr4: ${WITH_ANTLR4}") + +option(WITH_YAMLCPP "With yaml-cpp" OFF) +message(STATUS "With yaml-cpp: ${WITH_YAMLCPP}") + +option(BUILD_MERSENNE_TWISTER_PYBIND11 "Build pybind11 bindings for Mersenne-Twister" OFF) +if (${BUILD_MERSENNE_TWISTER_PYBIND11}) + find_package(pybind11 REQUIRED) +endif() #Define install directory if (NOT DEPS_INSTALL_DIR) @@ -219,6 +235,9 @@ add_subdirectory(antares-deps) #Add needed definition in case of external dependencies compilation include (antares-deps/cmake/additionnal-definitions.cmake) +#Boost header libraries +find_package(Boost REQUIRED) + #TODO : Add ZLIB if VCPKG used why is this needed if (VCPKG_TOOLCHAIN) #zlib @@ -241,11 +260,7 @@ if (NOT sirius_solver_FOUND) message (FATAL_ERROR "Sirius solver not found. Sirius solver can be compiled with -DBUILD_sirius=ON or you can specify previous dependency install directory with -DCMAKE_PREFIX_PATH or -DDEPS_INSTALL_DIR") endif() -#gflags needed for ortools -set(GFLAGS_USE_TARGET_NAMESPACE TRUE) -find_package(gflags) - -find_package(ortools QUIET) +find_package(ortools) if(NOT ortools_FOUND OR BUILD_ORTOOLS) message(STATUS "OR-Tools tag ${ORTOOLS_TAG}") FetchContent_Declare(ortools @@ -271,27 +286,18 @@ message(STATUS "OR-Tools tag ${ORTOOLS_TAG}") FetchContent_MakeAvailable(ortools) endif() -find_package(minizip) - -if(NOT minizip_FOUND OR BUILD_MINIZIP) - # Repository + tag - set(MZ_REPOSITORY "https://github.com/zlib-ng/minizip-ng.git") - set(MZ_TAG "3.0.7") - # CMake flags - set(MZ_LZMA "OFF" CACHE INTERNAL "") - set(MZ_ZSTD "OFF" CACHE INTERNAL "") - set(MZ_BZIP2 "OFF" CACHE INTERNAL "") - set(MZ_PKCRYPT "OFF" CACHE INTERNAL "") - set(MZ_WZAES "OFF" CACHE INTERNAL "") - set(MZ_OPENSSL "OFF" CACHE INTERNAL "") - set(MZ_ICONV "OFF" CACHE INTERNAL "") - - FetchContent_Declare(minizip - GIT_REPOSITORY ${MZ_REPOSITORY} - GIT_TAG ${MZ_TAG}) - - FetchContent_MakeAvailable(minizip) -endif() +find_package(minizip-ng) +if (minizip-ng_FOUND) + add_library(MINIZIP::minizip ALIAS MINIZIP::minizip-ng) +else () + find_package(minizip) + if (minizip_FOUND) + message (STATUS "Found minizip (not minizip-ng).") + else () + message (FATAL_ERROR "Minizip not found.") + endif () +endif () + #wxWidget not needed for all library find is done in ui CMakeLists.txt if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) @@ -302,9 +308,11 @@ endif() # TODO : review Standard Settings include(cmake/common-settings.cmake) +add_subdirectory(config) + # Configure config.h with current ANTARES version -configure_file("config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h") -configure_file("config.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/config.h") +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config/config.h.in" + "${CMAKE_CURRENT_SOURCE_DIR}/config/include/antares/config/config.h") # Yuni Framework configure_file("cmake/ProfileBuild.template.cmake" "ext/yuni/src/ProfileBuild.cmake") @@ -323,7 +331,9 @@ add_subdirectory(solver) #antares solver and all associated libs add_subdirectory(analyzer) #antares analyser # Tools +if (BUILD_TOOLS) add_subdirectory(tools) #All antares tools +endif() # Tests # Not setting BUILD_TESTING as a command line argument is equivalent to use -DBUILD_TESTING=OFF @@ -425,7 +435,7 @@ else() set(CPACK_PACKAGE_VERSION_MINOR ${ANTARES_VERSION_LO}) set(CPACK_PACKAGE_VERSION_PATCH ${ANTARES_VERSION_REVISION}${ANTARES_VERSION_TAG}) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-gtk3-0v5") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-gtk3-0v5 | libwxgtk3.2-dev") set(CPACK_RPM_PACKAGE_REQUIRES "wxGTK3") set(CPACK_RPM_PACKAGE_AUTOREQPROV "0") @@ -437,3 +447,5 @@ endif() # Load packaging facilities. include(CPack) +#Last. We need all target defined +add_subdirectory(packaging) diff --git a/src/vcpkg.json b/src/vcpkg.json new file mode 100644 index 0000000000..84556390b3 --- /dev/null +++ b/src/vcpkg.json @@ -0,0 +1,32 @@ +{ + "name": "antares-simulator", + "version-string": "8.6.8", + "builtin-baseline": "9484a57dd560b89f0a583be08af6753611c57fd5", + "vcpkg-configuration": { + "overlay-triplets": [ + "./triplets" + ] + }, + "dependencies": [ + { + "name": "wxwidgets", + "platform": "windows" + }, + { + "name": "boost-test", + "version>=": "1.81.0" + }, + { + "name": "boost-algorithm", + "version>=": "1.81.0" + }, + { + "name": "minizip-ng", + "default-features": false, + "version>=": "4.0.0", + "features": [ + "zlib" + ] + } + ] +} From baf2492cbb4e00a607742634e1b9842a5c32157d Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:55:02 +0200 Subject: [PATCH 09/15] Remove packaging --- src/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2e06542ce0..913f919e0d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -446,6 +446,3 @@ endif() # Load packaging facilities. include(CPack) - -#Last. We need all target defined -add_subdirectory(packaging) From 2ecac2e9a5b4d772acbfdf3dccb337d51b9e9175 Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:12:37 +0200 Subject: [PATCH 10/15] Revert config --- src/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 913f919e0d..966bb95c6e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -308,11 +308,9 @@ endif() # TODO : review Standard Settings include(cmake/common-settings.cmake) -add_subdirectory(config) - # Configure config.h with current ANTARES version -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config/config.h.in" - "${CMAKE_CURRENT_SOURCE_DIR}/config/include/antares/config/config.h") +configure_file("config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h") +configure_file("config.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/config.h") # Yuni Framework configure_file("cmake/ProfileBuild.template.cmake" "ext/yuni/src/ProfileBuild.cmake") From 7fd79b2fb6a486363db18c9ddeb75eecbb65723a Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:14:35 +0200 Subject: [PATCH 11/15] Remove recent tests --- .../workflows/centos7-system-deps-build.yml | 84 --- .github/workflows/centos7.yml | 125 +++-- .github/workflows/oracle8.yml | 119 +++-- .github/workflows/ubuntu.yml | 493 ++++++++++-------- 4 files changed, 454 insertions(+), 367 deletions(-) delete mode 100644 .github/workflows/centos7-system-deps-build.yml diff --git a/.github/workflows/centos7-system-deps-build.yml b/.github/workflows/centos7-system-deps-build.yml deleted file mode 100644 index bd00b30703..0000000000 --- a/.github/workflows/centos7-system-deps-build.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Centos7 CI (deps. compilation) - -on: - push: - branches: - - release/* - - develop - -jobs: - - build: - - runs-on: ubuntu-latest - container: 'centos:7' - - steps: - - - name: Set up Python - run: | - yum update -y - yum install -y python3 python3-pip - - - name: Install libraries - run: | - yum install -y epel-release - yum install -y git redhat-lsb-core gcc gcc-c++ make wget centos-release-scl scl-utils rpm-build - yum install -y devtoolset-9 - yum install -y rh-git227-git - yum install -y unzip libuuid-devel wxGTK3-devel boost-test boost-devel - - - name: Install cmake - run: | - wget https://github.com/Kitware/CMake/releases/download/v3.25.3/cmake-3.25.3-linux-x86_64.tar.gz - tar xvf cmake-3.25.3-linux-x86_64.tar.gz -C / - echo "/cmake-3.25.3-linux-x86_64/bin" >> $GITHUB_PATH - rm cmake-3.25.3-linux-x86_64.tar.gz - - - name: Checkout - run: | - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b $GITHUB_REF_NAME . - - - name: Init submodule - run: | - git submodule update --init --recursive src . - - - name: Install dependencies - run: | - pip3 install -r src/tests/examples/requirements.txt - - - name: Configure - run: | - source /opt/rh/devtoolset-9/enable - #git 2.x must be enabled for Coin compilation with CMake ExternalProject_Add - source /opt/rh/rh-git227/enable - cmake -B _build -S src -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON - - - name: Build - run: | - source /opt/rh/devtoolset-9/enable - source /opt/rh/rh-git227/enable - cmake --build _build --config release -j2 - - - name: Installer .rpm creation - run: | - cd _build - cpack -G RPM - - - name: Installer .tar.gz creation - run: | - cd _build - cpack -G TGZ - - - name: Installer archive upload - uses: actions/upload-artifact@v3 - with: - name: antares-centos7-archive - path: _build/*.tar.gz - - - name: Installer rpm upload - uses: actions/upload-artifact@v3 - with: - name: antares-centos7-rpm - path: _build/*.rpm - diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index 7a29b6c5b3..3308dab812 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -6,17 +6,23 @@ on: push: branches: - develop - - feature/* - - features/* - - fix/* - - issue-* - - release/* - - doc/* + - dependabot/* + 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 == 'release' && github.event.action == 'created' }} + IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} IS_PUSH: ${{ github.event_name == 'push' }} + REF: ${{ inputs.target_branch =='' && github.ref_name || inputs.target_branch}} jobs: @@ -32,19 +38,39 @@ jobs: - name: Checkout run: | - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b $GITHUB_REF_NAME . + git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b ${{ env.REF }} . - - name: Init submodule + - name: Install gcc 10 run: | - git submodule update --init --recursive src/antares-deps src/tests/resources/Antares_Simulator_Tests + yum install -y centos-release-scl + yum install -y devtoolset-10-gcc* + + - name: Install cmake 3.28 + run: pip3 install cmake==3.28.4 - - name: Download & extract precompiled deps at root + - name: Install VCPKG + # Note: we need to use environment variables instead of workflow variables + # because github messes up path variables when running in container, + # see https://github.com/actions/runner/issues/2058 run: | - ANTARES_DEPS_VERSION=$(cut -d'"' -f4 antares-deps-version.json | grep -Ev '\{|\}') - cd / - wget https://github.com/AntaresSimulatorTeam/antares-deps/releases/download/v${ANTARES_DEPS_VERSION}/rte-antares-deps-centos7-Release.tar.gz - tar -xvf rte-antares-deps-centos7-Release.tar.gz - rm -rf rte-antares-deps-centos7-Release.tar.gz + git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics + echo "VCPKG_ROOT=$GITHUB_WORKSPACE/vcpkg" >> $GITHUB_ENV + echo "VCPKG_CACHE_DIR=$GITHUB_WORKSPACE/vcpkg_cache" >> $GITHUB_ENV + echo "VCPKG_BINARY_SOURCES=clear;files,$GITHUB_WORKSPACE/vcpkg_cache,readwrite" >> $GITHUB_ENV + + - name: Restore vcpkg binary dir from cache + id: cache-vcpkg-binary + # Note: we are stuck with v3, because v4 is not compatible with oracle8 image + uses: actions/cache/restore@v3 + with: + path: ${{ env.VCPKG_CACHE_DIR }} + key: vcpkg-cache-centos7-${{ 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-centos7- + + - name: Init submodule + run: | + git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests - name: Config OR-Tools URL run: | @@ -58,44 +84,56 @@ jobs: unzip -q ortools.zip rm ortools.zip + - name: Install gh if needed + if: ${{ env.IS_RELEASE == 'true' }} + run: | + yum -y install dnf + dnf -y install 'dnf-command(config-manager)' + dnf -y config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo + dnf -y install gh + - name: Configure run: | - source /opt/rh/devtoolset-9/enable - cmake3 -B _build -S src \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DDEPS_INSTALL_DIR=/rte-antares-deps-Release \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=ON \ - -DBUILD_not_system=OFF \ - -DCMAKE_PREFIX_PATH=${{ env.ORTOOLSDIR }}/install \ + source /opt/rh/devtoolset-10/enable + source /opt/rh/rh-git227/enable + cmake -B _build -S src \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DVCPKG_TARGET_TRIPLET=x64-linux-release \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=ON \ + -DBUILD_TOOLS=ON \ + -DBUILD_UI=OFF \ + -DCMAKE_PREFIX_PATH=${{ env.ORTOOLSDIR }}/install \ + - name: Build run: | - source /opt/rh/devtoolset-9/enable + source /opt/rh/devtoolset-10/enable source /opt/rh/rh-git227/enable - cmake3 --build _build --config Release -j2 + cmake --build _build --config Release -j$(nproc) ccache -s - name: Installer .rpm creation run: | cd _build - cpack3 -G RPM + cpack -G RPM - name: Solver archive creation run: | cd _build - cmake3 --install . --prefix install + cmake --install . --prefix install pushd . cd install/bin - tar czf ../../antares-solver_centos7.tar.gz antares-*-solver libsirius_solver.so + tar czf ../../antares-solver_centos7.tar.gz antares-solver libsirius_solver.so popd rm -rf install - name: .tar.gz creation run: | cd _build - cpack3 -G TGZ + cpack -G TGZ - name: Installer TGZ push uses: actions/upload-artifact@v3 @@ -107,21 +145,18 @@ jobs: with: path: _build/*.rpm - publish_assets: - name: Publish assets - needs: build - runs-on: ubuntu-latest - - steps: - - name: Download all artifacts - if: ${{ env.IS_RELEASE == 'true' }} - uses: actions/download-artifact@v3 - - - name: Publish assets if: ${{ env.IS_RELEASE == 'true' }} - uses: alexellis/upload-assets@0.4.0 env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ github.token }} + tag: ${{ github.event.inputs.release_tag }} + run: | + gh release upload "$tag" _build/*.tar.gz _build/*.rpm + + - name: Cache vcpkg binary dir + if: always() + id: save-cache-vcpkg-binary + uses: actions/cache/save@v3 with: - asset_paths: '["*/*.tar.gz", "*/*.rpm"]' + path: ${{ env.VCPKG_CACHE_DIR }} + key: vcpkg-cache-centos7-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} diff --git a/.github/workflows/oracle8.yml b/.github/workflows/oracle8.yml index ed68859c56..92b65a9a72 100644 --- a/.github/workflows/oracle8.yml +++ b/.github/workflows/oracle8.yml @@ -3,18 +3,34 @@ name: Oracle 8 CI (push and/or release) on: release: types: [created] + push: + branches: + - develop + - dependabot/* + + 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 == 'release' && github.event.action == 'created' }} + IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} IS_PUSH: ${{ github.event_name == 'push' }} + REF: ${{ inputs.target_branch =='' && github.ref_name || inputs.target_branch}} jobs: build: name: Build env: - ORTOOLSDIR: ${{ github.workspace }}/or-tools + ORTOOLS_DIR: ${{ github.workspace }}/or-tools runs-on: ubuntu-latest container: 'oraclelinux:8' @@ -29,33 +45,81 @@ jobs: - name: Install libraries run: | dnf install -y epel-release git cmake wget rpm-build redhat-lsb-core - dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-9-toolchain zlib-devel + dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-11 zlib-devel - name: Checkout run: | - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b $GITHUB_REF_NAME . + git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b ${{ env.REF }} . + git config --global safe.directory '*' - - name: Init submodule + - name: Install VCPKG + # Note: we need to use environment variables instead of workflow variables + # because github messes up path variables when running in container, + # see https://github.com/actions/runner/issues/2058 + run: | + git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics + echo "VCPKG_ROOT=$GITHUB_WORKSPACE/vcpkg" >> $GITHUB_ENV + echo "VCPKG_CACHE_DIR=$GITHUB_WORKSPACE/vcpkg_cache" >> $GITHUB_ENV + echo "VCPKG_BINARY_SOURCES=clear;files,$GITHUB_WORKSPACE/vcpkg_cache,readwrite" >> $GITHUB_ENV + + - name: Restore vcpkg binary dir from cache + id: cache-vcpkg-binary + # Note: we are stuck with v3, because v4 is not compatible with oracle8 image + uses: actions/cache/restore@v3 + with: + path: ${{ env.VCPKG_CACHE_DIR }} + key: vcpkg-cache-oracle8-${{ 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-oracle8- + + - name: Config OR-Tools URL + run: | + echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_oraclelinux-8_static_sirius.zip" >> $GITHUB_ENV + + - name: Download & extract OR-Tools run: | - git config --global safe.directory '*' - git submodule update --init --recursive src/antares-deps src/tests/resources/Antares_Simulator_Tests + mkdir -p ${{env.ORTOOLS_DIR}} + cd ${{env.ORTOOLS_DIR}} + wget ${{env.ORTOOLS_URL}} -O ortools.zip + unzip ortools.zip + rm ortools.zip + + - name: Init submodule + run: git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests - name: Install dependencies run: | pip3 install -r src/tests/examples/requirements.txt + - name: Install gh if needed + if: ${{ env.IS_RELEASE == 'true' }} + run: | + dnf -y install 'dnf-command(config-manager)' + dnf -y config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo + dnf -y install gh + - name: Configure run: | - source /opt/rh/gcc-toolset-9/enable - cmake -B _build -S src \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=ON \ - -DBUILD_UI=OFF \ + source /opt/rh/gcc-toolset-11/enable + cmake -B _build -S src \ + -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DVCPKG_TARGET_TRIPLET=x64-linux-release \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=ON \ + -DBUILD_TOOLS=ON \ + -DBUILD_UI=OFF \ + -DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install - name: Build run: | - source /opt/rh/gcc-toolset-9/enable - cmake --build _build --config Release -j2 + source /opt/rh/gcc-toolset-11/enable + cmake --build _build --config Release -j$(nproc) + + - name: Run unit and end-to-end tests + if: ${{ env.IS_PUSH == 'true' }} + run: | + cd _build + ctest -C Release --output-on-failure -L "unit|end-to-end" - name: Installer .rpm creation run: | @@ -68,7 +132,7 @@ jobs: cmake --install . --prefix install pushd . cd install/bin - tar czf ../../antares-solver_oracle8.tar.gz antares-*-solver libsirius_solver.so + tar czf ../../antares-solver_oracle8.tar.gz antares-solver libsirius_solver.so popd rm -rf install @@ -87,21 +151,18 @@ jobs: with: path: _build/*.rpm - publish_assets: - name: Publish assets - needs: build - runs-on: ubuntu-latest - - steps: - - name: Download all artifacts - if: ${{ env.IS_RELEASE == 'true' }} - uses: actions/download-artifact@v3 - - - name: Publish assets if: ${{ env.IS_RELEASE == 'true' }} - uses: alexellis/upload-assets@0.4.0 env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ github.token }} + tag: ${{ github.event.inputs.release_tag }} + run: | + gh release upload "$tag" _build/*.tar.gz _build/*.rpm + + - name: Cache vcpkg binary dir + if: always() + id: save-cache-vcpkg-binary + uses: actions/cache/save@v3 with: - asset_paths: '["*/*.tar.gz", "*/*.rpm"]' + path: ${{ env.VCPKG_CACHE_DIR }} + key: vcpkg-cache-oracle8-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 7301cc32df..c8f54479f3 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,8 +1,6 @@ name: Ubuntu CI (push and/or release) on: - release: - types: [created] push: branches: - develop @@ -12,11 +10,27 @@ on: - issue-* - release/* - doc/* + - dependabot/* + 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 == 'release' && github.event.action == 'created' }} - IS_PUSH: ${{ github.event_name == 'push' }} + 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}} + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + triplet: x64-linux + WX_CONFIG: /usr/bin/wx-config jobs: @@ -24,223 +38,284 @@ jobs: name: Build env: ORTOOLS_DIR: ${{ github.workspace }}/or-tools + os: ubuntu-20.04 + # Caching strategy of VCPKG dependencies + VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" - outputs: - os: ${{ matrix.os }} - - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20.04 if: "!contains(github.event.head_commit.message, '[skip ci]')" - strategy: - matrix: - os: [ubuntu-20.04] - test-platform: [ubuntu-20.04] steps: - - uses: actions/checkout@v3 - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ matrix.os }} - - - name: Install libraries - run: | - sudo apt-get update - sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev - sudo apt-get install libboost-test-dev - - - name: Read antares-deps version - id: antares-deps-version - uses: notiz-dev/github-action-json-property@release - with: - path: 'antares-deps-version.json' - prop_path: 'antares_deps_version' - - - - name: Config OR-Tools URL - run: | + - uses: actions/checkout@v4 + with: + ref: ${{ env.REF }} + + - name: Install VCPKG + run: git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics + + - name: Restore vcpkg binary dir from cache + id: cache-vcpkg-binary + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}/vcpkg_cache + key: vcpkg-cache-ubuntu-${{ 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-ubuntu- + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ env.os }} + + - name: Install libraries + run: | + sudo apt-get update + sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev + sudo apt-get install g++-10 gcc-10 + + - name: Config OR-Tools URL + run: | echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_ubuntu-20.04_static_sirius.zip" >> $GITHUB_ENV - - name: Download pre-compiled librairies - uses: ./.github/workflows/download-extract-precompiled-libraries-tgz - with: - antares-deps-version: ${{steps.antares-deps-version.outputs.prop}} - os: ${{matrix.os}} - ortools-url: ${{env.ORTOOLS_URL}} - ortools-dir: ${{env.ORTOOLS_DIR}} - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.12 - - - name: Install dependencies - run: | + - name: Download pre-compiled librairies + uses: ./.github/workflows/download-extract-precompiled-libraries-tgz + with: + os: ${{env.os}} + ortools-url: ${{env.ORTOOLS_URL}} + ortools-dir: ${{env.ORTOOLS_DIR}} + + - name: Set up Python + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: | python -m pip install --upgrade pip pip3 install -r src/tests/examples/requirements.txt - - name: Init submodule - run: | - git submodule update --init src/antares-deps - git submodule update --init src/tests/resources/Antares_Simulator_Tests - - - name: Configure push - run: | - cmake -B _build -S src \ + - name: Configure + run: | + cmake -B _build -S src \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER=/usr/bin/gcc-10 \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \ + -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DVCPKG_TARGET_TRIPLET=x64-linux-release \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=ON \ + -DBUILD_TOOLS=ON \ + -DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install \ + -DPython3_EXECUTABLE="${{ env.Python3_ROOT_DIR }}/bin/python" + + - name: Build + run: | + cmake --build _build -j$(nproc) + + - name: Run API tests + run: | + cmake --install _build --prefix antares_install + cd src/api_client_example + cmake -B _build -S . \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_COMPILER=/usr/bin/gcc-10 \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DDEPS_INSTALL_DIR=${{github.workspace}}/rte-antares-deps-Release \ + -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=ON \ - -DBUILD_not_system=OFF \ - -DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install \ - - - name: Build - run: | - cmake --build _build -j$(nproc) - - - name: Run unfeasibility-related tests - if: ${{ env.IS_PUSH == 'true' }} - run: | - cd _build - ctest -C Release --output-on-failure -R unfeasible - - - name: Run unit and end-to-end tests - if: ${{ env.IS_PUSH == 'true' }} - run: | + -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DVCPKG_TARGET_TRIPLET=x64-linux-release \ + -DCMAKE_PREFIX_PATH="${{github.workspace}}/rte-antares-deps-Release;${{github.workspace}}/install;${{ env.ORTOOLS_DIR }}/install;${{github.workspace}}/antares_install;${{github.workspace}}/rte-antares-deps-Release;${{github.workspace}}/_build/vcpkg_installed/x64-linux-release" + cmake --build _build -j$(nproc) cd _build - ctest -C ${{ matrix.buildtype }} --output-on-failure -L "unit|end-to-end" - - - name: Run kirchhoff constraints tests - shell: bash - run: | - tar xvf src/tests/kirchhoff-cbuilder/reference.tar.gz -C src/tests/kirchhoff-cbuilder/ - cd _build - ctest -C Release --output-on-failure -R kirchhoff - - # simtest - - name: Read simtest version - id: simtest-version - uses: notiz-dev/github-action-json-property@release - with: - path: 'simtest.json' - prop_path: 'version' - - - name: Run tests about infinity on BCs RHS - if: ${{ env.IS_PUSH == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-v830 - os: ${{ matrix.test-platform }} - - - name: Run short-tests - if: ${{ env.IS_PUSH == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: short-tests - os: ${{ matrix.test-platform }} - - - name: Run mps tests - if: ${{ env.IS_PUSH == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-mps - os: ${{ matrix.test-platform }} - - - name: Run tests for adequacy patch (CSR) - if: ${{ env.IS_PUSH == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: adequacy-patch-CSR - os: ${{ matrix.test-platform }} - - - name: Run medium-tests - if: ${{ env.IS_RELEASE == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: medium-tests - os: ${{ matrix.test-platform }} - - - name: Run long-tests-1 - if: ${{ env.IS_RELEASE == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: long-tests-1 - os: ${{ matrix.test-platform }} - - - name: Run long-tests-2 - if: ${{ env.IS_RELEASE == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: long-tests-2 - os: ${{ matrix.test-platform }} - - - name: Run long-tests-3 - if: ${{ env.IS_RELEASE == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: long-tests-3 - os: ${{ matrix.test-platform }} - - - name: Upload logs for failed tests - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: test-log - path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log - - - name: Installer .deb creation - run: | - cd _build - cpack -G DEB - - - name: .tar.gz creation - run: | - cd _build - cpack -G TGZ - - - name: Solver archive creation - run: | - cd _build - cmake --install . --prefix install - pushd . - cd install/bin - tar czf ../../antares-solver_ubuntu20.04.tar.gz antares-*-solver libsirius_solver.so - popd - rm -rf install - - - name: Installer archive upload push - uses: actions/upload-artifact@v3 - with: - path: _build/*.tar.gz - - - name: Installer deb upload push - uses: actions/upload-artifact@v3 - with: - path: _build/*.deb - - publish_assets: - name: Publish assets - needs: build - runs-on: ${{needs.build.outputs.os}} - steps: - - name: Download all artifacts - if: ${{ env.IS_RELEASE == 'true' }} - uses: actions/download-artifact@v3 - - - - name: Publish assets - if: ${{ env.IS_RELEASE == 'true' }} - uses: alexellis/upload-assets@0.4.0 - env: + ctest -C Release --output-on-failure + + # simtest + - name: Read simtest version + id: simtest-version + uses: notiz-dev/github-action-json-property@release + with: + path: 'simtest.json' + prop_path: 'version' + + - name: Init submodule + run: | + git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests + + - name: Run named mps tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-named-mps + os: ${{ env.os }} + variant: "named-mps" + + - name: Run unfeasibility-related tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + run: | + cd _build + ctest -C Release --output-on-failure -R "^unfeasible$" + + - name: Run unit and end-to-end tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + run: | + cd _build + ctest -C Release --output-on-failure -L "unit|end-to-end" + + - name: Upload logs for failed tests + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: test-log + path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log + + - name: Run tests about infinity on BCs RHS + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-v830 + os: ${{ env.os }} + + - name: Run MILP with CBC + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-milp + variant: "milp-cbc" + os: ${{ env.os }} + + - name: Run tests introduced in v860 + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-v860 + os: ${{ env.os }} + + - name: Run short-tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: short-tests + os: ${{ env.os }} + + - name: Run mps tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-mps + os: ${{ env.os }} + + - name: Run tests for adequacy patch (CSR) + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: adequacy-patch-CSR + os: ${{ env.os }} + + - name: Run parallel tests + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-parallel + os: ${{ env.os }} + variant: "parallel" + + - name: Run tests for time series generator tool + if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: ts-generator + os: ${{ env.os }} + variant: "tsgenerator" + + - name: Run medium-tests + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: medium-tests + os: ${{ env.os }} + + - name: Run long-tests-1 + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: long-tests-1 + os: ${{ env.os }} + + - name: Run long-tests-2 + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: long-tests-2 + os: ${{ env.os }} + + - name: Run long-tests-3 + if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: long-tests-3 + os: ${{ env.os }} + + - name: Installer .deb creation + run: | + cd _build + cpack -G DEB + + - name: .tar.gz creation + run: | + cd _build + cpack -G TGZ + + - name: Solver archive creation + run: | + cd _build + cmake --install . --prefix install + pushd . + cd install/bin + tar czf ../../antares-solver_ubuntu20.04.tar.gz antares-solver libsirius_solver.so + popd + rm -rf install + + - name: Installer archive upload push + uses: actions/upload-artifact@v4 + with: + name: targz + path: _build/*.tar.gz + + - name: Installer deb upload push + uses: actions/upload-artifact@v4 + with: + name: deb + path: _build/*.deb + + + - name: Publish assets + if: ${{ env.IS_RELEASE == 'true' }} + env: GITHUB_TOKEN: ${{ github.token }} - with: - asset_paths: '["*/*.tar.gz", "*/*.deb"]' + tag: ${{ github.event.inputs.release_tag }} + run: | + gh release upload "$tag" _build/*.tar.gz _build/*.deb + + - name: Cache vcpkg binary dir + if: always() + id: save-cache-vcpkg-binary + uses: actions/cache/save@v4 + with: + path: ${{ github.workspace }}/vcpkg_cache + key: vcpkg-cache-ubuntu-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} From 94cd9367af27a13614850633836ffb088b83ac80 Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:53:59 +0200 Subject: [PATCH 12/15] Remove Download pre-compiled librairies --- .github/workflows/sonarcloud.yml | 9 --------- .github/workflows/ubuntu.yml | 7 ------- 2 files changed, 16 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 7f62cc7d08..f9b919b892 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -52,15 +52,6 @@ jobs: path: 'antares-deps-version.json' prop_path: 'antares_deps_version' - - name: Download pre-compiled librairies - uses: ./.github/workflows/download-extract-precompiled-libraries-tgz - with: - antares-deps-version: ${{steps.antares-deps-version.outputs.prop}} - os: ${{matrix.os}} - buildtype: Debug - ortools-url: ${{env.ORTOOLS_URL}} - ortools-dir: ${{env.ORTOOLS_DIR}} - - name: Set up Python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index c8f54479f3..302ab4d9b7 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -77,13 +77,6 @@ jobs: run: | echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_ubuntu-20.04_static_sirius.zip" >> $GITHUB_ENV - - name: Download pre-compiled librairies - uses: ./.github/workflows/download-extract-precompiled-libraries-tgz - with: - os: ${{env.os}} - ortools-url: ${{env.ORTOOLS_URL}} - ortools-dir: ${{env.ORTOOLS_DIR}} - - name: Set up Python id: setup-python uses: actions/setup-python@v5 From 689313801d0966d875726de98d15b73bd9fd92c1 Mon Sep 17 00:00:00 2001 From: Florian OMNES <26088210+flomnes@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:56:00 +0200 Subject: [PATCH 13/15] Use minizip-ng 4.0.1 (from 3.0.7) (#1696) * Use minizip-ng 4.0.1 (from 3.0.7) * Update writer tests --- src/solver/writer/zip_writer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solver/writer/zip_writer.cpp b/src/solver/writer/zip_writer.cpp index b2bd427fb1..21844cbc12 100644 --- a/src/solver/writer/zip_writer.cpp +++ b/src/solver/writer/zip_writer.cpp @@ -83,7 +83,7 @@ ZipWriter::ZipWriter(std::shared_ptr qs, pArchivePath(std::string(archivePath) + ".zip"), pDurationCollector(duration_collector) { - mz_zip_writer_create(&pZipHandle); + pZipHandle = mz_zip_writer_create(); if (int32_t ret = mz_zip_writer_open_file(pZipHandle, pArchivePath.c_str(), 0, 0); ret != MZ_OK) { logs.error() << "Error opening zip file " << pArchivePath << " (" << ret << ")"; From 62583502506f38aed9bb1207c1d3f6f658ab7aea Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Fri, 28 Jun 2024 16:02:59 +0200 Subject: [PATCH 14/15] Revert "Use windows-vcpkg.yml@develop..Use minizip-ng 4.0.1 (from 3.0.7)" --- .../workflows/centos7-system-deps-build.yml | 84 +++ .github/workflows/centos7.yml | 125 ++--- .github/workflows/oracle8.yml | 119 ++--- .github/workflows/sonarcloud.yml | 9 + .github/workflows/ubuntu.yml | 486 ++++++++--------- .github/workflows/windows-vcpkg.yml | 487 +++++++----------- src/CMakeLists.txt | 75 ++- src/solver/writer/zip_writer.cpp | 2 +- src/vcpkg.json | 32 -- 9 files changed, 599 insertions(+), 820 deletions(-) create mode 100644 .github/workflows/centos7-system-deps-build.yml delete mode 100644 src/vcpkg.json diff --git a/.github/workflows/centos7-system-deps-build.yml b/.github/workflows/centos7-system-deps-build.yml new file mode 100644 index 0000000000..bd00b30703 --- /dev/null +++ b/.github/workflows/centos7-system-deps-build.yml @@ -0,0 +1,84 @@ +name: Centos7 CI (deps. compilation) + +on: + push: + branches: + - release/* + - develop + +jobs: + + build: + + runs-on: ubuntu-latest + container: 'centos:7' + + steps: + + - name: Set up Python + run: | + yum update -y + yum install -y python3 python3-pip + + - name: Install libraries + run: | + yum install -y epel-release + yum install -y git redhat-lsb-core gcc gcc-c++ make wget centos-release-scl scl-utils rpm-build + yum install -y devtoolset-9 + yum install -y rh-git227-git + yum install -y unzip libuuid-devel wxGTK3-devel boost-test boost-devel + + - name: Install cmake + run: | + wget https://github.com/Kitware/CMake/releases/download/v3.25.3/cmake-3.25.3-linux-x86_64.tar.gz + tar xvf cmake-3.25.3-linux-x86_64.tar.gz -C / + echo "/cmake-3.25.3-linux-x86_64/bin" >> $GITHUB_PATH + rm cmake-3.25.3-linux-x86_64.tar.gz + + - name: Checkout + run: | + git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b $GITHUB_REF_NAME . + + - name: Init submodule + run: | + git submodule update --init --recursive src . + + - name: Install dependencies + run: | + pip3 install -r src/tests/examples/requirements.txt + + - name: Configure + run: | + source /opt/rh/devtoolset-9/enable + #git 2.x must be enabled for Coin compilation with CMake ExternalProject_Add + source /opt/rh/rh-git227/enable + cmake -B _build -S src -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON + + - name: Build + run: | + source /opt/rh/devtoolset-9/enable + source /opt/rh/rh-git227/enable + cmake --build _build --config release -j2 + + - name: Installer .rpm creation + run: | + cd _build + cpack -G RPM + + - name: Installer .tar.gz creation + run: | + cd _build + cpack -G TGZ + + - name: Installer archive upload + uses: actions/upload-artifact@v3 + with: + name: antares-centos7-archive + path: _build/*.tar.gz + + - name: Installer rpm upload + uses: actions/upload-artifact@v3 + with: + name: antares-centos7-rpm + path: _build/*.rpm + diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index 3308dab812..7a29b6c5b3 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -6,23 +6,17 @@ on: push: branches: - develop - - dependabot/* - schedule: - - cron: '21 2 * * *' - workflow_call: - inputs: - run-tests: - required: true - type: string - target_branch: - required: true - type: string + - feature/* + - features/* + - fix/* + - issue-* + - release/* + - doc/* env: GITHUB_TOKEN: ${{ github.token }} - IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} + IS_RELEASE: ${{ github.event_name == 'release' && github.event.action == 'created' }} IS_PUSH: ${{ github.event_name == 'push' }} - REF: ${{ inputs.target_branch =='' && github.ref_name || inputs.target_branch}} jobs: @@ -38,39 +32,19 @@ jobs: - name: Checkout run: | - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b ${{ env.REF }} . + git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b $GITHUB_REF_NAME . - - name: Install gcc 10 + - name: Init submodule run: | - yum install -y centos-release-scl - yum install -y devtoolset-10-gcc* - - - name: Install cmake 3.28 - run: pip3 install cmake==3.28.4 + git submodule update --init --recursive src/antares-deps src/tests/resources/Antares_Simulator_Tests - - name: Install VCPKG - # Note: we need to use environment variables instead of workflow variables - # because github messes up path variables when running in container, - # see https://github.com/actions/runner/issues/2058 + - name: Download & extract precompiled deps at root run: | - git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics - echo "VCPKG_ROOT=$GITHUB_WORKSPACE/vcpkg" >> $GITHUB_ENV - echo "VCPKG_CACHE_DIR=$GITHUB_WORKSPACE/vcpkg_cache" >> $GITHUB_ENV - echo "VCPKG_BINARY_SOURCES=clear;files,$GITHUB_WORKSPACE/vcpkg_cache,readwrite" >> $GITHUB_ENV - - - name: Restore vcpkg binary dir from cache - id: cache-vcpkg-binary - # Note: we are stuck with v3, because v4 is not compatible with oracle8 image - uses: actions/cache/restore@v3 - with: - path: ${{ env.VCPKG_CACHE_DIR }} - key: vcpkg-cache-centos7-${{ 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-centos7- - - - name: Init submodule - run: | - git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests + ANTARES_DEPS_VERSION=$(cut -d'"' -f4 antares-deps-version.json | grep -Ev '\{|\}') + cd / + wget https://github.com/AntaresSimulatorTeam/antares-deps/releases/download/v${ANTARES_DEPS_VERSION}/rte-antares-deps-centos7-Release.tar.gz + tar -xvf rte-antares-deps-centos7-Release.tar.gz + rm -rf rte-antares-deps-centos7-Release.tar.gz - name: Config OR-Tools URL run: | @@ -84,56 +58,44 @@ jobs: unzip -q ortools.zip rm ortools.zip - - name: Install gh if needed - if: ${{ env.IS_RELEASE == 'true' }} - run: | - yum -y install dnf - dnf -y install 'dnf-command(config-manager)' - dnf -y config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo - dnf -y install gh - - name: Configure run: | - source /opt/rh/devtoolset-10/enable - source /opt/rh/rh-git227/enable - cmake -B _build -S src \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DVCPKG_TARGET_TRIPLET=x64-linux-release \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=ON \ - -DBUILD_TOOLS=ON \ - -DBUILD_UI=OFF \ - -DCMAKE_PREFIX_PATH=${{ env.ORTOOLSDIR }}/install \ - + source /opt/rh/devtoolset-9/enable + cmake3 -B _build -S src \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DDEPS_INSTALL_DIR=/rte-antares-deps-Release \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=ON \ + -DBUILD_not_system=OFF \ + -DCMAKE_PREFIX_PATH=${{ env.ORTOOLSDIR }}/install \ - name: Build run: | - source /opt/rh/devtoolset-10/enable + source /opt/rh/devtoolset-9/enable source /opt/rh/rh-git227/enable - cmake --build _build --config Release -j$(nproc) + cmake3 --build _build --config Release -j2 ccache -s - name: Installer .rpm creation run: | cd _build - cpack -G RPM + cpack3 -G RPM - name: Solver archive creation run: | cd _build - cmake --install . --prefix install + cmake3 --install . --prefix install pushd . cd install/bin - tar czf ../../antares-solver_centos7.tar.gz antares-solver libsirius_solver.so + tar czf ../../antares-solver_centos7.tar.gz antares-*-solver libsirius_solver.so popd rm -rf install - name: .tar.gz creation run: | cd _build - cpack -G TGZ + cpack3 -G TGZ - name: Installer TGZ push uses: actions/upload-artifact@v3 @@ -145,18 +107,21 @@ jobs: with: path: _build/*.rpm + publish_assets: + name: Publish assets + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download all artifacts + if: ${{ env.IS_RELEASE == 'true' }} + uses: actions/download-artifact@v3 + + - name: Publish assets if: ${{ env.IS_RELEASE == 'true' }} + uses: alexellis/upload-assets@0.4.0 env: - GITHUB_TOKEN: ${{ github.token }} - tag: ${{ github.event.inputs.release_tag }} - run: | - gh release upload "$tag" _build/*.tar.gz _build/*.rpm - - - name: Cache vcpkg binary dir - if: always() - id: save-cache-vcpkg-binary - uses: actions/cache/save@v3 + GITHUB_TOKEN: ${{ github.token }} with: - path: ${{ env.VCPKG_CACHE_DIR }} - key: vcpkg-cache-centos7-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} + asset_paths: '["*/*.tar.gz", "*/*.rpm"]' diff --git a/.github/workflows/oracle8.yml b/.github/workflows/oracle8.yml index 92b65a9a72..ed68859c56 100644 --- a/.github/workflows/oracle8.yml +++ b/.github/workflows/oracle8.yml @@ -3,34 +3,18 @@ name: Oracle 8 CI (push and/or release) on: release: types: [created] - push: - branches: - - develop - - dependabot/* - - 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' }} + IS_RELEASE: ${{ github.event_name == 'release' && github.event.action == 'created' }} IS_PUSH: ${{ github.event_name == 'push' }} - REF: ${{ inputs.target_branch =='' && github.ref_name || inputs.target_branch}} jobs: build: name: Build env: - ORTOOLS_DIR: ${{ github.workspace }}/or-tools + ORTOOLSDIR: ${{ github.workspace }}/or-tools runs-on: ubuntu-latest container: 'oraclelinux:8' @@ -45,81 +29,33 @@ jobs: - name: Install libraries run: | dnf install -y epel-release git cmake wget rpm-build redhat-lsb-core - dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-11 zlib-devel + dnf install -y unzip libuuid-devel boost-test boost-devel gcc-toolset-9-toolchain zlib-devel - name: Checkout run: | - git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b ${{ env.REF }} . - git config --global safe.directory '*' - - - name: Install VCPKG - # Note: we need to use environment variables instead of workflow variables - # because github messes up path variables when running in container, - # see https://github.com/actions/runner/issues/2058 - run: | - git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics - echo "VCPKG_ROOT=$GITHUB_WORKSPACE/vcpkg" >> $GITHUB_ENV - echo "VCPKG_CACHE_DIR=$GITHUB_WORKSPACE/vcpkg_cache" >> $GITHUB_ENV - echo "VCPKG_BINARY_SOURCES=clear;files,$GITHUB_WORKSPACE/vcpkg_cache,readwrite" >> $GITHUB_ENV - - - name: Restore vcpkg binary dir from cache - id: cache-vcpkg-binary - # Note: we are stuck with v3, because v4 is not compatible with oracle8 image - uses: actions/cache/restore@v3 - with: - path: ${{ env.VCPKG_CACHE_DIR }} - key: vcpkg-cache-oracle8-${{ 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-oracle8- - - - name: Config OR-Tools URL - run: | - echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_oraclelinux-8_static_sirius.zip" >> $GITHUB_ENV - - - name: Download & extract OR-Tools - run: | - mkdir -p ${{env.ORTOOLS_DIR}} - cd ${{env.ORTOOLS_DIR}} - wget ${{env.ORTOOLS_URL}} -O ortools.zip - unzip ortools.zip - rm ortools.zip + git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git -b $GITHUB_REF_NAME . - name: Init submodule - run: git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests + run: | + git config --global safe.directory '*' + git submodule update --init --recursive src/antares-deps src/tests/resources/Antares_Simulator_Tests - name: Install dependencies run: | pip3 install -r src/tests/examples/requirements.txt - - name: Install gh if needed - if: ${{ env.IS_RELEASE == 'true' }} - run: | - dnf -y install 'dnf-command(config-manager)' - dnf -y config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo - dnf -y install gh - - name: Configure run: | - source /opt/rh/gcc-toolset-11/enable - cmake -B _build -S src \ - -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DVCPKG_TARGET_TRIPLET=x64-linux-release \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=ON \ - -DBUILD_TOOLS=ON \ - -DBUILD_UI=OFF \ - -DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install + source /opt/rh/gcc-toolset-9/enable + cmake -B _build -S src \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=ON \ + -DBUILD_UI=OFF \ - name: Build run: | - source /opt/rh/gcc-toolset-11/enable - cmake --build _build --config Release -j$(nproc) - - - name: Run unit and end-to-end tests - if: ${{ env.IS_PUSH == 'true' }} - run: | - cd _build - ctest -C Release --output-on-failure -L "unit|end-to-end" + source /opt/rh/gcc-toolset-9/enable + cmake --build _build --config Release -j2 - name: Installer .rpm creation run: | @@ -132,7 +68,7 @@ jobs: cmake --install . --prefix install pushd . cd install/bin - tar czf ../../antares-solver_oracle8.tar.gz antares-solver libsirius_solver.so + tar czf ../../antares-solver_oracle8.tar.gz antares-*-solver libsirius_solver.so popd rm -rf install @@ -151,18 +87,21 @@ jobs: with: path: _build/*.rpm + publish_assets: + name: Publish assets + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download all artifacts + if: ${{ env.IS_RELEASE == 'true' }} + uses: actions/download-artifact@v3 + + - name: Publish assets if: ${{ env.IS_RELEASE == 'true' }} + uses: alexellis/upload-assets@0.4.0 env: - GITHUB_TOKEN: ${{ github.token }} - tag: ${{ github.event.inputs.release_tag }} - run: | - gh release upload "$tag" _build/*.tar.gz _build/*.rpm - - - name: Cache vcpkg binary dir - if: always() - id: save-cache-vcpkg-binary - uses: actions/cache/save@v3 + GITHUB_TOKEN: ${{ github.token }} with: - path: ${{ env.VCPKG_CACHE_DIR }} - key: vcpkg-cache-oracle8-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} + asset_paths: '["*/*.tar.gz", "*/*.rpm"]' diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index f9b919b892..7f62cc7d08 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -52,6 +52,15 @@ jobs: path: 'antares-deps-version.json' prop_path: 'antares_deps_version' + - name: Download pre-compiled librairies + uses: ./.github/workflows/download-extract-precompiled-libraries-tgz + with: + antares-deps-version: ${{steps.antares-deps-version.outputs.prop}} + os: ${{matrix.os}} + buildtype: Debug + ortools-url: ${{env.ORTOOLS_URL}} + ortools-dir: ${{env.ORTOOLS_DIR}} + - name: Set up Python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 302ab4d9b7..7301cc32df 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,6 +1,8 @@ name: Ubuntu CI (push and/or release) on: + release: + types: [created] push: branches: - develop @@ -10,27 +12,11 @@ on: - issue-* - release/* - doc/* - - dependabot/* - 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}} - VCPKG_ROOT: ${{ github.workspace }}/vcpkg - triplet: x64-linux - WX_CONFIG: /usr/bin/wx-config + IS_RELEASE: ${{ github.event_name == 'release' && github.event.action == 'created' }} + IS_PUSH: ${{ github.event_name == 'push' }} jobs: @@ -38,277 +24,223 @@ jobs: name: Build env: ORTOOLS_DIR: ${{ github.workspace }}/or-tools - os: ubuntu-20.04 - # Caching strategy of VCPKG dependencies - VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" - runs-on: ubuntu-20.04 + outputs: + os: ${{ matrix.os }} + + runs-on: ${{ matrix.os }} if: "!contains(github.event.head_commit.message, '[skip ci]')" + strategy: + matrix: + os: [ubuntu-20.04] + test-platform: [ubuntu-20.04] steps: - - uses: actions/checkout@v4 - with: - ref: ${{ env.REF }} - - - name: Install VCPKG - run: git submodule update --init vcpkg && ./vcpkg/bootstrap-vcpkg.sh -disableMetrics - - - name: Restore vcpkg binary dir from cache - id: cache-vcpkg-binary - uses: actions/cache/restore@v4 - with: - path: ${{ github.workspace }}/vcpkg_cache - key: vcpkg-cache-ubuntu-${{ 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-ubuntu- - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ env.os }} - - - name: Install libraries - run: | - sudo apt-get update - sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev - sudo apt-get install g++-10 gcc-10 - - - name: Config OR-Tools URL - run: | - echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_ubuntu-20.04_static_sirius.zip" >> $GITHUB_ENV + - uses: actions/checkout@v3 + + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ matrix.os }} - - name: Set up Python - id: setup-python - uses: actions/setup-python@v5 - with: - python-version: '3.12' + - name: Install libraries + run: | + sudo apt-get update + sudo apt-get install uuid-dev libwxgtk3.0-gtk3-dev + sudo apt-get install libboost-test-dev - - name: Install dependencies - run: | + - name: Read antares-deps version + id: antares-deps-version + uses: notiz-dev/github-action-json-property@release + with: + path: 'antares-deps-version.json' + prop_path: 'antares_deps_version' + + + - name: Config OR-Tools URL + run: | + echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_ubuntu-20.04_static_sirius.zip" >> $GITHUB_ENV + + - name: Download pre-compiled librairies + uses: ./.github/workflows/download-extract-precompiled-libraries-tgz + with: + antares-deps-version: ${{steps.antares-deps-version.outputs.prop}} + os: ${{matrix.os}} + ortools-url: ${{env.ORTOOLS_URL}} + ortools-dir: ${{env.ORTOOLS_DIR}} + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.12 + + - name: Install dependencies + run: | python -m pip install --upgrade pip pip3 install -r src/tests/examples/requirements.txt - - name: Configure - run: | - cmake -B _build -S src \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_C_COMPILER=/usr/bin/gcc-10 \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \ - -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DVCPKG_TARGET_TRIPLET=x64-linux-release \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_TESTING=ON \ - -DBUILD_TOOLS=ON \ - -DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install \ - -DPython3_EXECUTABLE="${{ env.Python3_ROOT_DIR }}/bin/python" - - - name: Build - run: | - cmake --build _build -j$(nproc) - - - name: Run API tests - run: | - cmake --install _build --prefix antares_install - cd src/api_client_example - cmake -B _build -S . \ + - name: Init submodule + run: | + git submodule update --init src/antares-deps + git submodule update --init src/tests/resources/Antares_Simulator_Tests + + - name: Configure push + run: | + cmake -B _build -S src \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_C_COMPILER=/usr/bin/gcc-10 \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 \ + -DDEPS_INSTALL_DIR=${{github.workspace}}/rte-antares-deps-Release \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_TESTING=ON \ - -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DVCPKG_TARGET_TRIPLET=x64-linux-release \ - -DCMAKE_PREFIX_PATH="${{github.workspace}}/rte-antares-deps-Release;${{github.workspace}}/install;${{ env.ORTOOLS_DIR }}/install;${{github.workspace}}/antares_install;${{github.workspace}}/rte-antares-deps-Release;${{github.workspace}}/_build/vcpkg_installed/x64-linux-release" - cmake --build _build -j$(nproc) + -DBUILD_not_system=OFF \ + -DCMAKE_PREFIX_PATH=${{ env.ORTOOLS_DIR }}/install \ + + - name: Build + run: | + cmake --build _build -j$(nproc) + + - name: Run unfeasibility-related tests + if: ${{ env.IS_PUSH == 'true' }} + run: | + cd _build + ctest -C Release --output-on-failure -R unfeasible + + - name: Run unit and end-to-end tests + if: ${{ env.IS_PUSH == 'true' }} + run: | + cd _build + ctest -C ${{ matrix.buildtype }} --output-on-failure -L "unit|end-to-end" + + - name: Run kirchhoff constraints tests + shell: bash + run: | + tar xvf src/tests/kirchhoff-cbuilder/reference.tar.gz -C src/tests/kirchhoff-cbuilder/ + cd _build + ctest -C Release --output-on-failure -R kirchhoff + + # simtest + - name: Read simtest version + id: simtest-version + uses: notiz-dev/github-action-json-property@release + with: + path: 'simtest.json' + prop_path: 'version' + + - name: Run tests about infinity on BCs RHS + if: ${{ env.IS_PUSH == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-v830 + os: ${{ matrix.test-platform }} + + - name: Run short-tests + if: ${{ env.IS_PUSH == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: short-tests + os: ${{ matrix.test-platform }} + + - name: Run mps tests + if: ${{ env.IS_PUSH == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-mps + os: ${{ matrix.test-platform }} + + - name: Run tests for adequacy patch (CSR) + if: ${{ env.IS_PUSH == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: adequacy-patch-CSR + os: ${{ matrix.test-platform }} + + - name: Run medium-tests + if: ${{ env.IS_RELEASE == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: medium-tests + os: ${{ matrix.test-platform }} + + - name: Run long-tests-1 + if: ${{ env.IS_RELEASE == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: long-tests-1 + os: ${{ matrix.test-platform }} + + - name: Run long-tests-2 + if: ${{ env.IS_RELEASE == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: long-tests-2 + os: ${{ matrix.test-platform }} + + - name: Run long-tests-3 + if: ${{ env.IS_RELEASE == 'true' }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: long-tests-3 + os: ${{ matrix.test-platform }} + + - name: Upload logs for failed tests + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: test-log + path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log + + - name: Installer .deb creation + run: | + cd _build + cpack -G DEB + + - name: .tar.gz creation + run: | cd _build - ctest -C Release --output-on-failure - - # simtest - - name: Read simtest version - id: simtest-version - uses: notiz-dev/github-action-json-property@release - with: - path: 'simtest.json' - prop_path: 'version' - - - name: Init submodule - run: | - git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests - - - name: Run named mps tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-named-mps - os: ${{ env.os }} - variant: "named-mps" - - - name: Run unfeasibility-related tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - run: | - cd _build - ctest -C Release --output-on-failure -R "^unfeasible$" - - - name: Run unit and end-to-end tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - run: | - cd _build - ctest -C Release --output-on-failure -L "unit|end-to-end" - - - name: Upload logs for failed tests - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: test-log - path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log - - - name: Run tests about infinity on BCs RHS - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-v830 - os: ${{ env.os }} - - - name: Run MILP with CBC - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-milp - variant: "milp-cbc" - os: ${{ env.os }} - - - name: Run tests introduced in v860 - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-v860 - os: ${{ env.os }} - - - name: Run short-tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: short-tests - os: ${{ env.os }} - - - name: Run mps tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-mps - os: ${{ env.os }} - - - name: Run tests for adequacy patch (CSR) - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: adequacy-patch-CSR - os: ${{ env.os }} - - - name: Run parallel tests - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-parallel - os: ${{ env.os }} - variant: "parallel" - - - name: Run tests for time series generator tool - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: ts-generator - os: ${{ env.os }} - variant: "tsgenerator" - - - name: Run medium-tests - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: medium-tests - os: ${{ env.os }} - - - name: Run long-tests-1 - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: long-tests-1 - os: ${{ env.os }} - - - name: Run long-tests-2 - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: long-tests-2 - os: ${{ env.os }} - - - name: Run long-tests-3 - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: long-tests-3 - os: ${{ env.os }} - - - name: Installer .deb creation - run: | - cd _build - cpack -G DEB - - - name: .tar.gz creation - run: | - cd _build - cpack -G TGZ - - - name: Solver archive creation - run: | - cd _build - cmake --install . --prefix install - pushd . - cd install/bin - tar czf ../../antares-solver_ubuntu20.04.tar.gz antares-solver libsirius_solver.so - popd - rm -rf install - - - name: Installer archive upload push - uses: actions/upload-artifact@v4 - with: - name: targz - path: _build/*.tar.gz - - - name: Installer deb upload push - uses: actions/upload-artifact@v4 - with: - name: deb - path: _build/*.deb - - - - name: Publish assets - if: ${{ env.IS_RELEASE == 'true' }} - env: + cpack -G TGZ + + - name: Solver archive creation + run: | + cd _build + cmake --install . --prefix install + pushd . + cd install/bin + tar czf ../../antares-solver_ubuntu20.04.tar.gz antares-*-solver libsirius_solver.so + popd + rm -rf install + + - name: Installer archive upload push + uses: actions/upload-artifact@v3 + with: + path: _build/*.tar.gz + + - name: Installer deb upload push + uses: actions/upload-artifact@v3 + with: + path: _build/*.deb + + publish_assets: + name: Publish assets + needs: build + runs-on: ${{needs.build.outputs.os}} + steps: + - name: Download all artifacts + if: ${{ env.IS_RELEASE == 'true' }} + uses: actions/download-artifact@v3 + + + - name: Publish assets + if: ${{ env.IS_RELEASE == 'true' }} + uses: alexellis/upload-assets@0.4.0 + env: GITHUB_TOKEN: ${{ github.token }} - tag: ${{ github.event.inputs.release_tag }} - run: | - gh release upload "$tag" _build/*.tar.gz _build/*.deb - - - name: Cache vcpkg binary dir - if: always() - id: save-cache-vcpkg-binary - uses: actions/cache/save@v4 - with: - path: ${{ github.workspace }}/vcpkg_cache - key: vcpkg-cache-ubuntu-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} + with: + asset_paths: '["*/*.tar.gz", "*/*.deb"]' diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index bb0762b9cd..e130ad9c69 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -10,315 +10,204 @@ on: - issue-* - release/* - doc/* - - dependabot/* - 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: - + windows: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest] + buildtype: [release] + include: + - os: windows-latest + triplet: x64-windows + vcpkgPackages: wxwidgets boost-test + test-platform: windows-2022 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-latest - test-platform: windows-2022 - vcpkgPackages: wxwidgets boost-test - triplet: x64-windows-release - # Caching strategy of VCPKG dependencies - VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" - - runs-on: windows-latest + ORTOOLS_URL: "https://github.com/rte-france/or-tools/releases/download/v9.5-rte2.0/ortools_cxx_windows-latest_static_sirius.zip" + RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule'}} steps: + - uses: actions/checkout@v3 - - uses: actions/checkout@v4 - with: - ref: ${{ env.REF }} - - - name: Config OR-Tools URL - run: | + - name: Config OR-Tools URL + run: | echo "ORTOOLS_URL=https://github.com/rte-france/or-tools/releases/download/$(cat ortools_tag)/ortools_cxx_windows-latest_static_sirius.zip" >> $GITHUB_ENV - shell: bash + shell: bash - - name: Pre-requisites - shell: cmd - run: | + - name: Pre-requisites + shell: cmd + run: | choco install wget unzip zip --no-progress - # 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: | - wget https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3-windows-x86_64.zip -O ccache.zip - unzip ccache.zip - rm ccache.zip - mv ccache-4.8.3-windows-x86_64 ccache - cp ccache/ccache.exe ccache/cl.exe - echo "${GITHUB_WORKSPACE}/ccache" >> $GITHUB_PATH - - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: windows - - - 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@v4 - 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: Read antares-deps version - id: antares-deps-version - uses: notiz-dev/github-action-json-property@release - with: - path: 'antares-deps-version.json' - prop_path: 'antares_deps_version' - - - name: Download pre-compiled librairies - uses: ./.github/workflows/download-extract-precompiled-libraries-zip - with: - antares-deps-version: ${{steps.antares-deps-version.outputs.prop}} - os: ${{env.os}} - ortools-url: ${{env.ORTOOLS_URL}} - ortools-dir: ${{env.ORTOOLS_DIR}} - - - name: Setup Python 3.12 - uses: actions/setup-python@v5 - 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: Init submodule - run: | - git submodule update --init src/antares-deps - git submodule update --init --remote src/tests/resources/Antares_Simulator_Tests - - - name: Enable git longpaths - run: git config --system core.longpaths true - - - name: Configure - shell: bash - run: | - cmake -B _build -S src \ - -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ - -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 \ - -DBUILD_not_system=OFF \ - -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) - # simtest - - name: Read simtest version - id: simtest-version - uses: notiz-dev/github-action-json-property@release - with: - path: 'simtest.json' - prop_path: 'version' - - - name: Run named mps tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-named-mps - os: ${{ env.test-platform }} - variant: "named-mps" - - - name: Run unfeasibility-related tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - run: | - cd _build - ctest -C Release --output-on-failure -R "^unfeasible$" - - - name: Run unit and end-to-end tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - 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@v4 - with: - name: MPS-diff - path: ${{ github.workspace }}/src/tests/mps - - - name: Run tests for adequacy patch (CSR) - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: adequacy-patch-CSR - os: ${{ env.test-platform }} - - - name: Run tests about infinity on BCs RHS - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-v830 - os: ${{ env.test-platform }} - - - name: Run MILP with CBC - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-milp - variant: "milp-cbc" - os: ${{ env.test-platform }} - - - name: Run tests introduced in v860 - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-v860 - os: ${{ env.test-platform }} - - - name: Run short-tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: short-tests - os: ${{ env.test-platform }} - - - name: Run mps tests - if: ${{ env.RUN_SIMPLE_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-mps - os: ${{ env.test-platform }} - - - name: Run parallel tests - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: valid-parallel - os: ${{ env.test-platform }} - variant: "parallel" - - - name: Run medium-tests - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: medium-tests - os: ${{ env.test-platform }} - - - name: Run long-tests-1 - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: long-tests-1 - os: ${{ env.test-platform }} - - - name: Run long-tests-2 - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: long-tests-2 - os: ${{ env.test-platform }} - - - name: Run long-tests-3 - if: ${{ env.RUN_EXTENDED_TESTS == 'true' }} - uses: ./.github/workflows/run-tests - with: - simtest-tag: ${{steps.simtest-version.outputs.prop}} - batch-name: long-tests-3 - os: ${{ env.test-platform }} - - - name: Solver archive creation - shell: bash - run: | - cd _build - zip -r antares-solver_windows.zip solver/Release/antares-solver.exe solver/Release/*.dll - - - name: NSIS Installer creation - shell: bash - run: | - rm -rf src/tests/resources/Antares_Simulator_Tests - 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@v4 - with: - name: NSISError.log - path: _build/_CPack_Packages/win64/NSIS/NSISOutput.log - - - name: .zip creation - run: | - cd _build - cpack -G ZIP - - - name: Installer upload - uses: actions/upload-artifact@v4 - 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: Cache vcpkg binary dir - if: always() - id: save-cache-vcpkg-binary - uses: actions/cache/save@v4 - with: - path: ${{ github.workspace }}/vcpkg_cache - key: vcpkg-cache-windows-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} + - name : Init VCPKG submodule + run: | + git submodule update --init vcpkg + + # Restore both vcpkg and its artifacts from the GitHub cache service. + - name: Restore vcpkg and its artifacts. + uses: actions/cache@v3 + with: + # The first path is the location of vcpkg (it contains the vcpkg executable and data files). + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + path: | + ${{ env.VCPKG_ROOT }} + !${{ env.VCPKG_ROOT }}/buildtrees + !${{ env.VCPKG_ROOT }}/packages + !${{ env.VCPKG_ROOT }}/downloads + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). + key: | + ${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }} + + - name : Install deps with VCPKG + run: | + cd vcpkg + ./bootstrap-vcpkg.sh + vcpkg install ${{matrix.vcpkgPackages}} --triplet ${{matrix.triplet}} + rm -rf buildtrees packages downloads + shell: bash + + - name: Read antares-deps version + id: antares-deps-version + uses: notiz-dev/github-action-json-property@release + with: + path: 'antares-deps-version.json' + prop_path: 'antares_deps_version' + + - name: Download pre-compiled librairies + uses: ./.github/workflows/download-extract-precompiled-libraries-zip + with: + antares-deps-version: ${{steps.antares-deps-version.outputs.prop}} + os: ${{matrix.os}} + ortools-url: ${{env.ORTOOLS_URL}} + ortools-dir: ${{env.ORTOOLS_DIR}} + + - name: Setup Python 3.12 + uses: actions/setup-python@v4 + with: + architecture: 'x64' + python-version: '3.12' + + - name: Install pip dependencies if necessary + run: pip install -r src/tests/examples/requirements.txt + + - name: Init submodule + run: | + git submodule update --init --recursive src + + - name: Enable git longpaths + run: git config --system core.longpaths true + + - name: Configure + shell: bash + run: | + cmake -B _build -S src \ + -DDEPS_INSTALL_DIR=rte-antares-deps-Release \ + -DCMAKE_PREFIX_PATH="${{ env.ORTOOLS_DIR }}/install" \ + -DVCPKG_ROOT="${{env.VCPKG_ROOT}}" \ + -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_TESTING=ON \ + -DBUILD_not_system=OFF + + - name: Build + shell: bash + run: | + cmake --build _build --config Release -j2 + + - name: Run unfeasibility-related tests + run: | + cd _build + ctest -C Release --output-on-failure -R unfeasible + + - name: Run unit and end-to-end tests + run: | + cd _build + ctest -C ${{ matrix.buildtype }} --output-on-failure -L "unit|end-to-end" -LE ortools + + - name: Upload build on failure + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: MPS-diff + path: ${{ github.workspace }}/src/tests/mps + + # simtest + - name: Read simtest version + id: simtest-version + uses: notiz-dev/github-action-json-property@release + with: + path: 'simtest.json' + prop_path: 'version' + + - name: Run tests for adequacy patch (CSR) + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: adequacy-patch-CSR + os: ${{ matrix.test-platform }} + + - name: Run tests about infinity on BCs RHS + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-v830 + os: ${{ matrix.test-platform }} + + - name: Run short-tests + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: short-tests + os: ${{ matrix.test-platform }} + + - name: Run mps tests + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{steps.simtest-version.outputs.prop}} + batch-name: valid-mps + os: ${{ matrix.test-platform }} + + - name: Solver archive creation + shell: bash + run: | + cd _build + zip -r antares-solver_windows.zip solver/Release/antares-*-solver.exe solver/Release/*.dll + + - name: NSIS Installer creation + shell: bash + run: | + rm -rf src/tests/resources/Antares_Simulator_Tests + rm -rf src/tests/resources/NonRegTests + 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@v3 + with: + name: NSISError.log + path: _build/_CPack_Packages/win64/NSIS/NSISOutput.log + + - name: .zip creation + run: | + cd _build + cpack -G ZIP + + - name: Installer upload + uses: actions/upload-artifact@v3 + with: + path: _build/${{env.NSIS_NAME}} + + - name: Archive upload + uses: actions/upload-artifact@v3 + with: + path: _build/*.zip diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 966bb95c6e..17cb3478a9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,11 +4,6 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable set(ANTARES_VERSION_HI 8) set(ANTARES_VERSION_LO 6) set(ANTARES_VERSION_REVISION 8) - -# Beta release -set(ANTARES_BETA 0) -set(ANTARES_RC 0) - set(ANTARES_VERSION_YEAR 2024) project(antares @@ -18,6 +13,9 @@ set(ANTARES_PUBLISHER "RTE France") set(ANTARES_WEBSITE "https://antares-simulator.org/") set(ANTARES_ONLINE_DOC "https://antares-simulator.readthedocs.io/") +# Beta release +set(ANTARES_BETA 0) +set(ANTARES_RC 0) # OR-Tools tag file(READ "../ortools_tag" ORTOOLS_TAG) @@ -35,7 +33,7 @@ include(CheckCXXCompilerFlag) include(CMakeDependentOption) include(FetchContent) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 17) if (DEFINED VCPKG_ROOT) include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) @@ -176,25 +174,11 @@ endif () option(BUILD_UI "Build antares ui simulator" ON) message(STATUS "Build antares ui simulator: ${BUILD_UI}") -option(BUILD_TOOLS "Build antares tools" OFF) -message(STATUS "Build antares tools: ${BUILD_TOOLS}") - option(BUILD_ORTOOLS "Build OR-Tools" OFF) -message(STATUS "Build OR-Tools: ${BUILD_ORTOOLS}") +message(STATUS "Build OR-Tools ${BUILD_ORTOOLS}") option(BUILD_MINIZIP "Build minizip" OFF) -message(STATUS "Build minizip: ${BUILD_MINIZIP}") - -option(WITH_ANTLR4 "With antlr4" OFF) -message(STATUS "With antlr4: ${WITH_ANTLR4}") - -option(WITH_YAMLCPP "With yaml-cpp" OFF) -message(STATUS "With yaml-cpp: ${WITH_YAMLCPP}") - -option(BUILD_MERSENNE_TWISTER_PYBIND11 "Build pybind11 bindings for Mersenne-Twister" OFF) -if (${BUILD_MERSENNE_TWISTER_PYBIND11}) - find_package(pybind11 REQUIRED) -endif() +message(STATUS "Build minizip ${BUILD_MINIZIP}") #Define install directory if (NOT DEPS_INSTALL_DIR) @@ -235,9 +219,6 @@ add_subdirectory(antares-deps) #Add needed definition in case of external dependencies compilation include (antares-deps/cmake/additionnal-definitions.cmake) -#Boost header libraries -find_package(Boost REQUIRED) - #TODO : Add ZLIB if VCPKG used why is this needed if (VCPKG_TOOLCHAIN) #zlib @@ -260,7 +241,11 @@ if (NOT sirius_solver_FOUND) message (FATAL_ERROR "Sirius solver not found. Sirius solver can be compiled with -DBUILD_sirius=ON or you can specify previous dependency install directory with -DCMAKE_PREFIX_PATH or -DDEPS_INSTALL_DIR") endif() -find_package(ortools) +#gflags needed for ortools +set(GFLAGS_USE_TARGET_NAMESPACE TRUE) +find_package(gflags) + +find_package(ortools QUIET) if(NOT ortools_FOUND OR BUILD_ORTOOLS) message(STATUS "OR-Tools tag ${ORTOOLS_TAG}") FetchContent_Declare(ortools @@ -286,18 +271,27 @@ message(STATUS "OR-Tools tag ${ORTOOLS_TAG}") FetchContent_MakeAvailable(ortools) endif() -find_package(minizip-ng) -if (minizip-ng_FOUND) - add_library(MINIZIP::minizip ALIAS MINIZIP::minizip-ng) -else () - find_package(minizip) - if (minizip_FOUND) - message (STATUS "Found minizip (not minizip-ng).") - else () - message (FATAL_ERROR "Minizip not found.") - endif () -endif () - +find_package(minizip) + +if(NOT minizip_FOUND OR BUILD_MINIZIP) + # Repository + tag + set(MZ_REPOSITORY "https://github.com/zlib-ng/minizip-ng.git") + set(MZ_TAG "3.0.7") + # CMake flags + set(MZ_LZMA "OFF" CACHE INTERNAL "") + set(MZ_ZSTD "OFF" CACHE INTERNAL "") + set(MZ_BZIP2 "OFF" CACHE INTERNAL "") + set(MZ_PKCRYPT "OFF" CACHE INTERNAL "") + set(MZ_WZAES "OFF" CACHE INTERNAL "") + set(MZ_OPENSSL "OFF" CACHE INTERNAL "") + set(MZ_ICONV "OFF" CACHE INTERNAL "") + + FetchContent_Declare(minizip + GIT_REPOSITORY ${MZ_REPOSITORY} + GIT_TAG ${MZ_TAG}) + + FetchContent_MakeAvailable(minizip) +endif() #wxWidget not needed for all library find is done in ui CMakeLists.txt if (VCPKG_TOOLCHAIN AND NOT BUILD_wxWidgets) @@ -329,9 +323,7 @@ add_subdirectory(solver) #antares solver and all associated libs add_subdirectory(analyzer) #antares analyser # Tools -if (BUILD_TOOLS) add_subdirectory(tools) #All antares tools -endif() # Tests # Not setting BUILD_TESTING as a command line argument is equivalent to use -DBUILD_TESTING=OFF @@ -433,7 +425,7 @@ else() set(CPACK_PACKAGE_VERSION_MINOR ${ANTARES_VERSION_LO}) set(CPACK_PACKAGE_VERSION_PATCH ${ANTARES_VERSION_REVISION}${ANTARES_VERSION_TAG}) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-gtk3-0v5 | libwxgtk3.2-dev") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.0-gtk3-0v5") set(CPACK_RPM_PACKAGE_REQUIRES "wxGTK3") set(CPACK_RPM_PACKAGE_AUTOREQPROV "0") @@ -444,3 +436,4 @@ endif() # Load packaging facilities. include(CPack) + diff --git a/src/solver/writer/zip_writer.cpp b/src/solver/writer/zip_writer.cpp index 21844cbc12..b2bd427fb1 100644 --- a/src/solver/writer/zip_writer.cpp +++ b/src/solver/writer/zip_writer.cpp @@ -83,7 +83,7 @@ ZipWriter::ZipWriter(std::shared_ptr qs, pArchivePath(std::string(archivePath) + ".zip"), pDurationCollector(duration_collector) { - pZipHandle = mz_zip_writer_create(); + mz_zip_writer_create(&pZipHandle); if (int32_t ret = mz_zip_writer_open_file(pZipHandle, pArchivePath.c_str(), 0, 0); ret != MZ_OK) { logs.error() << "Error opening zip file " << pArchivePath << " (" << ret << ")"; diff --git a/src/vcpkg.json b/src/vcpkg.json deleted file mode 100644 index 84556390b3..0000000000 --- a/src/vcpkg.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "antares-simulator", - "version-string": "8.6.8", - "builtin-baseline": "9484a57dd560b89f0a583be08af6753611c57fd5", - "vcpkg-configuration": { - "overlay-triplets": [ - "./triplets" - ] - }, - "dependencies": [ - { - "name": "wxwidgets", - "platform": "windows" - }, - { - "name": "boost-test", - "version>=": "1.81.0" - }, - { - "name": "boost-algorithm", - "version>=": "1.81.0" - }, - { - "name": "minizip-ng", - "default-features": false, - "version>=": "4.0.0", - "features": [ - "zlib" - ] - } - ] -} From 27ed6b5afb13ccff3271b782fd1fd10990d658d3 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Fri, 28 Jun 2024 16:03:55 +0200 Subject: [PATCH 15/15] update vcpkg --- vcpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg b/vcpkg index 9d47b24eac..e3ad383ceb 160000 --- a/vcpkg +++ b/vcpkg @@ -1 +1 @@ -Subproject commit 9d47b24eacbd1cd94f139457ef6cd35e5d92cc84 +Subproject commit e3ad383ceb886677eb181e16adeeb4d4a2c2d4c4