minpack archive on Windows #26
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Archive on Windows | |
| run-name: minpack archive on Windows | |
| on: | |
| push: | |
| paths-ignore: | |
| - "**/*.md" | |
| - "doc/**" | |
| pull_request: | |
| paths-ignore: | |
| - "**/*.md" | |
| - "doc/**" | |
| jobs: | |
| source-archive: | |
| name: Source Archive | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| USE_DOWNLOAD: ['OFF'] | |
| BUILD_SHARED_LIBS: ['ON', 'OFF'] | |
| BUILD_STATIC_LIBS: ['ON', 'OFF'] | |
| TOOLCHAIN: | |
| - { COMPILER: 'intel', VERSION: '2025.0', CMAKE_GENERATOR: 'NMake Makefiles' } | |
| - { COMPILER: 'flang', VERSION: '', CMAKE_GENERATOR: 'Ninja' } | |
| USE_SOURCE_ARCHIVE_SUFFIX: ['ON', 'OFF'] | |
| SOURCE_ARCHIVE: | |
| - { format: 'zip', ext: ".zip" } | |
| - { format: 'tar-gz', ext: ".tar.gz" } | |
| - { format: 'tar-bz2', ext: ".tar.bz2" } | |
| - { format: 'tar-xz', ext: ".tar.xz" } | |
| exclude: | |
| - BUILD_SHARED_LIBS: 'ON' | |
| BUILD_STATIC_LIBS: 'ON' | |
| - BUILD_SHARED_LIBS: 'OFF' | |
| BUILD_STATIC_LIBS: 'OFF' | |
| env: | |
| MINPACK_BUILDER_VERSION: 1.2.0 | |
| steps: | |
| - name: Set environment variables for archive and archive directory | |
| run: | | |
| if ("${{ matrix.USE_SOURCE_ARCHIVE_SUFFIX }}" -eq "ON") | |
| { | |
| Add-Content $env:GITHUB_ENV "SOURCE_ARCHIVE_SUFFIX=-win64-${{ matrix.TOOLCHAIN.COMPILER }}"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE=minpack-${{ env.MINPACK_BUILDER_VERSION }}-sources-win64-${{ matrix.TOOLCHAIN.COMPILER }}${{ matrix.SOURCE_ARCHIVE.ext }}"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE_DIR=minpack-${{ env.MINPACK_BUILDER_VERSION }}-sources-win64-${{ matrix.TOOLCHAIN.COMPILER }}"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE_MD5=minpack-${{ env.MINPACK_BUILDER_VERSION }}-sources-win64-${{ matrix.TOOLCHAIN.COMPILER }}${{ matrix.SOURCE_ARCHIVE.ext }}-MD5.txt"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE_SHA256=minpack-${{ env.MINPACK_BUILDER_VERSION }}-sources-win64-${{ matrix.TOOLCHAIN.COMPILER }}${{ matrix.SOURCE_ARCHIVE.ext }}-SHA256.txt"; | |
| } | |
| else | |
| { | |
| Add-Content $env:GITHUB_ENV "ARCHIVE=minpack-${{ env.MINPACK_BUILDER_VERSION }}-sources${{ matrix.SOURCE_ARCHIVE.ext }}"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE_DIR=minpack-${{ env.MINPACK_BUILDER_VERSION }}-sources"; | |
| } | |
| - name: Restore assets | |
| id: restore-assets | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: assets-cache | |
| key: minpack-assets | |
| enableCrossOsArchive: true | |
| - name: Checkout assets | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| if: ${{ matrix.USE_DOWNLOAD=='OFF' && steps.restore-assets.outputs.cache-hit != 'true' }} | |
| with: | |
| ref: assets-ci-v1 | |
| path: assets | |
| - name: Place minpack sources in the cache directory | |
| if: ${{ matrix.USE_DOWNLOAD=='OFF' && steps.restore-assets.outputs.cache-hit != 'true' }} | |
| shell: pwsh | |
| run: | | |
| New-Item "assets-cache" -ItemType Directory | Out-Null; | |
| foreach ($current_file in "disclaimer", "chkder.f", "dogleg.f", "dpmpar.f", "enorm.f", "fdjac1.f", "fdjac2.f", "hybrd1.f", "hybrd.f", "hybrj1.f", "hybrj.f", "lmder1.f", "lmder.f", "lmdif1.f", "lmdif.f", "lmpar.f", "lmstr1.f", "lmstr.f", "qform.f", "qrfac.f", "qrsolv.f", "r1mpyq.f", "r1updt.f", "rwupdt.f") | |
| { | |
| $filePath = Join-Path -Path "assets" -ChildPath $current_file; | |
| Copy-Item -Path $filePath -Destination "assets-cache"; | |
| } | |
| - name: Save assets | |
| if: ${{ matrix.USE_DOWNLOAD=='OFF' && steps.restore-assets.outputs.cache-hit != 'true' }} | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: assets-cache | |
| key: minpack-assets | |
| enableCrossOsArchive: true | |
| - name: Checkout repository to minpack-builder directory | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| path: minpack-builder | |
| - name: Place minpack sources in the correct directory for minpack-builder | |
| if: ${{ matrix.USE_DOWNLOAD=='OFF' }} | |
| shell: pwsh | |
| run: | | |
| foreach ($current_file in "disclaimer", "chkder.f", "dogleg.f", "dpmpar.f", "enorm.f", "fdjac1.f", "fdjac2.f", "hybrd1.f", "hybrd.f", "hybrj1.f", "hybrj.f", "lmder1.f", "lmder.f", "lmdif1.f", "lmdif.f", "lmpar.f", "lmstr1.f", "lmstr.f", "qform.f", "qrfac.f", "qrsolv.f", "r1mpyq.f", "r1updt.f", "rwupdt.f") | |
| { | |
| $filePath = Join-Path -Path "assets-cache" -ChildPath $current_file; | |
| Copy-Item -Path $filePath -Destination "minpack-builder"; | |
| } | |
| - name: Setup MSVC | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' }} | |
| uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
| - name: Restore conda environment | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' }} | |
| id: restore-conda-env | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: minpack-builder-environment | |
| key: flang | |
| - name: Create conda environment | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' && steps.restore-conda-env.outputs.cache-hit != 'true' }} | |
| run: | | |
| & "$env:CONDA\shell\condabin\conda-hook.ps1"; | |
| conda create --yes -c conda-forge -p minpack-builder-environment ninja flang_win-64 flang-rt_win-64; | |
| - name: Save conda environment | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' && steps.restore-conda-env.outputs.cache-hit != 'true' }} | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: minpack-builder-environment | |
| key: flang | |
| - name: Setup conda environment and set FC, CC and CXX environment variables. | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' }} | |
| run: | | |
| & "$env:CONDA\shell\condabin\conda-hook.ps1"; | |
| conda activate "${{ github.workspace }}\minpack-builder-environment"; | |
| Get-ChildItem env: | Where-Object { $_.Name.ToLower().Contains("conda") -or $_.Value.ToLower().Contains("conda") } | ForEach-Object { Add-Content $env:GITHUB_ENV ($_.Name + "=" + $_.Value); } | |
| Add-Content $env:GITHUB_ENV "FC=flang"; | |
| Add-Content $env:GITHUB_ENV "CC=cl"; | |
| Add-Content $env:GITHUB_ENV "CXX=cl"; | |
| - uses: fortran-lang/setup-fortran@47809fdb6e637da656ce9ada436527b240c1287f # v1.8.1 | |
| name: Setup Fortran and C compilers | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='intel' }} | |
| id: setup-fortran | |
| with: | |
| compiler: ${{ matrix.TOOLCHAIN.COMPILER }} | |
| version: ${{ matrix.TOOLCHAIN.VERSION }} | |
| - name: Set MSVC cl as C, C++ compiler | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='intel' }} | |
| run: | | |
| Add-Content $env:GITHUB_ENV "CC=cl" | |
| Add-Content $env:GITHUB_ENV "CXX=cl" | |
| - name: Set environment variables to build and install directories | |
| run: | | |
| Add-Content $env:GITHUB_ENV "BUILDDIR=$env:RUNNER_TEMP\build" | |
| Add-Content $env:GITHUB_ENV "INSTALLDIR=$env:RUNNER_TEMP\install-${{ matrix.TOOLCHAIN.COMPILER }}" | |
| - name: Configure the build of minpack (with source archive suffix) | |
| if: ${{ matrix.USE_SOURCE_ARCHIVE_SUFFIX=='ON' }} | |
| run: cmake -G "${{ matrix.TOOLCHAIN.CMAKE_GENERATOR }}" "-DSOURCE_ARCHIVE_SUFFIX=$env:SOURCE_ARCHIVE_SUFFIX" -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} -DBUILD_STATIC_LIBS=${{ matrix.BUILD_STATIC_LIBS }} -DCMAKE_BUILD_TYPE=Release -DUSE_DOWNLOAD=${{ matrix.USE_DOWNLOAD }} --install-prefix $env:INSTALLDIR -S minpack-builder -B $env:BUILDDIR | |
| - name: Configure the build of minpack (without source archive suffix) | |
| if: ${{ matrix.USE_SOURCE_ARCHIVE_SUFFIX=='OFF' }} | |
| run: cmake -G "${{ matrix.TOOLCHAIN.CMAKE_GENERATOR }}" -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} -DBUILD_STATIC_LIBS=${{ matrix.BUILD_STATIC_LIBS }} -DCMAKE_BUILD_TYPE=Release -DUSE_DOWNLOAD=${{ matrix.USE_DOWNLOAD }} --install-prefix $env:INSTALLDIR -S minpack-builder -B $env:BUILDDIR | |
| - name: Create a Source Arhive | |
| run: | | |
| cmake --build $env:BUILDDIR --config Release --target source-${{ matrix.SOURCE_ARCHIVE.format }}; | |
| dir $env:BUILDDIR; | |
| - name: Extract the Source Zip Archive | |
| if: ${{ matrix.SOURCE_ARCHIVE.format=='zip' }} | |
| run: | | |
| Expand-Archive $env:BUILDDIR\$env:ARCHIVE -DestinationPath (Get-Location); | |
| - name: Extract the Source Archive | |
| if: ${{ matrix.SOURCE_ARCHIVE.format!='zip' }} | |
| run: | | |
| & "C:\Program Files\7-Zip\7z.exe" x $env:BUILDDIR\$env:ARCHIVE; | |
| & "C:\Program Files\7-Zip\7z.exe" x ((Get-Item $env:BUILDDIR\$env:ARCHIVE).BaseName); | |
| - name: Download minpack sources to extracted source archive | |
| if: ${{ matrix.USE_DOWNLOAD=='OFF' }} | |
| run: foreach ($current_file in "disclaimer", "chkder.f", "dogleg.f", "dpmpar.f", "enorm.f", "fdjac1.f", "fdjac2.f", "hybrd1.f", "hybrd.f", "hybrj1.f", "hybrj.f", "lmder1.f", "lmder.f", "lmdif1.f", "lmdif.f", "lmpar.f", "lmstr1.f", "lmstr.f", "qform.f", "qrfac.f", "qrsolv.f", "r1mpyq.f", "r1updt.f", "rwupdt.f") { Copy-Item "assets\$current_file" $env:ARCHIVE_DIR; } | |
| - name: Set environment variables to build and install directories | |
| run: | | |
| Add-Content $env:GITHUB_ENV "BUILDDIR_SOURCE_ARCHIVE=$env:RUNNER_TEMP\source-archive-build" | |
| Add-Content $env:GITHUB_ENV "INSTALLDIR_SOURCE_ARCHIVE=$env:RUNNER_TEMP\source-archive-install-${{ matrix.TOOLCHAIN.COMPILER }}" | |
| - name: Configure the build of minpack (with source archive suffix) | |
| if: ${{ matrix.USE_SOURCE_ARCHIVE_SUFFIX=='ON' }} | |
| run: cmake -G "${{ matrix.TOOLCHAIN.CMAKE_GENERATOR }}" "-DSOURCE_ARCHIVE_SUFFIX=$env:SOURCE_ARCHIVE_SUFFIX" -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} -DBUILD_STATIC_LIBS=${{ matrix.BUILD_STATIC_LIBS }} -DCMAKE_BUILD_TYPE=Release -DUSE_DOWNLOAD=${{ matrix.USE_DOWNLOAD }} --install-prefix $env:INSTALLDIR_SOURCE_ARCHIVE -S $env:ARCHIVE_DIR -B $env:BUILDDIR_SOURCE_ARCHIVE | |
| - name: Configure the build of minpack (without source archive suffix) | |
| if: ${{ matrix.USE_SOURCE_ARCHIVE_SUFFIX=='OFF' }} | |
| run: cmake -G "${{ matrix.TOOLCHAIN.CMAKE_GENERATOR }}" -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} -DBUILD_STATIC_LIBS=${{ matrix.BUILD_STATIC_LIBS }} -DCMAKE_BUILD_TYPE=Release -DUSE_DOWNLOAD=${{ matrix.USE_DOWNLOAD }} --install-prefix $env:INSTALLDIR_SOURCE_ARCHIVE -S $env:ARCHIVE_DIR -B $env:BUILDDIR_SOURCE_ARCHIVE | |
| - name: Build from extracted source archive | |
| run: cmake --build $env:BUILDDIR_SOURCE_ARCHIVE --config Release | |
| - name: Install from extracted source archive | |
| run: cmake --install $env:BUILDDIR_SOURCE_ARCHIVE --config Release | |
| - name: Create Source Archive again | |
| run: | | |
| cmake --build $env:BUILDDIR_SOURCE_ARCHIVE --config Release --target source-${{ matrix.SOURCE_ARCHIVE.format }}; | |
| dir $env:BUILDDIR_SOURCE_ARCHIVE; | |
| - name: Extract the Source Zip Archives again | |
| if: ${{ matrix.SOURCE_ARCHIVE.format=='zip' }} | |
| run: | | |
| mkdir comparison-dir; | |
| Expand-Archive $env:BUILDDIR\$env:ARCHIVE -DestinationPath comparison-dir; | |
| mkdir comparison-dir-source-archive; | |
| Expand-Archive $env:BUILDDIR_SOURCE_ARCHIVE\$env:ARCHIVE -DestinationPath comparison-dir-source-archive; | |
| - name: Extract the Source Archives again | |
| if: ${{ matrix.SOURCE_ARCHIVE.format!='zip' }} | |
| run: | | |
| mkdir comparison-dir; | |
| & "C:\Program Files\7-Zip\7z.exe" x $env:BUILDDIR\$env:ARCHIVE -ocomparison-dir; | |
| $basename_first = (Get-Item $env:BUILDDIR\$env:ARCHIVE).BaseName; | |
| & "C:\Program Files\7-Zip\7z.exe" x (Join-Path -Path comparison-dir -ChildPath $basename_first) -ocomparison-dir; | |
| mkdir comparison-dir-source-archive; | |
| & "C:\Program Files\7-Zip\7z.exe" x $env:BUILDDIR_SOURCE_ARCHIVE\$env:ARCHIVE -ocomparison-dir-source-archive; | |
| $basename_second = (Get-Item $env:BUILDDIR_SOURCE_ARCHIVE\$env:ARCHIVE).BaseName; | |
| & "C:\Program Files\7-Zip\7z.exe" x (Join-Path -Path comparison-dir-source-archive -ChildPath $basename_second) -ocomparison-dir-source-archive; | |
| # a reliable manner to compare | |
| # compressed files | |
| # is extracting them | |
| # and compare file-by-file | |
| - name: Compare the content of the compressed files for equality | |
| run: | | |
| $first_archive_fullname = (Get-Item (Join-Path -Path comparison-dir -ChildPath $env:ARCHIVE_DIR)).FullName; | |
| $first_archive_fullname_length = $first_archive_fullname.Length; | |
| $first_archive_file_suffixes = Get-ChildItem -File $first_archive_fullname -Recurse | Select-Object @{ Label = "Suffix"; Expression = { $_.FullName.Substring($first_archive_fullname_length) } }; | |
| $first_archive_hashes = New-Object System.Collections.Generic.HashSet[string]; | |
| foreach ($file in $first_archive_file_suffixes) | |
| { | |
| $file_suffix = $file.Suffix.ToString(); | |
| $file_path = Join-Path -Path $first_archive_fullname -ChildPath $file_suffix; | |
| $file_hash_SHA256 = (Get-FileHash $file_path -Algorithm SHA256).Hash; | |
| $file_hash_MD5 = (Get-FileHash $file_path -Algorithm MD5).Hash; | |
| $added = $first_archive_hashes.Add("suffix: ${file_suffix}; SHA256: ${file_hash_SHA256}; MD5: ${file_hash_MD5}"); | |
| } | |
| $second_archive_fullname = (Get-Item (Join-Path -Path comparison-dir-source-archive -ChildPath $env:ARCHIVE_DIR)).FullName; | |
| $second_archive_fullname_length = $second_archive_fullname.Length; | |
| $second_archive_file_suffixes = Get-ChildItem -File $second_archive_fullname -Recurse | Select-Object @{ Label = "Suffix"; Expression = { $_.FullName.Substring($second_archive_fullname_length) } }; | |
| $second_archive_hashes = New-Object System.Collections.Generic.HashSet[string]; | |
| foreach ($file in $second_archive_file_suffixes) | |
| { | |
| $file_suffix = $file.Suffix.ToString(); | |
| $file_path = Join-Path -Path $second_archive_fullname -ChildPath $file_suffix; | |
| $file_hash_SHA256 = (Get-FileHash $file_path -Algorithm SHA256).Hash; | |
| $file_hash_MD5 = (Get-FileHash $file_path -Algorithm MD5).Hash; | |
| $added = $second_archive_hashes.Add("suffix: ${file_suffix}; SHA256: ${file_hash_SHA256}; MD5: ${file_hash_MD5}"); | |
| } | |
| foreach ($hash in $first_archive_hashes) | |
| { | |
| if (-not $second_archive_hashes.Contains($hash)) | |
| { | |
| Write-Host "Entry not found in the second archive: ${hash}"; | |
| exit 1; | |
| } | |
| } | |
| foreach ($hash in $second_archive_hashes) | |
| { | |
| if (-not $first_archive_hashes.Contains($hash)) | |
| { | |
| Write-Host "Entry not found in the first archive: ${hash}"; | |
| exit 1; | |
| } | |
| } | |
| binary-archive: | |
| name: Binary Archive | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| USE_DOWNLOAD: ['OFF'] | |
| BUILD_SHARED_LIBS: ['ON', 'OFF'] | |
| BUILD_STATIC_LIBS: ['ON', 'OFF'] | |
| TOOLCHAIN: | |
| - { COMPILER: 'intel', VERSION: '2025.0', CMAKE_GENERATOR: 'NMake Makefiles' } | |
| - { COMPILER: 'flang', VERSION: '', CMAKE_GENERATOR: 'Ninja' } | |
| USE_BINARY_ARCHIVE_SUFFIX: ['ON', 'OFF'] | |
| BINARY_ARCHIVE: | |
| - { format: 'zip', ext: ".zip" } | |
| - { format: 'tar-gz', ext: ".tar.gz" } | |
| - { format: 'tar-bz2', ext: ".tar.bz2" } | |
| - { format: 'tar-xz', ext: ".tar.xz" } | |
| exclude: | |
| - BUILD_SHARED_LIBS: 'ON' | |
| BUILD_STATIC_LIBS: 'ON' | |
| - BUILD_SHARED_LIBS: 'OFF' | |
| BUILD_STATIC_LIBS: 'OFF' | |
| env: | |
| MINPACK_BUILDER_VERSION: 1.2.0 | |
| steps: | |
| - name: Set environment variables for archive and archive directory | |
| run: | | |
| if ("${{ matrix.USE_BINARY_ARCHIVE_SUFFIX }}" -eq "ON") | |
| { | |
| Add-Content $env:GITHUB_ENV "BINARY_ARCHIVE_SUFFIX=-win64-${{ matrix.TOOLCHAIN.COMPILER }}"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE=minpack-${{ env.MINPACK_BUILDER_VERSION }}-binaries-win64-${{ matrix.TOOLCHAIN.COMPILER }}${{ matrix.BINARY_ARCHIVE.ext }}"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE_DIR=minpack-${{ env.MINPACK_BUILDER_VERSION }}-binaries-win64-${{ matrix.TOOLCHAIN.COMPILER }}"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE_MD5=minpack-${{ env.MINPACK_BUILDER_VERSION }}-binaries-win64-${{ matrix.TOOLCHAIN.COMPILER }}${{ matrix.BINARY_ARCHIVE.ext }}-MD5.txt"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE_SHA256=minpack-${{ env.MINPACK_BUILDER_VERSION }}-binaries-win64-${{ matrix.TOOLCHAIN.COMPILER }}${{ matrix.BINARY_ARCHIVE.ext }}-SHA256.txt"; | |
| } | |
| else | |
| { | |
| Add-Content $env:GITHUB_ENV "ARCHIVE=minpack-${{ env.MINPACK_BUILDER_VERSION }}-binaries${{ matrix.BINARY_ARCHIVE.ext }}"; | |
| Add-Content $env:GITHUB_ENV "ARCHIVE_DIR=minpack-${{ env.MINPACK_BUILDER_VERSION }}-binaries"; | |
| } | |
| - name: Restore assets | |
| id: restore-assets | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: assets-cache | |
| key: minpack-assets | |
| enableCrossOsArchive: true | |
| - name: Checkout assets | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| if: ${{ matrix.USE_DOWNLOAD=='OFF' && steps.restore-assets.outputs.cache-hit != 'true' }} | |
| with: | |
| ref: assets-ci-v1 | |
| path: assets | |
| - name: Place minpack sources in the cache directory | |
| if: ${{ matrix.USE_DOWNLOAD=='OFF' && steps.restore-assets.outputs.cache-hit != 'true' }} | |
| run: | | |
| New-Item "assets-cache" -ItemType Directory | Out-Null; | |
| foreach ($current_file in "disclaimer", "chkder.f", "dogleg.f", "dpmpar.f", "enorm.f", "fdjac1.f", "fdjac2.f", "hybrd1.f", "hybrd.f", "hybrj1.f", "hybrj.f", "lmder1.f", "lmder.f", "lmdif1.f", "lmdif.f", "lmpar.f", "lmstr1.f", "lmstr.f", "qform.f", "qrfac.f", "qrsolv.f", "r1mpyq.f", "r1updt.f", "rwupdt.f") | |
| { | |
| $filePath = Join-Path -Path "assets" -ChildPath $current_file; | |
| Copy-Item -Path $filePath -Destination "assets-cache"; | |
| } | |
| - name: Save assets | |
| if: ${{ matrix.USE_DOWNLOAD=='OFF' && steps.restore-assets.outputs.cache-hit != 'true' }} | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: assets-cache | |
| key: minpack-assets | |
| enableCrossOsArchive: true | |
| - name: Checkout repository to minpack-builder directory | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| path: minpack-builder | |
| - name: Place minpack sources in the correct directory for minpack-builder | |
| if: ${{ matrix.USE_DOWNLOAD=='OFF' }} | |
| run: | | |
| foreach ($current_file in "disclaimer", "chkder.f", "dogleg.f", "dpmpar.f", "enorm.f", "fdjac1.f", "fdjac2.f", "hybrd1.f", "hybrd.f", "hybrj1.f", "hybrj.f", "lmder1.f", "lmder.f", "lmdif1.f", "lmdif.f", "lmpar.f", "lmstr1.f", "lmstr.f", "qform.f", "qrfac.f", "qrsolv.f", "r1mpyq.f", "r1updt.f", "rwupdt.f") | |
| { | |
| $filePath = Join-Path -Path "assets-cache" -ChildPath $current_file; | |
| Copy-Item -Path $filePath -Destination "minpack-builder"; | |
| } | |
| - name: Setup MSVC | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' }} | |
| uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 | |
| - name: Restore conda environment | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' }} | |
| id: restore-conda-env | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: minpack-builder-environment | |
| key: flang | |
| - name: Create conda environment | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' && steps.restore-conda-env.outputs.cache-hit != 'true' }} | |
| run: | | |
| & "$env:CONDA\shell\condabin\conda-hook.ps1"; | |
| conda create --yes -c conda-forge -p minpack-builder-environment ninja flang_win-64 flang-rt_win-64; | |
| - name: Save conda environment | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' && steps.restore-conda-env.outputs.cache-hit != 'true' }} | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: minpack-builder-environment | |
| key: flang | |
| - name: Setup conda environment and set FC, CC and CXX environment variables. | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='flang' }} | |
| run: | | |
| & "$env:CONDA\shell\condabin\conda-hook.ps1"; | |
| conda activate "${{ github.workspace }}\minpack-builder-environment"; | |
| Get-ChildItem env: | Where-Object { $_.Name.ToLower().Contains("conda") -or $_.Value.ToLower().Contains("conda") } | ForEach-Object { Add-Content $env:GITHUB_ENV ($_.Name + "=" + $_.Value); } | |
| Add-Content $env:GITHUB_ENV "FC=flang"; | |
| Add-Content $env:GITHUB_ENV "CC=cl"; | |
| Add-Content $env:GITHUB_ENV "CXX=cl"; | |
| - uses: fortran-lang/setup-fortran@47809fdb6e637da656ce9ada436527b240c1287f # v1.8.1 | |
| name: Setup Fortran and C compilers | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='intel' }} | |
| id: setup-fortran | |
| with: | |
| compiler: ${{ matrix.TOOLCHAIN.COMPILER }} | |
| version: ${{ matrix.TOOLCHAIN.VERSION }} | |
| - name: Set MSVC cl as C, C++ compiler | |
| if: ${{ matrix.TOOLCHAIN.COMPILER=='intel' }} | |
| run: | | |
| Add-Content $env:GITHUB_ENV "CC=cl" | |
| Add-Content $env:GITHUB_ENV "CXX=cl" | |
| - name: Set environment variables to build and install directories | |
| run: | | |
| Add-Content $env:GITHUB_ENV "BUILDDIR=$env:RUNNER_TEMP\build" | |
| Add-Content $env:GITHUB_ENV "INSTALLDIR=$env:RUNNER_TEMP\install-${{ matrix.TOOLCHAIN.COMPILER }}" | |
| - name: Configure the build of minpack (with binary archive suffix) | |
| if: ${{ matrix.USE_BINARY_ARCHIVE_SUFFIX=='ON' }} | |
| run: cmake -G "${{ matrix.TOOLCHAIN.CMAKE_GENERATOR }}" "-DBINARY_ARCHIVE_SUFFIX=$env:BINARY_ARCHIVE_SUFFIX" -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} -DBUILD_STATIC_LIBS=${{ matrix.BUILD_STATIC_LIBS }} -DCMAKE_BUILD_TYPE=Release -DUSE_DOWNLOAD=${{ matrix.USE_DOWNLOAD }} --install-prefix $env:INSTALLDIR -S minpack-builder -B $env:BUILDDIR | |
| - name: Configure the build of minpack (without binary archive suffix) | |
| if: ${{ matrix.USE_BINARY_ARCHIVE_SUFFIX=='OFF' }} | |
| run: cmake -G "${{ matrix.TOOLCHAIN.CMAKE_GENERATOR }}" -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} -DBUILD_STATIC_LIBS=${{ matrix.BUILD_STATIC_LIBS }} -DCMAKE_BUILD_TYPE=Release -DUSE_DOWNLOAD=${{ matrix.USE_DOWNLOAD }} --install-prefix $env:INSTALLDIR -S minpack-builder -B $env:BUILDDIR | |
| - name: Build | |
| run: cmake --build $env:BUILDDIR --config Release | |
| - name: Install | |
| run: cmake --install $env:BUILDDIR --config Release | |
| - name: Create a Binary Arhive | |
| run: | | |
| cmake --build $env:BUILDDIR --config Release --target binary-${{ matrix.BINARY_ARCHIVE.format }}; | |
| dir $env:BUILDDIR; |