Skip to content
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

add compiler auto to use dmd or ldc depending on architecture #79

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ steps:
- uses: actions/checkout@v2
- uses: dlang-community/setup-dlang@v1
with:
compiler: dmd-latest
compiler: auto # dmd-latest, ldc-latest, ...
- name: Run tests
run: dub test
```
Expand Down Expand Up @@ -51,6 +51,8 @@ All DMD versions of releases and pre-releases on https://downloads.dlang.org/rel

Additionally instead of a version for both DMD and LDC you can specify `-latest` to get the latest stable release of the compiler, use `-beta` to get the latest pre-release of the compiler and also use `-master` to get the newest nightly builds.

When no compiler is specified, or when it is set to `auto`, `dmd-latest` will be picked, unless it's running on a non-x86 platform (e.g. ARM), then `ldc-latest` will be picked.

Valid version examples are:
- `dmd-latest`
- `ldc-latest`
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ author: "Mihails Strasuns"
inputs:
compiler:
description: "Compiler version string, for example 'dmd-latest' or 'ldc-1.20.1'"
default: "dmd-latest"
default: "auto"
dub:
description: "DUB version string, for example 'latest' or '1.29.0'"
required: false
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ async function run() {
if (process.arch != "x64") {
default_compiler = "ldc-latest";
}
const input = core.getInput('compiler') || default_compiler;
let input = core.getInput('compiler') || 'auto';
if (input === 'auto') input = default_compiler;
if (process.arch != "x64" && input.startsWith("dmd"))
throw new Error("The dmd compiler is not supported for non-x64 architecture");

Expand Down
Loading