Skip to content

Commit

Permalink
Merge branch 'master' into tagged_branches_squashed
Browse files Browse the repository at this point in the history
  • Loading branch information
denizzzka committed Jul 3, 2024
2 parents cf429ce + c6d0eee commit e1b570b
Show file tree
Hide file tree
Showing 636 changed files with 30,977 additions and 23,663 deletions.
14 changes: 0 additions & 14 deletions .azure-pipelines/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@ install_host_dmd() {
dmd --version
}

################################################################################
# Download dmc
################################################################################

install_host_dmc() {
if [ ! -f dm/README.TXT ]; then
download "https://downloads.dlang.org/other/dm857c.zip" dmc.zip
7z x dmc.zip > /dev/null
download "http://ftp.digitalmars.com/sppn.zip" sppn.zip
7z x -odm/bin sppn.zip > /dev/null
fi
dm/bin/dmc | head -n 1 || true
}

################################################################################
# Download Grep
################################################################################
Expand Down
86 changes: 24 additions & 62 deletions .azure-pipelines/windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,8 @@ echo "GREP_VERSION: $(grep --version)"

GNU_MAKE="$(which make)" # must be done before installing dmc (tampers with PATH)

if [ "$MODEL" == "32omf" ] ; then
install_host_dmc
CC="$PWD/dm/bin/dmc.exe"
export CPPCMD="$PWD/dm/bin/sppn.exe"
else
CC="cl.exe"
fi
CC="cl.exe"
CXX="cl.exe"

################################################################################
# Install the host compiler
Expand All @@ -58,14 +53,12 @@ clone_repos
################################################################################

if [ "$MODEL" == "64" ] ; then
MAKE_FILE="win64.mak"
LIBNAME=phobos64.lib
elif [ "$MODEL" == "32" ] ; then
MAKE_FILE="win64.mak"
LIBNAME=phobos32mscoff.lib
else # 32omf
MAKE_FILE="win32.mak"
LIBNAME=phobos.lib
else
echo 'Invalid $MODEL provided'.
exit 1
fi

################################################################################
Expand All @@ -78,18 +71,12 @@ if [[ "$HOST_DMD_VERSION" == "2.079.0" ]]; then
disable_debug_for_unittests=(ENABLE_DEBUG=0)
fi

# avoid the DMC runtime and its limitations for the compiler and {build,run}.d tools themselves
TOOL_MODEL="$MODEL"
if [[ "$MODEL" == "32omf" ]]; then
TOOL_MODEL=32
fi

cd "$DMD_DIR"
"$HOST_DC" -m$TOOL_MODEL compiler/src/build.d -ofgenerated/build.exe
generated/build.exe -j$N MODEL=$TOOL_MODEL HOST_DMD=$HOST_DC BUILD=debug "${disable_debug_for_unittests[@]}" unittest
generated/build.exe -j$N MODEL=$TOOL_MODEL HOST_DMD=$HOST_DC DFLAGS="-L-LARGEADDRESSAWARE" ENABLE_RELEASE=1 ENABLE_ASSERTS=1 dmd
"$HOST_DC" -m$MODEL compiler/src/build.d -ofgenerated/build.exe
generated/build.exe -j$N MODEL=$MODEL HOST_DMD=$HOST_DC BUILD=debug "${disable_debug_for_unittests[@]}" unittest
generated/build.exe -j$N MODEL=$MODEL HOST_DMD=$HOST_DC DFLAGS="-L-LARGEADDRESSAWARE" ENABLE_RELEASE=1 ENABLE_ASSERTS=1 dmd

DMD_BIN_PATH="$DMD_DIR/generated/windows/release/$TOOL_MODEL/dmd.exe"
DMD_BIN_PATH="$DMD_DIR/generated/windows/release/$MODEL/dmd.exe"

################################################################################
# Build Druntime and Phobos
Expand All @@ -110,30 +97,11 @@ if [ "${DMD_TEST_COVERAGE:-0}" = "1" ] ; then

# Recompile debug dmd + unittests
rm -rf "$DMD_DIR/generated/windows"
../../generated/build.exe -j$N MODEL=$TOOL_MODEL DFLAGS="-L-LARGEADDRESSAWARE" ENABLE_DEBUG=1 ENABLE_COVERAGE=1 dmd
../../generated/build.exe -j$N MODEL=$TOOL_MODEL DFLAGS="-L-LARGEADDRESSAWARE" ENABLE_DEBUG=1 ENABLE_COVERAGE=1 unittest
../../generated/build.exe -j$N MODEL=$MODEL DFLAGS="-L-LARGEADDRESSAWARE" ENABLE_DEBUG=1 ENABLE_COVERAGE=1 dmd
../../generated/build.exe -j$N MODEL=$MODEL DFLAGS="-L-LARGEADDRESSAWARE" ENABLE_DEBUG=1 ENABLE_COVERAGE=1 unittest
fi

