-
-
Notifications
You must be signed in to change notification settings - Fork 147
Switch to CircleCi #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to CircleCi #233
Changes from all commits
c2df4f6
ac20b7c
0c861c4
08c6edf
10f5376
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -uexo pipefail | ||
|
|
||
| HOST_DMD_VER=2.072.2 # same as in dmd/src/posix.mak | ||
| TRAVIS_BRANCH=${TRAVIS_BRANCH:-master} | ||
| DMD="../dmd/src/dmd" | ||
| CURL_USER_AGENT="CirleCI $(curl --version | head -n 1)" | ||
| N=2 | ||
| CIRCLE_NODE_INDEX=${CIRCLE_NODE_INDEX:-0} | ||
|
|
||
| case $CIRCLE_NODE_INDEX in | ||
| 0) MODEL=64 ;; | ||
| 1) MODEL=32 ;; | ||
| esac | ||
|
|
||
| install_deps() { | ||
| if [ $MODEL -eq 32 ]; then | ||
| sudo apt-get update | ||
| sudo apt-get install g++-multilib | ||
| fi | ||
|
|
||
| for i in {0..4}; do | ||
| if curl -fsS -A "$CURL_USER_AGENT" --max-time 5 https://dlang.org/install.sh -O || | ||
| curl -fsS -A "$CURL_USER_AGENT" --max-time 5 https://nightlies.dlang.org/install.sh -O ; then | ||
| break | ||
| elif [ $i -ge 4 ]; then | ||
| sleep $((1 << $i)) | ||
| else | ||
| echo 'Failed to download install script' 1>&2 | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash install.sh dmd-$HOST_DMD_VER --activate)" | ||
| $DC --version | ||
| env | ||
| } | ||
|
|
||
| clone() { | ||
| local url="$1" | ||
| local path="$2" | ||
| local branch="$3" | ||
| for i in {0..4}; do | ||
| if git clone --depth=1 --branch "$branch" "$url" "$path"; then | ||
| break | ||
| elif [ $i -lt 4 ]; then | ||
| sleep $((1 << $i)) | ||
| else | ||
| echo "Failed to clone: ${url}" | ||
| exit 1 | ||
| fi | ||
| done | ||
| } | ||
|
|
||
| test_rdmd() { | ||
| # run rdmd internal tests | ||
| rdmd --compiler=$DMD -m$MODEL -main -unittest rdmd.d | ||
|
|
||
| # compile rdmd & testsuite | ||
| $DMD -m$MODEL rdmd.d | ||
| $DMD -m$MODEL rdmd_test.d | ||
|
|
||
| # run rdmd testsuite | ||
| ./rdmd_test --compiler=$DMD | ||
| } | ||
|
|
||
| setup_repos() | ||
| { | ||
| local base_branch="master" | ||
| if [ -n "${CIRCLE_PR_NUMBER:-}" ]; then | ||
| base_branch=$((curl -fsSL https://api.github.com/repos/dlang/tools/pulls/$CIRCLE_PR_NUMBER || echo) | jq -r '.base.ref') | ||
| else | ||
| base_branch=$CIRCLE_BRANCH | ||
| fi | ||
| # merge upstream branch with changes, s.t. we check with the latest changes | ||
| if [ -n "${CIRCLE_PR_NUMBER:-}" ]; then | ||
| local current_branch=$(git rev-parse --abbrev-ref HEAD) | ||
| git config user.name dummyuser | ||
| git config user.email dummyuser@dummyserver.com | ||
| git remote add upstream https://github.com/dlang/tools.git | ||
| git fetch upstream | ||
| git checkout -f upstream/$base_branch | ||
| git merge -m "Automatic merge" $current_branch | ||
| fi | ||
|
|
||
| for repo in dmd druntime phobos dlang.org installer ; do | ||
| if [ ! -d "../${repo}" ] ; then | ||
| if [ $TRAVIS_BRANCH != master ] && [ $TRAVIS_BRANCH != stable ] && | ||
| ! git ls-remote --exit-code --heads https://github.com/dlang/$proj.git $TRAVIS_BRANCH > /dev/null; then | ||
| # use master as fallback for other repos to test feature branches | ||
| clone https://github.com/dlang/${repo}.git ../${repo} master | ||
| else | ||
| clone https://github.com/dlang/${repo}.git ../${repo} $TRAVIS_BRANCH | ||
| fi | ||
| fi | ||
| done | ||
|
|
||
| make -j$N -C ../dmd/src -f posix.mak MODEL=$MODEL HOST_DMD=dmd all | ||
| make -j$N -C ../druntime -f posix.mak MODEL=$MODEL HOST_DMD=$DMD | ||
| make -j$N -C ../phobos -f posix.mak MODEL=$MODEL HOST_DMD=$DMD | ||
| } | ||
|
|
||
| build_tools() | ||
| { | ||
| # TODO: fix changed | ||
| make -f posix.mak catdoc ddemangle detab dget dman dustmite tolf | ||
| } | ||
|
|
||
| case $1 in | ||
| install-deps) install_deps ;; | ||
| setup-repos) setup_repos ;; | ||
| build-tools) build_tools;; | ||
| test-rdmd) test_rdmd ;; | ||
| *) echo "Unknown command"; exit 1;; | ||
| esac | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lots of boilerplate that's going to need to be kept in sync across repos. Any ideas on DRY?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, how feasible is to have a single script file that works with both Travis and Circle CI? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| dependencies: | ||
| pre: | ||
| - ./circle.sh install-deps | ||
| cache_directories: | ||
| - "~/dlang" | ||
|
|
||
| test: | ||
| override: | ||
| - ./circle.sh setup-repos | ||
| - ./circle.sh build-tools | ||
| - ./circle.sh test_rdmd |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,13 @@ void main(string[] args) | |
| "concurrency", &concurrencyTest, | ||
| ); | ||
|
|
||
| // if the compiler contains a dir separator, it's not the in the global PATH | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there is some grammar bug here |
||
| // but a relative path | ||
| // an absolute path or executable in the PATH is required as the test suite | ||
| // used chdir | ||
| if (compiler.canFind(dirSeparator)) | ||
| compiler = compiler.asAbsolutePath.array; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just |
||
|
|
||
| enforce(rdmd.exists, "Path to rdmd does not exist: %s".format(rdmd)); | ||
|
|
||
| rdmdApp = tempDir().buildPath("rdmd_app_") ~ binExt; | ||
|
|
@@ -347,15 +354,20 @@ void runTests() | |
| assert(res.status == 0, res.output); | ||
| assert(!res.output.canFind("compile_force_src")); | ||
|
|
||
| auto fullCompilerPath = environment["PATH"] | ||
| .splitter(pathSeparator) | ||
| .map!(dir => dir.buildPath(compiler ~ binExt)) | ||
| .filter!exists | ||
| .front; | ||
| // for absolute compiler path, we make the path relative again | ||
| string fullCompilerPath = void; | ||
| if (compiler.isAbsolute) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess technically this wasn't necessary since |
||
| fullCompilerPath = compiler.asRelativePath(getcwd()).array; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, why is this branch computing a relative path when the other branch is computing an absolute one? |
||
| else | ||
| fullCompilerPath = environment["PATH"] | ||
| .splitter(pathSeparator) | ||
| .map!(dir => dir.buildPath(compiler ~ binExt)) | ||
| .filter!exists | ||
| .front; | ||
|
|
||
| res = execute([rdmdApp, "--compiler=" ~ fullCompilerPath, forceSrc]); | ||
| assert(res.status == 0, res.output ~ "\nCan't run with --compiler=" ~ fullCompilerPath); | ||
| assert(res.output.canFind("compile_force_src")); | ||
| assert(res.output.canFind("compile_force_src"), "Can't find compile_force_src"); | ||
|
|
||
| // Create an empty temporary directory and clean it up when exiting scope | ||
| static struct TmpDir | ||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about these changes - on one hand if the script wasn't building no idea if it was actually used any more, on the other hand this needs to work correctly so that unzipping .zip files on POSIX results in the correct attributes being set for files, and I doubt this is tested automatically anywhere right now. @MartinNowak ?