1111 - ' tools/**'
1212
1313jobs :
14- build :
14+ define-matrix :
15+ runs-on : ubuntu-latest
16+
17+ outputs :
18+ hosts : ${{ steps.matrix.outputs.hosts }}
19+ containers : ${{ steps.matrix.outputs.containers }}
20+
21+ steps :
22+ - name : Define Matrix
23+ id : matrix
24+ shell : python
25+ run : |
26+ import json
27+ import os
28+
29+ macos_map = {
30+ 'macos-13': "14.3.1",
31+ 'macos-14': "15.4",
32+ 'macos-15': "16.2"
33+ }
34+
35+ win_paltforms = ["x64", "Win32"]
36+ win_clang_archs = ["x64", "x86"]
37+
38+ gcc_map = {
39+ 11: 'ubuntu-latest',
40+ 12: 'ubuntu-latest',
41+ 13: 'ubuntu-latest',
42+ 14: 'ubuntu-24.04'
43+ }
44+ gcc_cont_map = {
45+ 15: 'gcc:15.1'
46+ }
47+ clang_map = {
48+ 13: 'ubuntu-22.04',
49+ 14: 'ubuntu-22.04',
50+ 15: 'ubuntu-22.04',
51+ 16: 'ubuntu-22.04',
52+ 17: 'ubuntu-latest',
53+ 18: 'ubuntu-latest',
54+ 19: 'ubuntu-latest',
55+ 20: 'ubuntu-latest'
56+ }
57+
58+ hosts = []
59+ containers=[]
60+
61+ #macOS
62+ for runon, xcode in macos_map.items():
63+ hosts.append({'os': runon, 'version': xcode, 'jobname': f'macOS - Xcode{xcode}'})
64+
65+ #windows
66+ for platform in win_paltforms:
67+ hosts.append({'os': 'windows-latest', 'platform': platform, 'module': true, 'jobname': f'Windows - {platform}'})
68+
69+ for arch in win_clang_archs:
70+ hosts.append({'os': 'windows-latest', 'arch': arch, 'compiler': 'clang-cl', 'module': false, 'jobname': f'Windows - clang - {arch}'})
71+
72+ #gcc hosts
73+ for gcc, runon in gcc_map.items():
74+ hosts.append({'os': runon, 'compiler': 'gcc', 'version': gcc, 'module': gcc >= 14,
75+ 'jobname': f'Linux - GCC{gcc}'})
76+
77+ #gcc containers
78+ for gcc, container in gcc_cont_map.items():
79+ containers.append({'container': container, 'module': gcc >= 14,
80+ 'jobname': f'Linux - GCC{gcc}'})
81+
82+
83+ #clang
84+ for clang, runon in clang_map.items():
85+ hosts.append({'os': runon, 'compiler': 'clang', 'version': clang, 'module': clang >= 18,
86+ 'jobname': f'Linux - Clang{clang}'})
87+
88+ with open(os.environ['GITHUB_OUTPUT'], 'w') as env:
89+ print('hosts=' + json.dumps(hosts), file=env)
90+ print('containers=' + json.dumps(containers), file=env)
91+
92+ standard :
93+ needs : define-matrix
94+ name : ${{ matrix.jobname }}
1595 runs-on : ${{ matrix.os }}
16- name : ${{ matrix.name }}
1796 strategy :
1897 fail-fast : false
1998 matrix :
20- include :
21- - { os: macos-latest, name: 'macOS latest' }
22-
23- - { os: windows-latest, module: true, name: 'Windows latest' }
24-
25- - { os: ubuntu-latest, compiler: gcc, version: 11, name: 'GCC 11' }
26- - { os: ubuntu-latest, compiler: gcc, version: 12, name: 'GCC 12' }
27- - { os: ubuntu-latest, compiler: gcc, version: 13, name: 'GCC 13' }
28- - { os: ubuntu-24.04, compiler: gcc, version: 14, module: true, name: 'GCC 14' }
29-
30- - { os: ubuntu-22.04, compiler: clang, version: 13, name: 'Clang 13' }
31- - { os: ubuntu-22.04, compiler: clang ,version: 14, name: 'Clang 14' }
32- - { os: ubuntu-22.04, compiler: clang, version: 15, name: 'Clang 15' }
33- - { os: ubuntu-22.04, compiler: clang, version: 16, name: 'Clang 16' }
34- - { os: ubuntu-latest, compiler: clang, version: 17, name: 'Clang 17' }
35- - { os: ubuntu-latest, compiler: clang, version: 18, module: true, name: 'Clang 13' }
36- - { os: ubuntu-latest, compiler: clang, version: 19, module: true, name: 'Clang 19' }
37- - { os: ubuntu-latest, compiler: clang, version: 20, module: true, name: 'Clang 20' }
99+ include : ${{ fromJSON(needs.define-matrix.outputs.hosts) }}
38100
39101 steps :
40102 - name : Checkout
@@ -74,13 +136,33 @@ jobs:
74136 echo "CMAKE_GENERATOR=-GNinja" >> $GITHUB_ENV
75137 fi
76138
139+ if [[ '${{ matrix.os }}' == macos-* ]]; then
140+ echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.version }}.app" >> $GITHUB_ENV
141+ fi
142+
143+ if [[ '${{ matrix.os }}' == windows-* ]]; then
144+ if [[ '${{ matrix.compiler }}' != '' ]]; then
145+ if [[ '${{ matrix.arch }}' == "x64" ]]; then
146+ VCPREFIX="C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\Llvm\\x64\\bin"
147+ else
148+ VCPREFIX="C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\Llvm\\bin"
149+ fi
150+ echo "CC=$VCPREFIX\\${{ matrix.compiler }}" >> $GITHUB_ENV
151+ echo "CXX=$VCPREFIX\\${{ matrix.compiler }}" >> $GITHUB_ENV
152+ echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV
153+ fi
154+ fi
155+
77156 if [[ '${{ matrix.module}}' == 'true' ]]; then
78157 echo "CMAKE_ARGS=-DISPTR_ENABLE_MODULE=ON" >> $GITHUB_ENV
79158 fi
80159
81160 - name : Configure
82161 shell : bash
83162 run : |
163+ if [[ '${{ matrix.platform }}' != "" ]]; then
164+ export CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_GENERATOR_PLATFORM=${{ matrix.platform }}"
165+ fi
84166 cmake $CMAKE_GENERATOR -S . -B build $CMAKE_ARGS -DISPTR_ENABLE_PYTHON=ON -DCMAKE_BUILD_TYPE=Release
85167
86168 - name : Build and Test
@@ -89,14 +171,14 @@ jobs:
89171 cmake --build build --config Release --target run-test
90172
91173 container :
174+ needs : define-matrix
175+ name : ${{ matrix.jobname }}
92176 runs-on : ubuntu-latest
93- name : ${{ matrix.name }}
94177 container : ${{ matrix.container }}
95178 strategy :
96179 fail-fast : false
97180 matrix :
98- include :
99- - {container: gcc:15.1, module: true, name: 'GCC 15'}
181+ include : ${{ fromJSON(needs.define-matrix.outputs.containers) }}
100182
101183 steps :
102184 - name : Checkout
0 commit comments