"$HOST_DC" -m$TOOL_MODEL -g -i run.d

if [ "$MODEL" == "32omf" ] ; then
# Pre-build the tools while the host compiler's sc.ini is untampered (see below).
./run tools

# WORKAROUND: Make Optlink use freshly built Phobos, not the host compiler's.
# Optlink apparently prefers LIB in sc.ini (in the same dir as optlink.exe)
# over the LIB env variable (and `-conf=` for DMD apparently doesn't prevent
# that, and there's apparently no sane way to specify a libdir for Optlink
# in the DMD cmdline either).
rm "$DMD_DIR/tools/dmd2/windows/bin/sc.ini"
# We also need to remove LIB from the freshly built compiler's sc.ini -
# not all test invocations use `-conf=`.
sed -i 's|^LIB=.*$||g' "$DMD_DIR/generated/windows/release/$TOOL_MODEL/sc.ini"
# Okay, now the lib directories are controlled by the LIB env variable.
# run.d prepends the dir containing freshly built phobos.lib; we still need
# the DMC and Windows libs from the host compiler.
export LIB="$DMD_DIR/tools/dmd2/windows/lib"
fi
"$HOST_DC" -m$MODEL -g -i run.d

targets=("all")
args=('ARGS=-O -inline -g') # no -release for faster builds
Expand All @@ -142,7 +110,7 @@ if [ "$HOST_DMD_VERSION" = "2.079.0" ] ; then
targets=("runnable" "compilable" "fail_compilation" "dshell")
args=() # use default set of args
fi
./run --environment --jobs=$N "${targets[@]}" "${args[@]}" CC="$CC"
./run --environment --jobs=$N "${targets[@]}" "${args[@]}" CC="$CC" CXX="$CXX"

###############################################################################
# Upload coverage reports and exit if ENABLE_COVERAGE is specified
Expand All @@ -160,31 +128,25 @@ fi
cd "$DMD_DIR/druntime"
"$GNU_MAKE" -j$N MODEL=$MODEL DMD="$DMD_BIN_PATH" CC="$CC" unittest

if [ "$MODEL" != "32omf" ] ; then
# run some tests for shared druntime
# run some tests for shared druntime

# no separate output for static or shared builds, so clean directories to force rebuild
rm -rf test/shared/generated
# the test_runner links against libdruntime-ut.dll and runs all unittests
# no matter what module name is passed in, so restrict to src/object.d
"$GNU_MAKE" -j$N unittest MODEL=$MODEL SHARED=1 DMD="$DMD_BIN_PATH" CC="$CC" UT_SRCS=src/object.d ADDITIONAL_TESTS=test/shared
fi
# no separate output for static or shared builds, so clean directories to force rebuild
rm -rf test/shared/generated
# the test_runner links against libdruntime-ut.dll and runs all unittests
# no matter what module name is passed in, so restrict to src/object.d
"$GNU_MAKE" -j$N unittest MODEL=$MODEL SHARED=1 DMD="$DMD_BIN_PATH" CC="$CC" UT_SRCS=src/object.d ADDITIONAL_TESTS=test/shared

################################################################################
# Build and run Phobos unittests
################################################################################

if [ "$MODEL" = "32omf" ] ; then
echo "FIXME: cannot compile 32-bit OMF Phobos unittests ('more than 32767 symbols in object file')"
cd "$DMD_DIR/../phobos"
if [ "$MODEL" = "64" ] ; then
cp "$DMD_DIR/tools/dmd2/windows/bin64/libcurl.dll" .
else
cd "$DMD_DIR/../phobos"
if [ "$MODEL" = "64" ] ; then
cp "$DMD_DIR/tools/dmd2/windows/bin64/libcurl.dll" .
else
cp "$DMD_DIR/tools/dmd2/windows/bin/libcurl.dll" .
fi
"$GNU_MAKE" -j$N MODEL=$MODEL DMD="$DMD_BIN_PATH" CC="$CC" DMD_DIR="$DMD_DIR" unittest
cp "$DMD_DIR/tools/dmd2/windows/bin/libcurl.dll" .
fi
"$GNU_MAKE" -j$N MODEL=$MODEL DMD="$DMD_BIN_PATH" CC="$CC" DMD_DIR="$DMD_DIR" unittest

