Cherry-pick Phobos change (not part of LDC 1.38 release) https://gith… #130
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
name: Main | |
on: | |
- pull_request | |
- push | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CLANG_VERSION: 15.0.6 | |
LLVM_VERSION: 18.1.5 | |
jobs: | |
build-native: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- job_name: Linux x86_64 | |
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=OFF | |
-DBUILD_LTO_LIBS=ON | |
-DCMAKE_C_COMPILER=/home/runner/work/ldc/clang/bin/clang | |
-DCMAKE_CXX_COMPILER=/home/runner/work/ldc/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: true | |
- job_name: macOS x86_64 | |
os: macos-12 | |
arch: x86_64 | |
bootstrap_cmake_flags: >- | |
-DBUILD_LTO_LIBS=ON | |
-DD_COMPILER_FLAGS=-gcc=/usr/bin/c++ | |
# 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="-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: 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 | |
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) | |
name: ${{ matrix.job_name }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 90 | |
env: | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.arch == 'arm64' && '11.0' || '10.12' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 50 | |
- name: 'macOS 14: Switch to Xcode v14.3.1' | |
if: matrix.os == 'macos-14' | |
run: sudo xcode-select -switch /Applications/Xcode_14.3.1.app | |
- name: Install prerequisites | |
uses: ./.github/actions/1-setup | |
with: | |
clang_version: ${{ runner.os == 'Windows' && '18.1.5' || 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: Run LDC D unittests | |
if: success() || failure() | |
uses: ./.github/actions/4a-test-ldc2 | |
- 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: Run a few integration tests against the installed compiler | |
uses: ./.github/actions/6-integration-test | |
- name: 'macOS: Run iOS cross-compilation integration test' | |
if: runner.os == 'macOS' | |
run: | | |
set -eux | |
cd .. | |
triple='${{ matrix.arch }}-apple-ios12.0${{ matrix.arch == 'x86_64' && '-simulator' || '' }}' | |
installed/bin/ldc2 -mtriple="$triple" hello.d -of=hello_ios | |
installed/bin/ldc2 -mtriple="$triple" hello.d -of=hello_ios_shared -link-defaultlib-shared | |
- name: Create package & upload artifact(s) | |
uses: ./.github/actions/7-package | |
with: | |
arch: ${{ matrix.arch }} | |
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/weka-master' | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
needs: | |
- build-native | |
- merge-macos | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Upload all artifacts to GitHub release | |
uses: ./.github/actions/upload-to-github |