Skip to content

Commit

Permalink
Merge dlang/druntime repository into dlang/dmd
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Jul 9, 2022
2 parents 6374bb8 + cd3a746 commit 69ab16a
Show file tree
Hide file tree
Showing 819 changed files with 292,092 additions and 0 deletions.
30 changes: 30 additions & 0 deletions druntime/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2
jobs:
build:
working_directory: ~/druntime
docker:
- image: circleci/buildpack-deps:18.04
parallelism: 1
steps:
- checkout
- run:
command: ./.circleci/run.sh setup-repos
name: Clone DMD
- run:
command: ./.circleci/run.sh install-deps
name: Install DMD
- run:
command: ./.circleci/run.sh style
name: Check code style
- run:
command: ./.circleci/run.sh coverage
name: Run DRuntime testsuite with -cov
- run:
command: ./.circleci/run.sh codecov
name: Upload coverage files to CodeCov
- run:
command: ./.circleci/run.sh betterc
name: Run @betterC tests
- run:
command: ./.circleci/run.sh publictests
name: Run public unittests
135 changes: 135 additions & 0 deletions druntime/.circleci/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/bash

set -uexo pipefail

HOST_DMD_VER=2.079.1
CURL_USER_AGENT="CirleCI $(curl --version | head -n 1)"
N=4
CIRCLE_NODE_INDEX=${CIRCLE_NODE_INDEX:-0}
CIRCLE_PROJECT_REPONAME=${CIRCLE_PROJECT_REPONAME:-druntime}

case $CIRCLE_NODE_INDEX in
0) MODEL=64 ;;
1) MODEL=32 ;; # broken - https://issues.dlang.org/show_bug.cgi?id=19116
esac

download() {
local url="$1"
local fallbackurl="$2"
local outputfile="$3"
for i in {0..4}; do
if curl -fsS -A "$CURL_USER_AGENT" --max-time 5 "$url" -o "$outputfile" ||
curl -fsS -A "$CURL_USER_AGENT" --max-time 5 "$fallbackurl" -o "$outputfile" ; then
break
elif [ $i -ge 4 ]; then
sleep $((1 << $i))
else
echo "Failed to download script ${outputfile}" 1>&2
exit 1
fi
done
}

install_deps() {
sudo apt-get update
if [ $MODEL -eq 32 ]; then
sudo apt-get install -y g++-multilib
fi
sudo apt-get install -y gdb

download "https://dlang.org/install.sh" "https://nightlies.dlang.org/install.sh" "install.sh"

source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash install.sh dmd-$HOST_DMD_VER --activate)"
$DC --version
env
}

# clone dmd
clone() {
local url="$1"
local path="$2"
local branch="$3"
for i in {0..4}; do
if git clone --branch "$branch" "$url" "$path" "${@:4}"; then
break
elif [ $i -lt 4 ]; then
sleep $((1 << $i))
else
echo "Failed to clone: ${url}"
exit 1
fi
done
}

setup_repos() {
# set a default in case we run into rate limit restrictions
local base_branch=""
if [ -n "${CIRCLE_PR_NUMBER:-}" ]; then
base_branch=$((curl -fsSL https://api.github.com/repos/dlang/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER || echo) | jq -r '.base.ref')
else
base_branch=$CIRCLE_BRANCH
fi
base_branch=${base_branch:-"master"}
# merge upstream branch with changes, s.t. we check with the latest changes
if [ -n "${CIRCLE_PR_NUMBER:-}" ]; then
local head=$(git rev-parse HEAD)
git remote add upstream "https://github.com/dlang/$CIRCLE_PROJECT_REPONAME.git"
git fetch -q upstream "+refs/pull/${CIRCLE_PR_NUMBER}/merge:"
git checkout -f FETCH_HEAD
fi
for proj in dmd ; do
if [ $base_branch != master ] && [ $base_branch != stable ] &&
! git ls-remote --exit-code --heads https://github.com/dlang/$proj.git $base_branch > /dev/null; then
# use master as fallback for other repos to test feature branches
clone https://github.com/dlang/$proj.git ../$proj master --depth 1
else
clone https://github.com/dlang/$proj.git ../$proj $base_branch --depth 1
fi
done
}
style() {
make -f posix.mak style
}
coverage() {
# load environment for bootstrap compiler
source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)"
# build dmd (release) and druntime (debug)
make -j$N -C ../dmd/src -f posix.mak MODEL=$MODEL HOST_DMD=$DMD BUILD="release" all
TEST_COVERAGE="1" make -j$N -C . -f posix.mak MODEL=$MODEL unittest-debug
}
betterc()
{
clone https://github.com/dlang/tools.git ../tools master --depth 1
make -f posix.mak betterc -j$N DUB="$HOME/dlang/dmd-${HOST_DMD_VER}/linux/bin64/dub"
}
publictests()
{
# checkout a specific version of https://github.com/dlang/tools
if [ ! -d ../tools ] ; then
clone https://github.com/dlang/tools.git ../tools master --depth 1
fi
make -f posix.mak publictests -j$N DUB="$HOME/dlang/dmd-${HOST_DMD_VER}/linux/bin64/dub"
}
codecov()
{
OS_NAME=linux source ../dmd/ci/codecov.sh
}
case $1 in
install-deps) install_deps ;;
setup-repos) setup_repos ;;
style) style ;;
betterc) betterc ;;
publictests) publictests ;;
coverage) coverage ;;
codecov) codecov ;;
esac
99 changes: 99 additions & 0 deletions druntime/.cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
common_steps_template: &COMMON_STEPS_TEMPLATE
set_repo_branch_env_var_script: |
set -uexo pipefail
if [ -z ${CIRRUS_PR+x} ]; then
# not a PR
REPO_BRANCH="$CIRRUS_BRANCH"
elif [[ ! "$CIRRUS_BRANCH" =~ ^pull/ ]]; then
# PR originating from the official dlang repo
REPO_BRANCH="$CIRRUS_BRANCH"
else
# PR from a fork
REPO_BRANCH="$CIRRUS_BASE_BRANCH"
fi
echo "REPO_BRANCH=$REPO_BRANCH" >> $CIRRUS_ENV
clone_dmd_script: |
set -uexo pipefail
DMD_BRANCH="$REPO_BRANCH"
if [ "$DMD_BRANCH" != master ] && [ "$DMD_BRANCH" != stable ] &&
! git ls-remote --exit-code --heads "https://github.com/dlang/dmd.git" "$DMD_BRANCH" > /dev/null; then
DMD_BRANCH="master"
fi
git clone --branch "$DMD_BRANCH" --depth 1 https://github.com/dlang/dmd.git ../dmd
install_prerequisites_script: cd ../dmd && ./ci/cirrusci.sh
install_host_compiler_script: cd ../dmd && ./ci/run.sh install_host_compiler
setup_repos_script: |
set -uexo pipefail
ln -s $CIRRUS_WORKING_DIR ../druntime
cd ../dmd && ./ci/run.sh setup_repos "$REPO_BRANCH"
build_script: cd ../dmd && ./ci/run.sh build
test_dmd_script: cd ../dmd && ./ci/run.sh test_dmd
test_druntime_script: cd ../dmd && ./ci/run.sh test_druntime
test_phobos_script: cd ../dmd && ./ci/run.sh test_phobos