################################################################################
# Prepare artifacts
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

name: Bootstrap
on:
pull_request:
branches:
- stable
push:
branches:
- master
- stable

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
main:
strategy:
fail-fast: false
matrix:
version: [
2.076.1, 2.077.1, 2.078.3, 2.079.1,
2.080.1, 2.081.2, 2.082.1, 2.083.1, 2.084.1, 2.085.1, 2.086.1, 2.087.1, 2.088.1, 2.089.1,
2.090.1, 2.091.1, 2.092.1, 2.093.1, 2.094.2, 2.095.1, 2.096.1, 2.097.2, 2.098.1, 2.099.1,
2.100.2, 2.101.2, 2.102.2, 2.103.1, 2.104.2, 2.105.3, 2.106.1, 2.107.1
]

name: Build with dmd-${{ matrix.version }}
runs-on: ubuntu-22.04
timeout-minutes: 10
env:
# for ci/run.sh:
OS_NAME: linux
MODEL: 64
HOST_DMD: dmd-${{ matrix.version }}
# N is set dynamically below
FULL_BUILD: true
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 50

- name: Set environment variable N (parallelism)
run: echo "N=$(nproc)" >> $GITHUB_ENV

- name: Install host compiler
run: ci/run.sh install_host_compiler

- name: Set up repos
run: |
set -uexo pipefail
ref='${{ github.ref }}'
if [[ "$ref" =~ ^refs/pull/ ]]; then
# PR: clone the Phobos head with the same name as this DMD PR's target branch
# e.g., Phobos stable when targeting DMD stable
REPO_BRANCH="$GITHUB_BASE_REF"
elif [[ "$ref" =~ ^refs/(heads|tags)/(.*)$ ]]; then
# no PR: try to clone the Phobos head with the same name as this DMD head, falling back to master
# e.g., Phobos stable for a push to DMD stable, or Phobos v2.105.2 for DMD tag v2.105.2
REPO_BRANCH="${BASH_REMATCH[2]}"
else
echo "Error: unexpected GitHub ref '$ref'" >&2
exit 1
fi
ci/run.sh setup_repos "$REPO_BRANCH"
- name: Build dmd
run: ENABLE_RELEASE=0 ENABLE_DEBUG=0 ci/run.sh build 0

- name: Rebuild dmd
run: ENABLE_RELEASE=0 ENABLE_DEBUG=0 ci/run.sh rebuild
21 changes: 21 additions & 0 deletions .github/workflows/build_with_dub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build D compiler using dub

on:
- pull_request
- push

jobs:
test:
name: Build D compiler using dub
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install Host D compiler
uses: dlang-community/setup-dlang@v1

- name: Invoke dub
run: dub run dmd:compiler -- --version
61 changes: 39 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ jobs:
os: ubuntu-22.04
model: 32
host_dmd: dmd
- job_name: Ubuntu 22.04 x86, DMD (coverage)
os: ubuntu-22.04
model: 32
host_dmd: dmd
coverage: true
# Disabled because of failure https://issues.dlang.org/show_bug.cgi?id=24518
# - job_name: Ubuntu 22.04 x86, DMD (coverage)
# os: ubuntu-22.04
# model: 32
# host_dmd: dmd
# coverage: true
- job_name: Ubuntu 22.04 x86, DMD (bootstrap)
os: ubuntu-22.04
model: 32
Expand All @@ -52,10 +53,11 @@ jobs:
- job_name: macOS 13 x64, DMD (latest)
os: macos-13
host_dmd: dmd
- job_name: macOS 13 x64, DMD (coverage)
os: macos-13
host_dmd: dmd
coverage: true
# Disabled because of failure https://issues.dlang.org/show_bug.cgi?id=24518
# - job_name: macOS 13 x64, DMD (coverage)
# os: macos-13
# host_dmd: dmd
# coverage: true
- job_name: macOS 12 x64, DMD (bootstrap)
os: macos-12
# de-facto bootstrap version on OSX
Expand All @@ -77,7 +79,7 @@ jobs:
OS_NAME: ${{ startsWith(matrix.os, 'ubuntu') && 'linux' || (startsWith(matrix.os, 'macos') && 'osx' || (startsWith(matrix.os, 'windows') && 'windows' || '')) }}
MODEL: ${{ matrix.model || '64' }}
HOST_DMD: ${{ matrix.host_dmd }}
N: ${{ startsWith(matrix.os, 'macos') && '3' || '4' }}
# N is set dynamically below
FULL_BUILD: true
# for coverage:
DMD_TEST_COVERAGE: ${{ matrix.coverage && '1' || '0' }}
Expand All @@ -91,14 +93,19 @@ jobs:
with:
fetch-depth: 50

