-
Notifications
You must be signed in to change notification settings - Fork 21
227 lines (208 loc) · 7.78 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Main
on:
- push
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CLANG_VERSION: 15.0.6
LLVM_VERSION: 17.0.6
jobs:
build-native:
strategy:
fail-fast: false
matrix:
include:
- job_name: Linux x86_64 multilib
os: ubuntu-20.04
arch: x86_64
bootstrap_cmake_flags: -DBUILD_LTO_LIBS=ON
# To improve portability of the generated binaries, link the C++ standard library statically.
extra_cmake_flags: >-
-DMULTILIB=ON
-DBUILD_LTO_LIBS=ON
-DCMAKE_C_COMPILER=/home/runner/work/opend/clang/bin/clang
-DCMAKE_CXX_COMPILER=/home/runner/work/opend/clang/bin/clang++
-DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++
-DJITRT_EXTRA_LDFLAGS=-static-libstdc++
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=full
with_pgo: false
- job_name: macOS x86_64
os: macos-13
arch: x86_64
bootstrap_cmake_flags: >-
-DBUILD_LTO_LIBS=ON
# https://github.com/ldc-developers/ldc/issues/4462:
# When using LTO, we need to explicitly export ~all symbols for plugin support via `ld64 -exported_symbol '__*'`.
# Additionally `-w` to suppress resulting linker warnings.
extra_cmake_flags: >-
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
-DEXTRA_CXXFLAGS=-flto=full
with_pgo: false
- job_name: macOS arm64
os: macos-15
arch: arm64
bootstrap_cmake_flags: >-
-DBUILD_LTO_LIBS=ON
extra_cmake_flags: >-
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
-DEXTRA_CXXFLAGS=-flto=full
with_pgo: false
llvm_version: 17.0.6
- job_name: Windows x64
os: windows-2022
arch: x64
bootstrap_cmake_flags: -DBUILD_LTO_LIBS=ON
extra_cmake_flags: >-
-DBUILD_LTO_LIBS=ON
"-DD_COMPILER_FLAGS=-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=full
with_pgo: false
name: ${{ matrix.job_name }}
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
runs-on: ${{ matrix.os }}
timeout-minutes: 150
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.arch == 'arm64' && '11.0' || '10.12' }}
steps:
- uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 50
- name: Install prerequisites
uses: ./.github/actions/1-setup
with:
clang_version: ${{ runner.os == 'Windows' && '16.0.6' || env.CLANG_VERSION }}
llvm_version: ${{ matrix.llvm_version || env.LLVM_VERSION }}
arch: ${{ matrix.arch }}
- name: Build bootstrap LDC
uses: ./.github/actions/2-build-bootstrap
with:
cmake_flags: ${{ matrix.bootstrap_cmake_flags }}
arch: ${{ matrix.arch }}
- name: Build LDC with PGO instrumentation & gather profile from compiling default libs
if: matrix.with_pgo
uses: ./.github/actions/2a-build-pgo
with:
cmake_flags: ${{ matrix.bootstrap_cmake_flags }}
arch: ${{ matrix.arch }}
- name: Build LDC & LDC D unittests & defaultlib unittest runners
uses: ./.github/actions/3-build-native
with:
cmake_flags: ${{ matrix.extra_cmake_flags }}
arch: ${{ matrix.arch }}
with_pgo: ${{ matrix.with_pgo }}
- name: Install LDC & make portable
uses: ./.github/actions/5-install
with:
arch: ${{ matrix.arch }}
- name: 'macOS: Cross-compile iOS libraries, copy to install dir & extend ldc2.conf'
if: runner.os == 'macOS'
uses: ./.github/actions/5a-ios
with:
arch: ${{ matrix.arch }}
- name: 'Linux: Cross-compile emscripten druntime+phobos'
if: runner.os == 'Linux'
uses: ./.github/actions/5a-emscripten
with:
arch: ${{ matrix.arch }}
- name: Create package & upload artifact(s)
uses: ./.github/actions/7-package
with:
arch: ${{ matrix.arch }}
# Cross-compilation jobs for non-native targets.
# druntime/Phobos/LDC unittests aren't built; all test stages are skipped.
build-cross:
strategy:
fail-fast: false
matrix:
include:
- job_name: Android armv7a
host_os: ubuntu-20.04
os: android
arch: armv7a
android_x86_arch: i686
- job_name: Android aarch64
host_os: ubuntu-20.04
os: android
arch: aarch64
android_x86_arch: x86_64
extra_cmake_flags: >-
-DLDC_INSTALL_LLVM_RUNTIME_LIBS_OS=linux
-DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=aarch64-android
name: ${{ matrix.job_name }}
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
runs-on: ${{ matrix.host_os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 50
- name: Install prerequisites
uses: ./.github/actions/1-setup
with:
clang_version: ${{ env.CLANG_VERSION }}
llvm_version: ${{ env.LLVM_VERSION }}
arch: x86_64
- name: Build bootstrap LDC
uses: ./.github/actions/2-build-bootstrap
with:
cmake_flags: ${{ matrix.bootstrap_cmake_flags }}
- name: Build LDC with PGO instrumentation & gather profile from compiling default libs
if: matrix.with_pgo
uses: ./.github/actions/2a-build-pgo
with:
cmake_flags: ${{ matrix.bootstrap_cmake_flags }}
- name: Cross-compile LDC to ${{ matrix.os }}-${{ matrix.arch }}
uses: ./.github/actions/3-build-cross
with:
arch: ${{ matrix.arch }}
os: ${{ matrix.os }}
llvm_version: ${{ env.LLVM_VERSION }}
cmake_flags: ${{ matrix.extra_cmake_flags }}
with_pgo: ${{ matrix.with_pgo }}
- name: Install LDC & make portable
uses: ./.github/actions/5-install
with:
cross_compiling: true
- name: 'Android: Cross-compile ${{ matrix.android_x86_arch }} libraries & copy to install dir'
if: matrix.os == 'android'
uses: ./.github/actions/5a-android-x86
with:
arch: ${{ matrix.android_x86_arch }}
- name: Create package & upload artifact(s)
uses: ./.github/actions/7-package
with:
arch: ${{ matrix.arch }}
os: ${{ matrix.os }}
cross_target_triple: ${{ env.CROSS_TRIPLE }}
merge-macos:
name: macOS universal
runs-on: macos-latest
timeout-minutes: 30
needs: build-native
steps:
- uses: actions/checkout@v4
- name: Merge x86_64 & arm64 packages to universal one
uses: ./.github/actions/merge-macos
upload-to-github:
name: Upload to GitHub
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- build-native
- build-cross
- merge-macos
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Upload all artifacts to GitHub release
uses: ./.github/actions/upload-to-github