Skip to content

Commit

Permalink
Merge branch 'master' into v0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihails Strasuns committed Jan 4, 2020
2 parents 9988e1d + 2d5247d commit 48c13a0
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 20 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
dc:
[
ldc-1.17.0,
ldc-1.19.0,
ldc-latest,
ldc-beta,
ldc-master,
dmd-2.088.0,
dmd-2.089.0,
dmd-latest,
dmd-beta,
dmd-master,
Expand All @@ -45,7 +45,11 @@ jobs:

- name: Verify D compiler ($DC)
shell: bash
run: $DC .github/hello.d
run: $DC .github/hello.d && ./hello

- name: Verify D compiler ($DC, shared)
shell: bash
run: $DC -shared .github/hello.d && ./hello

- name: Verify D compiler (dub)
run: dub run --single -q .github/hello.d
25 changes: 17 additions & 8 deletions lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function dmd(version) {
: minor !== undefined && minor < 69 ? `${base_url}.windows.zip`
: `${base_url}.windows.7z`,
binpath: "\\dmd2\\windows\\bin",
libpath: "\\dmd2\\windows\\lib64",
download_dub: download_dub,
sig: `${base_url}.windows.7z.sig`
};
Expand All @@ -91,6 +92,7 @@ function dmd(version) {
: minor !== undefined && minor < 69 ? `${base_url}.linux.zip`
: `${base_url}.linux.tar.xz`,
binpath: "/dmd2/linux/bin64",
libpath: "/dmd2/linux/lib64",
download_dub: download_dub,
sig: `${base_url}.linux.tar.xz.sig`
};
Expand All @@ -101,6 +103,7 @@ function dmd(version) {
: minor !== undefined && minor < 69 ? `${base_url}.osx.zip`
: `${base_url}.osx.tar.xz`,
binpath: "/dmd2/osx/bin",
libpath: "/dmd2/linux/lib64",
download_dub: download_dub,
sig: `${base_url}.osx.tar.xz.sig`
};
Expand Down Expand Up @@ -145,9 +148,10 @@ function ldc_resolve_master(gh_token) {
});
assets = assets
.map(function (asset) {
let matches = asset["name"].match(/^ldc2?-([0-9a-fA-F]{5,12})-(.+)/);
const name = asset["name"];
const matches = name.match(/^ldc2?-([0-9a-fA-F]{5,12})[-.](.+)/);
if (!matches)
throw new Error(`Unexpected naming format for the latest LDC asset: ${latest}`);
throw new Error(`Unexpected naming format for the latest LDC asset: ${name}`);
return {
name: matches[0],
version: matches[1],
Expand All @@ -158,13 +162,15 @@ function ldc_resolve_master(gh_token) {
return asset.suffix == `${suffix}.${ext}`;
});
const latest = assets[0];
const base_path = (process.platform == "win32") ?
`\\ldc2-${latest.version}-${suffix}\\` :
`/ldc2-${latest.version}-${suffix}/`;
return {
name: "ldc2",
version: latest.version,
url: "https://github.com/ldc-developers/ldc/releases/download/CI/" + latest.name,
binpath: (process.platform == "win32") ?
`\\ldc2-${latest.version}-${suffix}\\bin` :
`/ldc2-${latest.version}-${suffix}/bin`
binpath: `${base_path}bin`,
libpath: `${base_path}lib64`
};
});
}
Expand All @@ -188,19 +194,22 @@ function ldc(version, gh_token) {
name: "ldc2",
version: version,
url: `${base_url}-windows-multilib.7z`,
binpath: `\\ldc2-${version}-windows-multilib\\bin`
binpath: `\\ldc2-${version}-windows-multilib\\bin`,
libpath: `\\ldc2-${version}-windows-multilib\\lib64`
};
case "linux": return {
name: "ldc2",
version: version,
url: `${base_url}-linux-x86_64.tar.xz`,
binpath: `/ldc2-${version}-linux-x86_64/bin`
binpath: `/ldc2-${version}-linux-x86_64/bin`,
libpath: `/ldc2-${version}-linux-x86_64/lib64`
};
case "darwin": return {
name: "ldc2",
version: version,
url: `${base_url}-osx-x86_64.tar.xz`,
binpath: `/ldc2-${version}-osx-x86_64/bin`
binpath: `/ldc2-${version}-osx-x86_64/bin`,
libpath: `/ldc2-${version}-osx-x86_64/lib64`
};
default:
throw new Error("unsupported platform: " + process.platform);
Expand Down
8 changes: 8 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ function run() {
console.log("Adding '" + binpath + "' to path");
core.addPath(binpath);
core.exportVariable("DC", descr.name);
const libpath = cached + descr.libpath;
console.log("Adding '" + libpath + "' to library path");
if (process.platform == "win32") {
core.addPath(cached + descr.libpath);
}
else {
core.exportVariable("LD_LIBRARY_PATH", libpath);
}
console.log("Done");
}
catch (error) {
Expand Down
27 changes: 18 additions & 9 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface CompilerDescription {
version: string;
url: string;
binpath: string;
libpath : string;
sig?: string;
download_dub?: boolean;
}
Expand Down Expand Up @@ -87,6 +88,7 @@ async function dmd(version: string): Promise<CompilerDescription> {
: minor !== undefined && minor < 69 ? `${base_url}.windows.zip`
: `${base_url}.windows.7z`,
binpath: "\\dmd2\\windows\\bin",
libpath: "\\dmd2\\windows\\lib64",
download_dub: download_dub,
sig: `${base_url}.windows.7z.sig`
};
Expand All @@ -97,6 +99,7 @@ async function dmd(version: string): Promise<CompilerDescription> {
: minor !== undefined && minor < 69 ? `${base_url}.linux.zip`
: `${base_url}.linux.tar.xz`,
binpath: "/dmd2/linux/bin64",
libpath: "/dmd2/linux/lib64",
download_dub: download_dub,
sig: `${base_url}.linux.tar.xz.sig`
};
Expand All @@ -107,6 +110,7 @@ async function dmd(version: string): Promise<CompilerDescription> {
: minor !== undefined && minor < 69 ? `${base_url}.osx.zip`
: `${base_url}.osx.tar.xz`,
binpath: "/dmd2/osx/bin",
libpath: "/dmd2/linux/lib64",
download_dub: download_dub,
sig: `${base_url}.osx.tar.xz.sig`
};
Expand Down Expand Up @@ -148,9 +152,10 @@ async function ldc_resolve_master(gh_token: string): Promise<CompilerDescription
});
assets = assets
.map(function(asset) {
let matches = asset["name"].match(/^ldc2?-([0-9a-fA-F]{5,12})-(.+)/);
const name = asset["name"];
const matches = name.match(/^ldc2?-([0-9a-fA-F]{5,12})[-.](.+)/);
if (!matches)
throw new Error(`Unexpected naming format for the latest LDC asset: ${latest}`);
throw new Error(`Unexpected naming format for the latest LDC asset: ${name}`);
return {
name: matches[0],
version: matches[1],
Expand All @@ -162,14 +167,15 @@ async function ldc_resolve_master(gh_token: string): Promise<CompilerDescription
});

const latest = assets[0];

const base_path = (process.platform == "win32") ?
`\\ldc2-${latest.version}-${suffix}\\` :
`/ldc2-${latest.version}-${suffix}/`;
return {
name: "ldc2",
version: latest.version,
url: "https://github.com/ldc-developers/ldc/releases/download/CI/" + latest.name,
binpath: (process.platform == "win32") ?
`\\ldc2-${latest.version}-${suffix}\\bin` :
`/ldc2-${latest.version}-${suffix}/bin`
binpath: `${base_path}bin`,
libpath: `${base_path}lib64`
};
}

