-
Notifications
You must be signed in to change notification settings - Fork 1
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
Compilation for Linux, MacOS, and Windows #17
Conversation
of the DMD compiler imvocation to enable compilation on Windows.
to get tests passed on Windows. Added Windows specific helper function asSingleLineDosInput is for inline EAG source code tests under Windows.
as Windows is very different here to Linux and MacOS and any Unix-kind OS.
and the according tests.
as later we want to add a "release.yml".
as already contained in example tests.
@linkrope Merry Christmas! 😄 |
which adds binaries to a published GitHub release.
as "latest" fails. linkrope did it too for dmd. The versino of ldc was looked up at https://github.com/ldc-developers/ldc/releases matching the version of Frontend, druntime and Phobos to that of dmd.
as "latest" fails. linkrope did it too for dmd. The versino of ldc was looked up at https://github.com/ldc-developers/ldc/releases matching the version of Frontend, druntime and Phobos to that of dmd.
by ignoring all tags pushes as trigger.
as it is a power shell running by default, not a dos shell.
assuming those are the tags from a release publication. Otherwise, with '*' pattern, build.yml is not triggered at all.
get missed before. Maybe, another order works better...
as excluding version tags let any git push skip the build. Not clear why.
Seems, I got the publishing of the 3 different gamma executables working too. The only thing, I did not get managed is to avoid duplicate on tag pushing. It does not work as described at the GitHub Actions documentation... |
as in master, see ci.yml.
as suggested by @linkrope and using it build().
from ci.yml, to refernce them later there and in release.yml
Misused due to a misunderstanding.
based on reusable workflows used at ci.yml and passing built binaries from build job using download-artifact action.
as it all happens on Linux, no Windows runner involved anymore here as in the first workflow version.
and within twice, once for the tag pushed for release and second for the release event. This was found in https://stackoverflow.com/questions/70743715/how-do-i-configure-a-github-actions-workflow-so-it-does-not-run-on-a-tag-push
into upload.yml to have the same abstractions levels for jobs in release.yml
as it shows an operational error on push. Seems, this token is implicitely inherited.
I guess, I found a good solution now. Please review it. The release binary upload to the release page is now done using the upload/download GH Actions, as it is intended, I guess.
I set the uploaded artifact redemption period for a build to 1 day, as it is mainly needed for upload when a release is published. But we could extend it to 90 days max. What do you think? |
as suggested by @linkrope in linkrope#17 (comment). Not tested yet on Windows as locally not available, currently. Runs wel on Linux.
src/gamma/main.d
Outdated
@@ -250,3 +254,11 @@ void build(string[] fileNames, string outputDirectory) | |||
if (status) | |||
exit(status); | |||
} | |||
|
|||
string executableName(const string name) |
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.
Make it explicitly private
:
private string executableName(const string name)
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.
For my curiosity, why only this method, and not the others in main.d too?
I guess, I "copied" it from the other methods above.
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.
Done with 49328b8.
src/gamma/main.d
Outdated
return name ~ ".exe"; | ||
else | ||
return name; | ||
} |
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.
Get rid of this red "minus in circle": in VS Code, enable "insertFinalNewline"
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 do not see the red circle well in my light theme. 😉
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.
Thank for the configuration hint regarding "insertFinalNewline"! Didn't know it.
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.
Done with 49328b8.
as suggested by @linkrope.
@linkrope, I just encountered, that
Is my interpretation right? |
See: https://dub.pm/dub-reference/buildtypes/#default-examples ("optimize", "inline", debugInfo") would be nice: fast code, still with helpful diagnostics. Note that array bounds check is still enabled in release mode. There is a special build type for release builds with no bounds check. Similiarly, if you believe that contracts (pre -conditions, post-conditstions, invariants) are as valuable as bounds checks, then you should avoid release mode, where contracts are skipped. And use just "optimize" and "inline" instead. The "debug" is not about speed but about size: wouldn't you like to have debug symbols available to understand a backtrace in case of a fatal error? |
I tend to use Or should we define our own build type in dub.json?
|
Tried this in my PR detached branch and got a Linux binary that is bigger, the other binaries are smaller, see this release page. I guess, we should run the verification tests with the same build type and LCD compiled to be sure it works, isn't it? |
I tried this in this build run on the same branch as above: https://github.com/kuniss/gamma/actions/runs/7439461088 Now I'm thinking: Shouldn't we use LCD at ci.yml too? I mean, at the end we are interested in checking LCD compiled gamma is working well. That it is working well with DMD, the "developer" should check locally, isn't it? |
This has to wait until "dmd" is no longer hard-coded in main.d? Otherwise, it could be tricky to install both compilers and use ldc to run the test, while dmd is used to compile the generated compiler. |
as suggested by @linkrope in linkrope#17 (comment). Not tested yet on Windows as locally not available, currently. Runs wel on Linux.
as suggested by @linkrope in linkrope#17 (comment).
I'm going to close this PR as it was substituted by PR #18 which has in general the same content but a newer origin base. |
* Added Windows specific modifications of the DMD compiler imvocation to enable compilation on Windows. * Added executableName() for Windows' ".exe" extension as suggested by @linkrope and using it build(). * Get rid of OS specific file path separators as suggested by @linkrope in #17 (comment). * Enabled matrix build for Linux, MaxOS, and Windows and the according tests. * Renamed build.yml to ci.yml as discussed on PR here: https://github.com/linkrope/gamma/pull/17/files/11c93a9229e028f778573de87b4f478dda96f508#r1437757527 * Refactored out reusable workflows from ci.yml, to refernce them later there and in release.yml * Added uploading of built executables * Avoid CI workflow is running on release publications and within twice, once for the tag pushed for release and second for the release event. This was found in https://stackoverflow.com/questions/70743715/how-do-i-configure-a-github-actions-workflow-so-it-does-not-run-on-a-tag-push * Improved matrix names in GH Actions GUI * Refactored out upload workflow into upload.yml to have the same abstractions levels for jobs in release.yml * Attempt to optimize the built artifacts using a specific build type. * Switched to single workflow in build.yml for CI and release builds. * Get rid of DMD compiler at all for build. gamma now supports to use any $DC defined D compiler for target compiler compiling.
An example of an successful run may be found at here.
@linkrope, I created a PR to allow you to check style of the D source code adaptations, I did and to take the advantages of the GitHub PR tooling.