- name: Set environment variable N (parallelism)
run: echo "N=$(${{ runner.os == 'macOS' && 'sysctl -n hw.logicalcpu' || 'nproc' }})" >> $GITHUB_ENV

- name: 'Posix: Install prerequisites'
if: runner.os != 'Windows'
run: ${{ runner.os == 'macOS' && 'ci/cirrusci.sh' || 'sudo -E ci/cirrusci.sh' }}
- name: 'Windows: Set up MSVC environment'
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-vsdevenv@v4
with:
arch: ${{ env.MODEL == '64' && 'x64' || 'x86' }}

# NOTE: Linker ICEs with Xcode 15.0.1 (default version on macos-13)
# * https://issues.dlang.org/show_bug.cgi?id=24407
# Remove this step if the default gets changed to 15.1 in actions/runner-images.
- name: 'macOS 13: Switch to Xcode v15.1'
if: matrix.os == 'macos-13'
run: sudo xcode-select -switch /Applications/Xcode_15.1.app

- name: 'Posix: Install host compiler'
if: runner.os != 'Windows'
Expand Down Expand Up @@ -133,12 +140,14 @@ jobs:
env:
# on Windows, `ci/run.sh build` expects the DMD env var to be set to the DMD-CLI-compatible host compiler
DMD: ${{ runner.os == 'Windows' && (startsWith(matrix.host_dmd, 'ldc') && 'ldmd2' || 'dmd') || '' }}
# work around the LDC host compiler on Windows assuming the first link.exe in PATH is the MSVC one
# (VSINSTALLDIR is set, but GHA uses Git's bin\bash.exe for `shell: bash`, which prepends Git's usr\bin to PATH, with GNU link.exe)
LDC_VSDIR_FORCE: ${{ runner.os == 'Windows' && startsWith(matrix.host_dmd, 'ldc') && '1' || '' }}
- name: Rebuild dmd (with enabled coverage)
if: matrix.coverage
run: ENABLE_RELEASE=0 ENABLE_DEBUG=1 ENABLE_COVERAGE=1 ci/run.sh rebuild
- name: 'Windows: Set up MSVC environment' # some tests need cl.exe etc. in PATH
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-vsdevenv@v4
with:
arch: ${{ env.MODEL == '64' && 'x64' || 'x86' }}
- name: Test dmd
run: ci/run.sh test_dmd
- name: Test druntime
Expand All @@ -154,6 +163,9 @@ jobs:
- name: Test phobos
if: '!matrix.coverage'
run: ci/run.sh test_phobos
- name: Test self-compile
if: '!matrix.coverage' # already re-built with enabled coverage
run: ENABLE_RELEASE=0 ci/run.sh rebuild
- name: Upload coverage report
if: matrix.coverage
run: ci/run.sh codecov
Expand All @@ -170,18 +182,19 @@ jobs:
freebsd_version: '13.2'
host_dmd: dmd-2.095.0
name: ${{ matrix.job_name }}
runs-on: macos-latest
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 50
- name: Run in VM
uses: cross-platform-actions/action@v0.22.0
uses: cross-platform-actions/action@v0.23.0
with:
operating_system: freebsd
hypervisor: qemu
memory: 8G
memory: 12G
cpu_count: 4
sync_files: runner-to-vm
version: ${{ matrix.freebsd_version }}
shell: bash
Expand All @@ -194,7 +207,7 @@ jobs:
export OS_NAME=freebsd
export MODEL=64
export HOST_DMD='${{ matrix.host_dmd }}'
export N=3
export N="$(nproc)"
export FULL_BUILD=true
export CI_DFLAGS="-version=TARGET_FREEBSD${freebsd_major}"
Expand Down Expand Up @@ -242,3 +255,7 @@ jobs:
echo '::group::Test phobos'
ci/run.sh test_phobos
echo '::endgroup::'
echo '::group::Test self-compile'
ENABLE_RELEASE=0 ci/run.sh rebuild
echo '::endgroup::'
Loading

0 comments on commit e1b570b

Please sign in to comment.