From 25a55db6b9a414e317f8954f971ddc26d4ed8fd5 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Tue, 5 Dec 2023 23:27:29 +0100 Subject: [PATCH] GHA: Promote macOS-arm64 cross-compilation job to full native job Using the new CI runners (awesome performance!). --- .github/actions/1-setup/action.yml | 8 ++++-- .github/actions/4d-test-libs/action.yml | 9 ++++-- .github/workflows/main.yml | 37 ++++++++++--------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/actions/1-setup/action.yml b/.github/actions/1-setup/action.yml index b8e9bf55da2..6271fa4c4dd 100644 --- a/.github/actions/1-setup/action.yml +++ b/.github/actions/1-setup/action.yml @@ -119,8 +119,12 @@ runs: run: | set -euxo pipefail python3 --version - python3 -m pip install --user setuptools wheel - python3 -m pip install --user lit + if [[ '${{ runner.os }}-${{ inputs.arch }}' == 'macOS-arm64' ]]; then + brew install lit python-setuptools + else + python3 -m pip install --user setuptools wheel + python3 -m pip install --user lit + fi python3 -c "import lit.main; lit.main.main();" --version . | head -n 1 # the druntime tests require GNU make diff --git a/.github/actions/4d-test-libs/action.yml b/.github/actions/4d-test-libs/action.yml index ce6021e3d0d..791f4c8809a 100644 --- a/.github/actions/4d-test-libs/action.yml +++ b/.github/actions/4d-test-libs/action.yml @@ -1,7 +1,7 @@ name: Run defaultlib unittests & druntime integration tests inputs: arch: - required: false # Windows only + required: false # Windows and macOS only runs: using: composite steps: @@ -12,12 +12,17 @@ runs: run: | set -eux cd ../build + excludes='dmd-testsuite|lit-tests|ldc2-unittest' if [[ '${{ runner.os }}' == macOS ]]; then N=$(sysctl -n hw.logicalcpu) + # FIXME: fails with enabled optimizations on M1 runners + #if [[ '${{ inputs.arch }}' == arm64 ]]; then + # excludes+='|^std.internal.math.gammafunction(-shared)?$' + #fi else N=$(nproc) fi - ctest -j$N --output-on-failure -E "dmd-testsuite|lit-tests|ldc2-unittest" + ctest -j$N --output-on-failure -E "$excludes" - name: 'Windows: Run defaultlib unittests & druntime integration tests' if: runner.os == 'Windows' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b256404f50a..7b405e5e996 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,6 +51,18 @@ jobs: -DEXTRA_CXXFLAGS=-flto=full with_pgo: true + - job_name: macOS arm64 + os: macos-14 + arch: arm64 + bootstrap_cmake_flags: >- + -DBUILD_LTO_LIBS=ON + -DD_COMPILER_FLAGS=-gcc=/usr/bin/c++ + extra_cmake_flags: >- + -DBUILD_LTO_LIBS=ON + -DD_COMPILER_FLAGS="-gcc=/usr/bin/c++ -O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto -L-exported_symbol '-L__*' -L-w" + -DEXTRA_CXXFLAGS=-flto=full + with_pgo: true + - job_name: Windows x64 os: windows-2022 arch: x64 @@ -76,7 +88,7 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 90 env: - MACOSX_DEPLOYMENT_TARGET: 10.12 + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.arch == 'arm64' && '11.0' || '10.12' }} steps: - uses: actions/checkout@v3 with: @@ -160,18 +172,6 @@ jobs: matrix: include: - - job_name: macOS arm64 - host_os: macos-12 - os: osx - arch: arm64 - bootstrap_cmake_flags: -DD_COMPILER_FLAGS=-gcc=/usr/bin/c++ - # see native macOS job comment for extra flags (https://github.com/ldc-developers/ldc/issues/4462) - 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: true - - job_name: Android armv7a host_os: ubuntu-20.04 os: android @@ -190,8 +190,6 @@ jobs: name: ${{ matrix.job_name }} runs-on: ${{ matrix.host_os }} timeout-minutes: 60 - env: - MACOSX_DEPLOYMENT_TARGET: 11.0 steps: - uses: actions/checkout@v4 with: @@ -225,11 +223,6 @@ jobs: uses: ./.github/actions/5-install with: cross_compiling: true - - name: 'macOS: Cross-compile iOS libraries, copy to install dir & extend ldc2.conf' - if: matrix.os == 'osx' - uses: ./.github/actions/5a-ios - with: - arch: ${{ matrix.arch }} - name: 'Android: Cross-compile ${{ matrix.android_x86_arch }} libraries & copy to install dir' if: matrix.os == 'android' uses: ./.github/actions/5a-android-x86 @@ -248,9 +241,7 @@ jobs: name: macOS universal runs-on: macos-latest timeout-minutes: 30 - needs: - - build-native - - build-cross + needs: build-native steps: - uses: actions/checkout@v4 - name: Merge x86_64 & arm64 packages to universal one