Skip to content

Commit

Permalink
Update CI, CD (KhronosGroup#88)
Browse files Browse the repository at this point in the history
* Add DEB packaging

* Update check-format script

* Android build in CI

* Add linux CI

* Remove the C headers, C++ headers and loader from the SDK deb package

* Submodules update

* Add Windows CI job

* Add MacOS CI job

* Unify C/C++ standards

* Fix warnings and errors gcc

* Fix warnings and errors clang

* Fix multi-config

* Fix MacOS errors

* Fix Windows errors

* Install Windows OpenCL runtime

* Fix blur/blurcpp samples failures

* Fix MacOS test execution

* Fixed blur/blucpp OpenCL 2.0 check

* Various minor improvements

* Updated release scripts

* Building and packaging clinfo

* Minor fixes and improvements

* Removed ToDos

* Updated RELEASE.md

* Removed _get_platform(cl_platform_id platform) from mako

* Fixed resource release bug in binaries sample

* Remove null pointer checks

* Re-added whereami

* Using upstream main for OpenCL-Headers submodule

* Bump deprecated actions

* Removed MSVC++ v141 jobs

* Whereami workaround

* fix(ci): Fetch a newer version of SFML, update patch

* fix(ci): Set up OSX architecture

* fix(binaries): Sample lang in binary name

* fix(ci): Fixed system deps in Linux builds

* Update docker images

* Fix MSVC compiler toolset version

* Removed OpenCL 2.0 check and cl_khr_subgroups from blur sample

* Fixed compiler options being reset

* Bumped version of pocl

* Updated submodules' repository URL

---------

Co-authored-by: Beatriz Navidad Vilches <[email protected]>
  • Loading branch information
mfep and Beanavil authored Oct 1, 2024
1 parent 3410509 commit dbcae2c
Show file tree
Hide file tree
Showing 50 changed files with 1,669 additions and 253 deletions.
833 changes: 756 additions & 77 deletions .github/workflows/presubmit.yml

Large diffs are not rendered by default.

163 changes: 127 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,26 @@ name: Create Release
jobs:
windows-binary:
runs-on: windows-2022
defaults:
run:
shell: pwsh
strategy:
matrix:
VER: [v143]
GEN: [Visual Studio 17 2022]
BIN: [x64, x86]

env:
UseMultiToolTask: true
EnforceProcessCountAcrossBuilds: true
MultiProcMaxCount: 3
steps:
- name: Checkout OpenCL-SDK
uses: actions/checkout@v2

- name: Initialize git submodules
shell: pwsh
run: |
& git submodule init
& git submodule update
- name: Create Build Environment
shell: pwsh
run: |
# Parallelize MSBuild across projects
[Environment]::SetEnvironmentVariable('UseMultiToolTask', 'true', [EnvironmentVariableTarget]::User)
[Environment]::SetEnvironmentVariable('EnforceProcessCountAcrossBuilds', 'true', [EnvironmentVariableTarget]::User)
[Environment]::SetEnvironmentVariable('MultiProcMaxCount', "$env:NUMBER_OF_PROCESSORS", [EnvironmentVariableTarget]::User)
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Configure
shell: pwsh
run: |
$Bin = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
& cmake `
Expand All @@ -42,15 +36,16 @@ jobs:
-T ${{matrix.VER}} `
-S "${env:GITHUB_WORKSPACE}" `
-B "${env:GITHUB_WORKSPACE}\build" `
-D CMAKE_INSTALL_PREFIX="${env:GITHUB_WORKSPACE}\install" `
-D BUILD_DOCS=OFF `
-D BUILD_TESTING=OFF `
-D BUILD_EXAMPLES=OFF `
-D OPENCL_SDK_BUILD_SAMPLES=OFF `
-D OPENCL_ICD_LOADER_BUILD_TESTING=OFF `
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }
- name: Check version number
shell: pwsh
run: |
if ( -not (`
Get-Content ${env:GITHUB_WORKSPACE}\build\CMakeCache.txt | `
Expand All @@ -59,30 +54,29 @@ jobs:
{ throw 'CMake project version mismatches Git tag name (without leading "v")'}
- name: Build
shell: pwsh
run: |
foreach ($Config in "Debug","Release") { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\build" `
--config $Config `
-- `
/verbosity:minimal `
/noLogo `
/noLogo
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-SDK in $Config failed." }
}
- name: Package Binary
shell: pwsh
run: |
& cpack `
--config "${env:GITHUB_WORKSPACE}\build\CPackConfig.cmake" `
-G ZIP `
-C 'Debug;Release' `
-D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Win-${{matrix.BIN}}' `
-B "${env:GITHUB_WORKSPACE}\package"
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK failed." }
- name: Upload Package
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
Expand All @@ -91,22 +85,24 @@ jobs:
source:
name: Source Release (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: pwsh
strategy:
matrix:
OS: [ubuntu-20.04, windows-2022]

env:
DEB_INSTALLATION_PATH: /usr

steps:
- name: Checkout OpenCL-SDK
uses: actions/checkout@v2

- name: Initialize git submodules
shell: pwsh
run: |
& git submodule init
& git submodule update
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Configure
shell: pwsh
run: |
& cmake `
-S "${env:GITHUB_WORKSPACE}" `
Expand All @@ -116,19 +112,29 @@ jobs:
-D BUILD_EXAMPLES=OFF `
-D OPENCL_SDK_BUILD_SAMPLES=OFF `
-D OPENCL_ICD_LOADER_BUILD_TESTING=OFF `
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW `
-D CPACK_PACKAGING_INSTALL_PREFIX=$DEB_INSTALLATION_PATH
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }
- name: Check version number
shell: pwsh
run: |
if ( -not (`
Get-Content ${env:GITHUB_WORKSPACE}/build/CMakeCache.txt | `
Select-String -Pattern ('CMAKE_PROJECT_VERSION:STATIC=' + '${{github.ref_name}}'.Replace('v','')) `
)) `
{ throw 'CMake project version mismatches Git tag name (without leading "v")'}
- name: Package DEB
if: ${{ contains(matrix.OS, 'ubuntu') }}
run: |
cpack `
--config "${env:GITHUB_WORKSPACE}/build/CPackSourceConfig.cmake" `
-G DEB `
-C Release `
"${env:GITHUB_WORKSPACE}/package-deb"
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK deb failed." }
- name: Package Source
shell: pwsh
run: |
$Generator = if('${{matrix.OS}}' -match 'windows') {'ZIP'} else {'TGZ'}
& cpack `
Expand All @@ -138,11 +144,96 @@ jobs:
-D CPACK_SOURCE_IGNORE_FILES="/\\.git/;/\\.gitignore;/\\.gitmodules;/\\.gitlab/;/\\.github/;/\\.reuse/;/\\.appveyor.yml;/build/;/install/;/package/" `
-D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Source' `
-B "${env:GITHUB_WORKSPACE}/package"
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK source failed." }
- name: Release Source
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
package/OpenCL-SDK-${{github.ref_name}}-Source.*
package/OpenCL-SDK-${{github.ref_name}}-Source.*
ppa:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
OPENCL_HEADERS_REPOSITORY: mfep/OpenCL-Headers
OPENCL_ICD_LOADER_REPOSITORY: mfep/OpenCL-ICD-Loader
OPENCL_CLHPP_REPOSITORY: mfep/OpenCL-CLHPP
distroseries: jammy
steps:
- name: Add PPA
run: sudo add-apt-repository -y ppa:${{ vars.PPA }}

- name: Install prerequisites
run: sudo apt-get update -qq && sudo apt-get install -y
cmake
devscripts
debhelper-compat=13
opencl-c-headers
opencl-clhpp-headers
khronos-opencl-loader-libopencl1
khronos-opencl-loader-opencl-dev
clinfo

- name: Import GPG signing key
run: echo "${{ secrets.DEB_SIGNING_KEY }}" | gpg --import

- name: Download and extract source code (OpenCL-SDK)
run: |
wget -O $GITHUB_WORKSPACE/source.orig.tar.gz https://github.com/$GITHUB_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/source.orig.tar.gz -C $GITHUB_WORKSPACE
mv $GITHUB_WORKSPACE/OpenCL-SDK-* $GITHUB_WORKSPACE/OpenCL-SDK
- name: Download and extract source code (OpenCL-Headers)
run: |
wget -O $GITHUB_WORKSPACE/opencl-headers.tar.gz https://github.com/$OPENCL_HEADERS_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-headers.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers
- name: Download and extract source code (OpenCL-ICD-Loader)
run: |
wget -O $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz https://github.com/$OPENCL_ICD_LOADER_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader
- name: Download and extract source code (OpenCL-CLHPP)
run: |
wget -O $GITHUB_WORKSPACE/opencl-clhpp.tar.gz https://github.com/$OPENCL_CLHPP_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-clhpp.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP
- name: Configure project out-of-tree
run: cmake
-S $GITHUB_WORKSPACE/OpenCL-SDK*
-B $GITHUB_WORKSPACE/../build
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_INSTALL_PREFIX=/usr
-D BUILD_TESTING=OFF
-D OPENCL_SDK_BUILD_SAMPLES=OFF
-D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME
-D CPACK_DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}"
-D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }}

- name: Generate packaging scripts
run: cmake
-D CMAKE_CACHE_PATH=$GITHUB_WORKSPACE/../build/CMakeCache.txt
-D ORIG_ARCHIVE=$GITHUB_WORKSPACE/source.orig.tar.gz
-D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME
-D DEBIAN_DISTROSERIES=${{ env.distroseries }}
-D DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}"
-D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }}
-P $GITHUB_WORKSPACE/OpenCL-SDK*/cmake/DebSourcePkg.cmake