Expand All @@ -195,19 +201,22 @@ async function ldc(version: string, gh_token: string): Promise<CompilerDescripti
name: "ldc2",
version: version,
url: `${base_url}-windows-multilib.7z`,
binpath: `\\ldc2-${version}-windows-multilib\\bin`
binpath: `\\ldc2-${version}-windows-multilib\\bin`,
libpath: `\\ldc2-${version}-windows-multilib\\lib64`
};
case "linux": return {
name: "ldc2",
version: version,
url: `${base_url}-linux-x86_64.tar.xz`,
binpath: `/ldc2-${version}-linux-x86_64/bin`
binpath: `/ldc2-${version}-linux-x86_64/bin`,
libpath: `/ldc2-${version}-linux-x86_64/lib64`
};
case "darwin": return {
name: "ldc2",
version: version,
url: `${base_url}-osx-x86_64.tar.xz`,
binpath: `/ldc2-${version}-osx-x86_64/bin`
binpath: `/ldc2-${version}-osx-x86_64/bin`,
libpath: `/ldc2-${version}-osx-x86_64/lib64`
};
default:
throw new Error("unsupported platform: " + process.platform);
Expand Down
9 changes: 9 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ async function run() {
console.log("Adding '" + binpath + "' to path");
core.addPath(binpath);
core.exportVariable("DC", descr.name);

const libpath = cached + descr.libpath;
console.log("Adding '" + libpath + "' to library path");
if (process.platform == "win32") {
core.addPath(cached + descr.libpath);
}
else {
core.exportVariable("LD_LIBRARY_PATH", libpath);
}
console.log("Done");
} catch (error) {
console.log(error);
Expand Down

0 comments on commit 48c13a0

Please sign in to comment.