Skip to content

Commit 3839811

Browse files
authored
GHA: Promote macOS-arm64 cross-compilation job to full native job (#4541)
1 parent 0bd8ea2 commit 3839811

File tree

2 files changed

+27
-29
lines changed

2 files changed

+27
-29
lines changed

.github/actions/1-setup/action.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,12 @@ runs:
121121
run: |
122122
set -euxo pipefail
123123
python3 --version
124-
python3 -m pip install --user setuptools wheel
125-
python3 -m pip install --user lit
124+
if [[ '${{ runner.os }}-${{ inputs.arch }}' == 'macOS-arm64' ]]; then
125+
brew install lit python-setuptools
126+
else
127+
python3 -m pip install --user setuptools wheel
128+
python3 -m pip install --user lit
129+
fi
126130
python3 -c "import lit.main; lit.main.main();" --version . | head -n 1
127131
128132
# the druntime tests require GNU make

.github/workflows/main.yml

+21-27
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ jobs:
5151
-DEXTRA_CXXFLAGS=-flto=full
5252
with_pgo: true
5353

54+
- job_name: macOS arm64
55+
os: macos-14
56+
arch: arm64
57+
bootstrap_cmake_flags: >-
58+
-DBUILD_LTO_LIBS=ON
59+
-DD_COMPILER_FLAGS=-gcc=/usr/bin/c++
60+
extra_cmake_flags: >-
61+
-DBUILD_LTO_LIBS=ON
62+
-DD_COMPILER_FLAGS="-gcc=/usr/bin/c++ -O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
63+
-DEXTRA_CXXFLAGS=-flto=full
64+
with_pgo: true
65+
llvm_version: 17.0.6 # FIXME: sporadic 'libc++abi: Pure virtual function called!' compiler crashes with LLVM 18 (see https://github.com/ldc-developers/ldc/pull/4604, https://github.com/ldc-developers/ldc/pull/4541)
66+
5467
- job_name: Windows x64
5568
os: windows-2022
5669
arch: x64
@@ -76,17 +89,20 @@ jobs:
7689
runs-on: ${{ matrix.os }}
7790
timeout-minutes: 90
7891
env:
79-
MACOSX_DEPLOYMENT_TARGET: 10.12
92+
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.arch == 'arm64' && '11.0' || '10.12' }}
8093
steps:
8194
- uses: actions/checkout@v4
8295
with:
8396
submodules: true
8497
fetch-depth: 50
98+
- name: 'macOS 14: Switch to Xcode v14.3.1'
99+
if: matrix.os == 'macos-14'
100+
run: sudo xcode-select -switch /Applications/Xcode_14.3.1.app
85101
- name: Install prerequisites
86102
uses: ./.github/actions/1-setup
87103
with:
88104
clang_version: ${{ runner.os == 'Windows' && '18.1.5' || env.CLANG_VERSION }}
89-
llvm_version: ${{ env.LLVM_VERSION }}
105+
llvm_version: ${{ matrix.llvm_version || env.LLVM_VERSION }}
90106
arch: ${{ matrix.arch }}
91107
- name: Build bootstrap LDC
92108
uses: ./.github/actions/2-build-bootstrap
@@ -160,19 +176,6 @@ jobs:
160176
matrix:
161177
include:
162178

163-
- job_name: macOS arm64
164-
host_os: macos-11
165-
os: osx
166-
arch: arm64
167-
bootstrap_cmake_flags: -DD_COMPILER_FLAGS=-gcc=/usr/bin/c++
168-
# see native macOS job comment for extra flags (https://github.com/ldc-developers/ldc/issues/4462)
169-
extra_cmake_flags: >-
170-
-DBUILD_LTO_LIBS=ON
171-
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w"
172-
-DEXTRA_CXXFLAGS=-flto=full
173-
with_pgo: true
174-
llvm_version: 17.0.6 # TODO
175-
176179
- job_name: Android armv7a
177180
host_os: ubuntu-20.04
178181
os: android
@@ -191,8 +194,6 @@ jobs:
191194
name: ${{ matrix.job_name }}
192195
runs-on: ${{ matrix.host_os }}
193196
timeout-minutes: 60
194-
env:
195-
MACOSX_DEPLOYMENT_TARGET: 11.0
196197
steps:
197198
- uses: actions/checkout@v4
198199
with:
@@ -202,7 +203,7 @@ jobs:
202203
uses: ./.github/actions/1-setup
203204
with:
204205
clang_version: ${{ env.CLANG_VERSION }}
205-
llvm_version: ${{ matrix.llvm_version || env.LLVM_VERSION }}
206+
llvm_version: ${{ env.LLVM_VERSION }}
206207
arch: x86_64
207208
- name: Build bootstrap LDC
208209
uses: ./.github/actions/2-build-bootstrap
@@ -218,19 +219,14 @@ jobs:
218219
with:
219220
arch: ${{ matrix.arch }}
220221
os: ${{ matrix.os }}
221-
llvm_version: ${{ matrix.llvm_version || env.LLVM_VERSION }}
222+
llvm_version: ${{ env.LLVM_VERSION }}
222223
cmake_flags: ${{ matrix.extra_cmake_flags }}
223224
with_pgo: ${{ matrix.with_pgo }}
224225

225226
- name: Install LDC & make portable
226227
uses: ./.github/actions/5-install
227228
with:
228229
cross_compiling: true
229-
- name: 'macOS: Cross-compile iOS libraries, copy to install dir & extend ldc2.conf'
230-
if: matrix.os == 'osx'
231-
uses: ./.github/actions/5a-ios
232-
with:
233-
arch: ${{ matrix.arch }}
234230
- name: 'Android: Cross-compile ${{ matrix.android_x86_arch }} libraries & copy to install dir'
235231
if: matrix.os == 'android'
236232
uses: ./.github/actions/5a-android-x86
@@ -249,9 +245,7 @@ jobs:
249245
name: macOS universal
250246
runs-on: macos-latest
251247
timeout-minutes: 30
252-
needs:
253-
- build-native
254-
- build-cross
248+
needs: build-native
255249
steps:
256250
- uses: actions/checkout@v4
257251
- name: Merge x86_64 & arm64 packages to universal one

0 commit comments

Comments
 (0)