- name: Build source package
run: |
cd $GITHUB_WORKSPACE/OpenCL-SDK*/
debuild -S -sa
- name: Push source package to the PPA
run: dput ppa:${{ vars.PPA }} $GITHUB_WORKSPACE/*source.changes
14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
build/
install/
# Build dir
[Bb]uild/

# Install dir
[Ii]nstall/

# Package dirs
[Pp]ackage/
[Pp]ackage-deb/

# Cmake
CMakeFiles/

# vim
*~
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.16)

set(CMAKE_CXX_STANDARD 14)

Expand All @@ -28,6 +28,11 @@ cmake_dependent_option(OPENCL_SDK_BUILD_SAMPLES "Build sample code" ON OPENCL_SD
cmake_dependent_option(OPENCL_SDK_BUILD_OPENGL_SAMPLES "Build OpenCL-OpenGL interop sample code" ON OPENCL_SDK_BUILD_SAMPLES OFF)
cmake_dependent_option(OPENCL_SDK_TEST_SAMPLES "Add CTest to samples (where applicable)" ON OPENCL_SDK_BUILD_SAMPLES OFF)

option(OPENCL_SDK_BUILD_CLINFO "Build clinfo utility" ON)
if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libstdc++")
endif()

include(CTest)

if (NOT CMAKE_BUILD_TYPE)
Expand All @@ -48,6 +53,7 @@ list(APPEND CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake/Modules
)
include(Dependencies)
include(Package)
if(OPENCL_SDK_BUILD_UTILITY_LIBRARIES)
add_subdirectory(lib)
endif()
Expand All @@ -71,6 +77,7 @@ set(config_package_location ${CMAKE_INSTALL_DATADIR}/cmake/OpenCL)
install(
FILES ${PROJECT_BINARY_DIR}/OpenCL/OpenCLConfig.cmake
DESTINATION ${config_package_location}
COMPONENT binary
)

unset(CMAKE_SIZEOF_VOID_P)
Expand All @@ -83,6 +90,7 @@ write_basic_package_version_file(
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenCL/OpenCLConfigVersion.cmake
DESTINATION ${config_package_location}
COMPONENT binary
)

include(CPack)
Loading

0 comments on commit dbcae2c

Please sign in to comment.