wip #517
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows | |
on: [push, pull_request] | |
jobs: | |
build-mingw: | |
name: ${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}} | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
env: | |
CCACHE_DIR: ${{github.workspace}}/ccache | |
strategy: | |
fail-fast: true | |
matrix: | |
build_type: [Release, Debug] | |
sys: [mingw32, mingw64] | |
lib: [shared, static] | |
components: [minimal, lgpl, gpl] | |
metis: [no-metis, metis] | |
exclude: | |
# METIS is only usable if CHOLMOD is compiled | |
- components: minimal | |
metis: metis | |
include: | |
- sys: mingw32 | |
env: i686 | |
- sys: mingw64 | |
env: x86_64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Dependencies | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
install: >- | |
mingw-w64-${{matrix.env}}-ccache | |
mingw-w64-${{matrix.env}}-cmake | |
mingw-w64-${{matrix.env}}-gcc | |
mingw-w64-${{matrix.env}}-gcc-fortran | |
mingw-w64-${{matrix.env}}-intel-tbb | |
mingw-w64-${{matrix.env}}-lapack | |
mingw-w64-${{matrix.env}}-ninja | |
mingw-w64-${{matrix.env}}-openblas | |
mingw-w64-${{matrix.env}}-openmp | |
unzip | |
wget | |
- name: Setup METIS Dependencies | |
if: ${{matrix.metis == 'metis'}} | |
run: >- | |
pacman --noconfirm -S | |
mingw-w64-${{matrix.env}}-metis | |
- name: Setup Environment | |
if: ${{matrix.build_type == 'Release'}} | |
run: | | |
echo 'CFLAGS=-flto' >> ~/.bash_profile | |
echo 'CXXFLAGS=-flto' >> ~/.bash_profile | |
- name: Cache Build | |
id: cache-build | |
uses: actions/cache@v3 | |
with: | |
path: ${{env.CCACHE_DIR}} | |
key: ${{runner.os}}-${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}-ccache-${{github.run_id}} | |
restore-keys: ${{runner.os}}-${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}-ccache- | |
- name: Configure | |
run: | | |
cmake -S . -B build_${{matrix.build_type}}/ \ | |
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=ccache \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache \ | |
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=ccache \ | |
-DCMAKE_INSTALL_PREFIX:PATH=./install \ | |
-DCMAKE_REQUIRE_FIND_PACKAGE_METIS=${{matrix.metis == 'metis'}} \ | |
-DWITH_GPL=${{matrix.components == 'gpl'}} \ | |
-DWITH_LGPL=${{contains(matrix.components, 'gpl')}} \ | |
-DWITH_METIS=${{matrix.metis == 'metis'}} \ | |
-G Ninja | |
- name: Build | |
run: | | |
cmake --build build_${{matrix.build_type}}/ \ | |
--config ${{matrix.build_type}} | |
- name: Install | |
run: | | |
cmake --build build_${{matrix.build_type}}/ \ | |
--config ${{matrix.build_type}} \ | |
--target install | |
build-msvc: | |
name: ${{matrix.msvc}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}} | |
runs-on: ${{matrix.os}} | |
env: | |
CCACHE_DIR: ${{github.workspace}}/ccache | |
CL: /MP | |
defaults: | |
run: | |
shell: powershell | |
strategy: | |
fail-fast: true | |
matrix: | |
build_type: [Release, Debug] | |
msvc: [VS-16-2019, VS-17-2022] | |
sys: [mingw64] | |
lib: [shared, static] | |
components: [minimal, lgpl, gpl] | |
metis: [no-metis, metis] | |
exclude: | |
# METIS is only usable if CHOLMOD is compiled | |
- components: minimal | |
metis: metis | |
include: | |
- sys: mingw64 | |
env: x86_64 | |
system: Win64 | |
- msvc: VS-16-2019 | |
generator: "Visual Studio 16 2019" | |
os: windows-2019 | |
marker: vc16 | |
- msvc: VS-17-2022 | |
generator: "Visual Studio 17 2022" | |
os: windows-2022 | |
marker: vc17 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache METIS | |
if: matrix.metis == 'metis' | |
id: cache-metis | |
uses: actions/cache@v3 | |
with: | |
path: metis/ | |
key: ${{matrix.msvc}}-metis-5.1.0-${{matrix.build_type}}-shared | |
- name: Download METIS | |
if: matrix.metis == 'metis' && steps.cache-metis.outputs.cache-hit != 'true' | |
run: | | |
(New-Object System.Net.WebClient).DownloadFile("http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz", "metis-5.1.0.tar.gz"); | |
7z x metis-5.1.0.tar.gz; | |
7z x metis-5.1.0.tar; | |
- name: Build METIS | |
if: matrix.metis == 'metis' && steps.cache-metis.outputs.cache-hit != 'true' | |
run: | | |
Push-Location metis-5.1.0 | |
Copy-Item include -Destination build/xinclude -Recurse | |
(Get-Content CMakeLists.txt) -Replace 'add_subdirectory\("programs"\)', '' | Set-Content CMakeLists.txt | |
(Get-Content CMakeLists.txt) -Replace 'MSVC', 'FALSE' | Set-Content CMakeLists.txt | |
(Get-Content include/metis.h) -Replace '^\s*#define COMPILER_MSC.*$', '' | Set-Content include/metis.h | |
Copy-Item include/metis.h -Destination build/xinclude/ | |
(Get-Content GKlib/gk_arch.h) -Replace '#define rint.*$', '' | Set-Content GKlib/gk_arch.h | |
(Get-Content GKlib/gk_arch.h) -Replace '#define INFINITY.*$', '' | Set-Content GKlib/gk_arch.h | |
Pop-Location | |
cmake -S metis-5.1.0 -B build-metis ` | |
-A x64 ` | |
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/metis ` | |
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON ` | |
-DMETIS_INSTALL:BOOL=ON ` | |
-DSHARED=ON ` | |
-G "${{matrix.generator}}" | |
cmake --build build-metis ` | |
--config ${{matrix.build_type}} ` | |
--target install | |
- name: Setup MSYS2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
path-type: inherit | |
install: >- | |
wget | |
mingw-w64-${{matrix.env}}-ccache | |
mingw-w64-${{matrix.env}}-gcc-fortran | |
mingw-w64-${{matrix.env}}-ninja | |
- name: Cache LAPACK | |
id: cache-lapack | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{env.CCACHE_DIR}} | |
${{github.workspace}}/install | |
key: ${{matrix.msvc}}-lapack-3.11.0-${{matrix.build_type}} | |
- name: Download LAPACK | |
if: steps.cache-lapack.outputs.cache-hit != 'true' | |
shell: msys2 {0} | |
run: | | |
wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.11.tar.gz | |
tar xvf v3.11.tar.gz | |
- name: Build LAPACK | |
if: steps.cache-lapack.outputs.cache-hit != 'true' | |
shell: msys2 {0} | |
run: | | |
cmake -S lapack-3.11 -B build_lapack_${{matrix.build_type}}/ \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \ | |
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \ | |
-DCMAKE_GNUtoMS=ON \ | |
-DCMAKE_INSTALL_PREFIX=./install \ | |
-G Ninja | |
cmake --build build_lapack_${{matrix.build_type}}/ \ | |
--config ${{matrix.build_type}} \ | |
--target install | |
- name: Setup MSYS2 Environment | |
shell: msys2 {0} | |
run: | | |
echo "$(cygpath -m /${{matrix.sys}}/bin)" >> $GITHUB_PATH | |
- name: Setup Environment | |
run: | | |
echo "${{github.workspace}}/install/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "${{github.workspace}}/metis/lib" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "VERSION_SUFFIX=${{github.ref_name}}-${{matrix.marker}}-${{matrix.system}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}".replace('/', '-') | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Configure | |
run: | | |
cmake -S . -B build_${{matrix.build_type}}/ ` | |
-A x64 ` | |
-DBLAS_blas_LIBRARY=${{github.workspace}}/install/lib/libblas.lib ` | |
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} ` | |
-DCMAKE_Fortran_COMPILER= ` | |
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install-suitesparse ` | |
-DCMAKE_PREFIX_PATH=${{github.workspace}}/metis ` | |
-DCMAKE_REQUIRE_FIND_PACKAGE_METIS=${{matrix.metis == 'metis'}} ` | |
-DLAPACK_lapack_LIBRARY=${{github.workspace}}/install/lib/liblapack.lib ` | |
-DWITH_FORTRAN=OFF ` | |
-DWITH_GPL=${{matrix.components == 'gpl'}} ` | |
-DWITH_LGPL=${{contains(matrix.components, 'gpl')}} ` | |
-DWITH_METIS=${{matrix.metis == 'metis'}} ` | |
-G "${{matrix.generator}}" | |
- name: Build | |
run: | | |
cmake --build build_${{matrix.build_type}}/ ` | |
--config ${{matrix.build_type}} | |
- name: Install | |
run: | | |
cmake --build build_${{matrix.build_type}}/ ` | |
--config ${{matrix.build_type}} ` | |
--target install | |
- name: Prepare Deployment | |
run: | | |
New-Item -ItemType "directory" -Path "${{github.workspace}}/deploy" | |
Copy-Item -Path "${{github.workspace}}/install/*" -Destination "${{github.workspace}}/deploy/" -Recurse -Force | |
Copy-Item -Path "${{github.workspace}}/install-suitesparse/*" -Destination "${{github.workspace}}/deploy/" -Recurse -Force | |
- name: Prepare METIS Deployment | |
if: matrix.metis == 'metis' | |
run: | | |
Copy-Item -Path "${{github.workspace}}/metis/*" -Destination "${{github.workspace}}/deploy/" -Recurse -Force | |
- name: Generate Archive | |
run: | | |
Compress-Archive -Path "${{github.workspace}}/deploy/*" -Destination "SuiteSparse-${{env.VERSION_SUFFIX}}.zip" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: SuiteSparse-${{env.VERSION_SUFFIX}} | |
path: | | |
deploy/ | |
- name: Deploy | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') && matrix.lib == 'shared' | |
with: | |
files: | |
SuiteSparse-${{env.VERSION_SUFFIX}}.zip |