environment:
CIRRUS_CLONE_DEPTH: 1
# for ci/run.sh:
MODEL: 64
HOST_DMD: dmd
N: 4
OS_NAME: linux
FULL_BUILD: false

# Linux
task:
name: Ubuntu 18.04 $TASK_NAME_SUFFIX
container:
image: ubuntu:18.04
cpu: 4
memory: 8G
timeout_in: 60m
environment:
matrix:
- TASK_NAME_SUFFIX: x86
MODEL: 32
- TASK_NAME_SUFFIX: x64
install_git_and_valgrind_script: apt-get -q update && apt-get install -yq git-core valgrind
<< : *COMMON_STEPS_TEMPLATE

# Mac
task:
name: macOS 11.x x64
osx_instance:
image: big-sur-xcode
timeout_in: 60m
environment:
OS_NAME: darwin
# override Cirrus default OS (`darwin`)
OS: osx
<< : *COMMON_STEPS_TEMPLATE

# FreeBSD
task:
name: FreeBSD 12.2 x64
freebsd_instance:
image_family: freebsd-12-2
cpu: 4
memory: 8G
timeout_in: 60m
environment:
OS_NAME: freebsd
CI_DFLAGS: -version=TARGET_FREEBSD12
install_bash_and_git_script: pkg install -y bash git
<< : *COMMON_STEPS_TEMPLATE

task:
name: FreeBSD 11.4 x64
freebsd_instance:
image_family: freebsd-11-4
cpu: 4
memory: 8G
timeout_in: 60m
environment:
OS_NAME: freebsd
HOST_DMD: dmd-2.079.0
CI_DFLAGS: -version=TARGET_FREEBSD11
install_bash_and_git_script: |
sed -i '' -e 's|pkg.FreeBSD.org|mirrors.xtom.com/freebsd-pkg|' /etc/pkg/FreeBSD.conf
pkg install -y bash git
<< : *COMMON_STEPS_TEMPLATE
48 changes: 48 additions & 0 deletions druntime/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Documentation: https://docs.codecov.io/docs/codecov-yaml

codecov:
notify:
# We don't want to wait for the CodeCov report
# See https://github.com/codecov/support/issues/312
require_ci_to_pass: false
after_n_builds: 1 # send notifications after the first upload
wait_for_ci: false

bot: dlang-bot
ci:
# https://docs.codecov.io/docs/detecting-ci-services
# Only CircleCi generates coverages files atm.
# Don't wait for the other CIs
- circleci.com
- !dtest.dlang.io
- !auto-tester.puremagic.com
- !appveyor.com
- !ci.dlang.io
- !travis-ci.org

# At CircleCi, the PR is merged into `master` before the testsuite is run.
# This allows CodeCov to adjust the resulting coverage diff, s.t. it matches
# with the GitHub diff.
# https://github.com/codecov/support/issues/363
# https://docs.codecov.io/v4.3.6/docs/comparing-commits
allow_coverage_offsets: true

coverage:
precision: 3
round: down
range: "70...100"

# Learn more at https://docs.codecov.io/docs/commit-status
status:
project: off
patch:
default:
informational: true
changes: off

notify:
webhook:
default:
url: "https://dlang-bot.herokuapp.com/codecov_hook"

comment: false
8 changes: 8 additions & 0 deletions druntime/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*.{c,cpp,h,d,di,dd}]
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
charset = utf-8
Loading

0 comments on commit 69ab16a

Please sign in to comment.