Skip to content

Commit 507691f

Browse files
committed
CI: macOS workflow refactor
1 parent 0086fa3 commit 507691f

File tree

1 file changed

+27
-51
lines changed

1 file changed

+27
-51
lines changed

.github/workflows/macos.yml

Lines changed: 27 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ env:
99

1010
jobs:
1111
build:
12-
name: ${{matrix.config.os}} - Xcode ${{matrix.config.xcode}} - ${{matrix.build_type}}
13-
runs-on: ${{matrix.config.os}}
1412
strategy:
1513
fail-fast: false
1614
matrix:
@@ -36,6 +34,11 @@ jobs:
3634
{os: macos-14, xcode: 15.4},
3735
]
3836
build_type: [Debug, Release, Sanitize]
37+
name: ${{matrix.config.os}} - Xcode ${{matrix.config.xcode}} - ${{matrix.build_type}}
38+
runs-on: ${{matrix.config.os}}
39+
env:
40+
CMAKE_GENERATOR: "Xcode"
41+
DEVELOPER_DIR: "/Applications/Xcode_${{matrix.config.xcode}}.app/Contents/Developer"
3942

4043
steps:
4144
- name: Checkout dynamic_bitset
@@ -44,64 +47,37 @@ jobs:
4447
submodules: recursive
4548
path: dynamic_bitset
4649

47-
- name: Setup build environment
48-
shell: cmake -P {0}
49-
run: |
50-
file(APPEND "$ENV{GITHUB_ENV}" "CMAKE_GENERATOR=Xcode\n")
51-
file(APPEND "$ENV{GITHUB_ENV}" "DEVELOPER_DIR=/Applications/Xcode_${{matrix.config.xcode}}.app/Contents/Developer\n")
52-
5350
- name: Setup CMake
5451
id: cmake
5552
uses: ./dynamic_bitset/.github/actions/setup_cmake
5653
with:
5754
cmake_version: ${{env.CMAKE_VERSION}}
5855
used_env: ${{matrix.config.os}}
5956

57+
- name: CMake version
58+
run: ${{steps.cmake.outputs.cmake_binary}} --version
59+
60+
- name: CTest version
61+
run: ${{steps.cmake.outputs.ctest_binary}} --version
62+
6063
- name: Configure
61-
shell: cmake -P {0}
62-
run: |
63-
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace)
64-
execute_process(
65-
COMMAND ${{steps.cmake.outputs.cmake_binary}}
66-
-S "${workspace}/dynamic_bitset"
67-
-B "${workspace}/dynamic_bitset/build"
68-
-D CMAKE_CONFIGURATION_TYPES=${{matrix.build_type}}
69-
-D CMAKE_BUILD_TYPE=${{matrix.build_type}}
70-
RESULT_VARIABLE result
71-
)
72-
if(NOT result EQUAL 0)
73-
message(FATAL_ERROR "Bad exit status")
74-
endif()
64+
run: >-
65+
${{steps.cmake.outputs.cmake_binary}}
66+
-S "${{github.workspace}}/dynamic_bitset"
67+
-B "${{github.workspace}}/dynamic_bitset/build"
68+
-D CMAKE_CONFIGURATION_TYPES=${{matrix.build_type}}
69+
-D CMAKE_BUILD_TYPE=${{matrix.build_type}}
7570
7671
- name: Build
77-
shell: cmake -P {0}
78-
run: |
79-
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace)
80-
include(ProcessorCount)
81-
ProcessorCount(N)
82-
execute_process(
83-
COMMAND ${{steps.cmake.outputs.cmake_binary}}
84-
--build "${workspace}/dynamic_bitset/build"
85-
--config ${{matrix.build_type}}
86-
--parallel ${N}
87-
RESULT_VARIABLE result
88-
)
89-
if(NOT result EQUAL 0)
90-
message(FATAL_ERROR "Bad exit status")
91-
endif()
72+
run: >-
73+
${{steps.cmake.outputs.cmake_binary}}
74+
--build "${{github.workspace}}/dynamic_bitset/build"
75+
--config ${{matrix.build_type}}
76+
--parallel $(nproc)
9277
9378
- name: Run tests
94-
shell: cmake -P {0}
95-
run: |
96-
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace)
97-
include(ProcessorCount)
98-
ProcessorCount(N)
99-
set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON")
100-
execute_process(
101-
COMMAND ${{steps.cmake.outputs.ctest_binary}} --output-on-failure --parallel ${N}
102-
WORKING_DIRECTORY "${workspace}/dynamic_bitset/build"
103-
RESULT_VARIABLE result
104-
)
105-
if(NOT result EQUAL 0)
106-
message(FATAL_ERROR "Running tests failed!")
107-
endif()
79+
run: >-
80+
${{steps.cmake.outputs.ctest_binary}}
81+
--test-dir "${{github.workspace}}/dynamic_bitset/build"
82+
--output-on-failure
83+
--parallel $(nproc)

0 commit comments

Comments
 (0)