From 1719a3e605546ac00a8ca4ea3ef6817d52b8b29c Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Wed, 22 May 2024 17:18:23 -0400 Subject: [PATCH] GitHub CI: Start working on getting a Windows CI working Signed-off-by: Michael Jackson --- .github/scripts/build_windows.bat | 43 +++++++++++ .github/scripts/cache_exclude_windows.sh | 15 ++++ .github/scripts/install_windows.bat | 18 +++++ .github/workflows/windows.yml | 93 ++++++++++++++++++++++++ CMakePresets.json | 76 +++++++++++++++++++ 5 files changed, 245 insertions(+) create mode 100644 .github/scripts/build_windows.bat create mode 100755 .github/scripts/cache_exclude_windows.sh create mode 100644 .github/scripts/install_windows.bat create mode 100644 .github/workflows/windows.yml create mode 100644 CMakePresets.json diff --git a/.github/scripts/build_windows.bat b/.github/scripts/build_windows.bat new file mode 100644 index 00000000..4597ca56 --- /dev/null +++ b/.github/scripts/build_windows.bat @@ -0,0 +1,43 @@ +REM SPDX-FileCopyrightText: 2022 Intel Corporation +REM +REM SPDX-License-Identifier: MIT + +set LANGUAGE=%1 +set VS_VER=%2 +set SAMPLES_TAG=%3 + +IF "%VS_VER%"=="2017_build_tools" ( + @call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" +) ELSE ( + IF "%VS_VER%"=="2019_build_tools" ( + @call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" + ) ELSE ( + @call "C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" %VS_VER% + ) +) + +for /f "tokens=* usebackq" %%f in (`dir /b "C:\Program Files (x86)\Intel\oneAPI\compiler\" ^| findstr /V latest ^| sort`) do @set "LATEST_VERSION=%%f" +@call "C:\Program Files (x86)\Intel\oneAPI\compiler\%LATEST_VERSION%\env\vars.bat" + +git clone --depth 1 --branch %SAMPLES_TAG% https://github.com/oneapi-src/oneAPI-samples.git + +if "%LANGUAGE%" == "c++" goto cpp +if "%LANGUAGE%" == "fortran" goto fortran +if "%LANGUAGE%" == "dpc++" goto dpcpp +goto exit + + +:fortran +cd oneAPI-samples\DirectProgramming\Fortran\CombinationalLogic\openmp-primes +ifort -O2 -fpp /Qopenmp src\openmp_sample.f90 +openmp_sample.exe +set RESULT=%ERRORLEVEL% +ifx -O2 -fpp /Qopenmp src\openmp_sample.f90 +openmp_sample.exe +set /a RESULT=%RESULT%+%ERRORLEVEL% +goto exit + + + +:exit +exit /b %RESULT% diff --git a/.github/scripts/cache_exclude_windows.sh b/.github/scripts/cache_exclude_windows.sh new file mode 100755 index 00000000..ba672f29 --- /dev/null +++ b/.github/scripts/cache_exclude_windows.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT + +#shellcheck disable=SC2010 +LATEST_VERSION=$(ls -1 "C:\Program Files (x86)\Intel\oneAPI\compiler" | grep -v latest | sort | tail -1) + +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\compiler\lib\ia32_win" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\bin\intel64_ia32" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\lib\emu" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\lib\oclfpga" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\lib\ocloc" +rm -rf "C:\Program Files (x86)\Intel\oneAPI\compiler\'$LATEST_VERSION'\windows\lib\x86" diff --git a/.github/scripts/install_windows.bat b/.github/scripts/install_windows.bat new file mode 100644 index 00000000..27872b60 --- /dev/null +++ b/.github/scripts/install_windows.bat @@ -0,0 +1,18 @@ +REM SPDX-FileCopyrightText: 2022 Intel Corporation +REM +REM SPDX-License-Identifier: MIT + +set URL=%1 +set COMPONENTS=%2 + +curl.exe --output %TEMP%\webimage.exe --url %URL% --retry 5 --retry-delay 5 +start /b /wait %TEMP%\webimage.exe -s -x -f webimage_extracted --log extract.log +del %TEMP%\webimage.exe +if "%COMPONENTS%"=="" ( + webimage_extracted\bootstrapper.exe -s --action install --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=. +) else ( + webimage_extracted\bootstrapper.exe -s --action install --components=%COMPONENTS% --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 -p=NEED_VS2022_INTEGRATION=0 --log-dir=. +) +set installer_exit_code=%ERRORLEVEL% +rd /s/q "webimage_extracted" +exit /b %installer_exit_code% diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..06e9779b --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,93 @@ +name: windows + +on: + pull_request: + branches: + - develop + - master + push: + branches: + - develop + - master + +jobs: + build: + env: + VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' + WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595_offline.exe + WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/c95a3b26-fc45-496c-833b-df08b10297b9/w_HPCKit_p_2024.1.0.561_offline.exe + LINUX_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/fdc7a2bc-b7a8-47eb-8876-de6201297144/l_BaseKit_p_2024.1.0.596_offline.sh + LINUX_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7f096850-dc7b-4c35-90b5-36c12abd9eaa/l_HPCKit_p_2024.1.0.560_offline.sh + LINUX_AIKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/0414ef18-5b64-47f2-9b2e-ae94860272b9/l_AITools.2024.1.0.9.sh + MACOS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/c112cca6-12cf-4a0c-9e5e-d0d50d3b0f8b/m_RenderKit_p_2024.1.0.744_offline.dmg + WINDOWS_CPP_COMPONENTS: intel.oneapi.win.cpp-dpcpp-common + WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler + WINDOWS_DPCPP_COMPONENTS: intel.oneapi.win.cpp-dpcpp-common + LINUX_CPP_COMPONENTS: intel-oneapi-dpcpp-cpp-compiler + LINUX_FORTRAN_COMPONENTS: intel-oneapi-compiler-fortran + LINUX_DPCPP_COMPONENTS: intel-oneapi-compiler-dpcpp-cpp + LINUX_CPP_COMPONENTS_WEB: intel.oneapi.lin.dpcpp-cpp-compiler + LINUX_FORTRAN_COMPONENTS_WEB: intel.oneapi.lin.ifort-compiler + LINUX_DPCPP_COMPONENTS_WEB: intel.oneapi.lin.dpcpp-cpp-compiler + MACOS_CPP_COMPONENTS: intel.oneapi.mac.cpp-compiler + MACOS_FORTRAN_COMPONENTS: intel.oneapi.mac.ifort-compiler + CACHE_NUMBER: 6 + SAMPLES_TAG: 2024.1.0 + COMPILER_VERSION: 2024.1.0 + TBB_VERSION: 2021.12.0 + VS_VER: vs2022 + strategy: + fail-fast: false + matrix: + os: + - windows-2022 + toolset: + - v142 + - v143 + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@master + with: + repository: bluequartzsoftware/bcls + path: ./SDK/bcls + ref: refs/heads/develop + - uses: actions/checkout@master + with: + repository: bluequartzsoftware/clfortran + path: ./SDK/clfortran + ref: refs/heads/develop + + - uses: actions/checkout@v2 + - name: cache install + id: cache-install + uses: actions/cache@v2 + with: + path: | + C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat + C:\Program Files (x86)\Intel\oneAPI\compiler + key: install-${{ env.CACHE_NUMBER }}-${{ env.WINDOWS_HPCKIT_URL }}-${{ env.WINDOWS_FORTRAN_COMPONENTS }}-compiler-${{ hashFiles('**/scripts/cache_exclude_windows.sh') }} + - name: install + if: steps.cache-install.outputs.cache-hit != 'true' + run: .github/scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS + - name: Configure + run: | + cmake --preset ci-windows-${{matrix.toolset}} ${{github.workspace}} + # - name: build + # run: .github/scripts/build_windows.bat fortran $VS_VER $SAMPLES_TAG + - name: exclude unused files from cache + if: steps.cache-install.outputs.cache-hit != 'true' + shell: bash + run: .github/scripts/cache_exclude_windows.sh + + # Delete the following if you don't want to save install logs + - name: Saving install logs + if: steps.cache-install.outputs.cache-hit != 'true' + uses: actions/upload-artifact@v2 + with: + name: InstallLogs_${{ github.job }} + path: | + extract.log + bootstrapper* + installer* + retention-days: 7 diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..451e1d88 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,76 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 26, + "patch": 0 + }, + "configurePresets": [ + { + "name": "ci", + "displayName": "CI build", + "description": "Build configuration for GitHub Actions CI", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + } + }, + { + "name": "ci-windows-v142", + "displayName": "ci-windows-v142", + "description": "Build configuration for GitHub Actions CI", + "generator": "NMake Makefiles", + "inherits": "ci", + "cacheVariables": { + } + }, + { + "name": "ci-windows-v143", + "displayName": "ci-windows-v143", + "description": "Build configuration for GitHub Actions CI", + "generator": "NMake Makefiles", + "inherits": "ci", + "cacheVariables": { + } + } + ], + "buildPresets": [ + { + "name": "ci-windows-v142", + "displayName": "ci-windows-v142 Release build", + "description": "Build configuration for GitHub actions CI", + "configurePreset": "ci-windows-v142", + "configuration": "Release" + }, + { + "name": "ci-windows-v143", + "displayName": "ci-windows-v143 CI build", + "description": "Build configuration for GitHub actions CI", + "configurePreset": "ci-windows-v143", + "configuration": "Release" + } + ], + "testPresets": [ + { + "name": "ci-windows-v142", + "displayName": "ci-windows-v142 CI build", + "description": "Build configuration for GitHub actions CI", + "configurePreset": "ci-windows-v142", + "configuration": "Release", + "output": { + "outputOnFailure": true + } + }, + { + "name": "ci-windows-v143", + "displayName": "ci-windows-v143 CI build", + "description": "Build configuration for GitHub actions CI", + "configurePreset": "ci-windows-v143", + "configuration": "Release", + "output": { + "outputOnFailure": true + } + } + ] + } + \ No newline at end of file