summaryrefslogtreecommitdiff
path: root/.github/workflows/macos.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/macos.yml')
-rw-r--r--.github/workflows/macos.yml73
1 files changed, 73 insertions, 0 deletions
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
new file mode 100644
index 0000000..c1b2972
--- /dev/null
+++ b/.github/workflows/macos.yml
@@ -0,0 +1,73 @@
+name: MacOS
+
+on:
+ push:
+ paths-ignore:
+ - '**/*.md'
+ pull_request:
+ paths-ignore:
+ - '**/*.md'
+
+jobs:
+ compatibility:
+ runs-on: macos-11
+ strategy:
+ matrix:
+ VER: [9, 11]
+ GEN: [Xcode, Ninja Multi-Config]
+ STD: [11, 17]
+
+ steps:
+ - name: Checkout OpenCL-Headers
+ uses: actions/checkout@v3
+
+ - name: Create Build Environment
+ shell: bash
+ run: |
+ cmake -E make_directory $GITHUB_WORKSPACE/build;
+ cmake -E make_directory $GITHUB_WORKSPACE/install;
+ if [[ "${{matrix.GEN}}" == "Ninja Multi-Config" && ! `which ninja` ]]; then brew install ninja; fi;
+ # Install Ninja only if it's the selected generator and it's not available.
+ cmake --version
+
+ - name: Install gcc if required
+ run: |
+ if [[ ! `which /usr/local/bin/gcc-${{matrix.VER}}` ]]; then brew install gcc@${{matrix.VER}}; fi;
+
+ - name: Configure CMake
+ shell: bash
+ run: cmake
+ -G "${{matrix.GEN}}"
+ -D BUILD_TESTING=ON
+ -D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror"
+ -D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}}
+ -D CMAKE_C_EXTENSIONS=OFF
+ -D CMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror"
+ -D CMAKE_CXX_COMPILER=/usr/local/bin/g++-${{matrix.VER}}
+ -D CMAKE_CXX_EXTENSIONS=OFF
+ -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
+ -S $GITHUB_WORKSPACE
+ -B $GITHUB_WORKSPACE/build
+
+ - name: Build
+ shell: bash
+ run: |
+ cmake --build $GITHUB_WORKSPACE/build --config Release --parallel `sysctl -n hw.logicalcpu` `if [[ "${{matrix.GEN}}" == "Xcode" ]]; then echo "-- -quiet"; fi;`
+ cmake --build $GITHUB_WORKSPACE/build --config Debug --parallel `sysctl -n hw.logicalcpu` `if [[ "${{matrix.GEN}}" == "Xcode" ]]; then echo "-- -quiet"; fi;`
+
+ - name: Test
+ working-directory: ${{runner.workspace}}/OpenCL-Headers/build
+ shell: bash
+ run: |
+ ctest -C Release --output-on-failure --parallel `sysctl -n hw.logicalcpu`
+ ctest -C Debug --output-on-failure --parallel `sysctl -n hw.logicalcpu`
+
+ - name: Test install
+ shell: bash
+ run: cmake --build $GITHUB_WORKSPACE/build --target install --config Release
+
+ - name: Test pkg-config
+ shell: bash
+ run: |
+ if [[ ! `which pkg-config` ]]; then brew install pkg-config; fi;
+ PKG_CONFIG_PATH="$GITHUB_WORKSPACE/install/share/pkgconfig" pkg-config OpenCL-Headers --cflags | grep -q "\-I$GITHUB_WORKSPACE/install/include"