Skip to content

Commit

Permalink
Trying to make CI work
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihails Strasuns committed Sep 12, 2019
1 parent 42dc288 commit fe60581
Show file tree
Hide file tree
Showing 193 changed files with 100 additions and 14,328 deletions.
8 changes: 8 additions & 0 deletions .github/hello.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/+ dub.sdl:
name "hello"
+/

void main() {
import std.stdio;
writeln("Hello, World!");
}
32 changes: 25 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,34 @@ on: [push]

jobs:
test:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: npm install
- run: npm test

verify:
name: Verify install
strategy:
matrix:
os: [ubuntu-latest, windows-latest, osx-latest]
os: [ubuntu-latest, windows-latest, macOS-latest]
dc: [dmd-2.088.0, ldc-1.17.0]
name: Check that setting up compiler works
runs-on: ${{ matrix.os }}
steps:
- name: Install
uses: ../..
- uses: actions/checkout@master

- name: Install action dependencies
run: npm install --production

- name: Install D compiler
uses: ./
with:
compiler: #{{ matrix.dc }}
- name: Test
run: dub run --yes dub -- --help
compiler: ${{ matrix.dc }}

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

- name: Verify D compiler (dub)
run: dub run --single -q .github/hello.d
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ typings/
# Optional npm cache directory
.npm

# Node modules
node_modules

# Optional eslint cache
.eslintcache

Expand Down
14 changes: 7 additions & 7 deletions lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function dmd(version) {
name: "dmd",
version: version,
url: `http://downloads.dlang.org/releases/2.x/${version}/dmd.${version}.windows.7z`,
binpath: "/dmd2/windows/bin"
binpath: "\\dmd2\\windows\\bin"
};
case "linux": return {
name: "dmd",
Expand All @@ -42,22 +42,22 @@ function ldc(version) {
throw new Error("unrecognized DMD version:" + version);
switch (process.platform) {
case "win32": return {
name: "ldc",
name: "ldc2",
version: version,
url: `https://github.com/ldc-developers/ldc/releases/download/v${version}/ldc2-${version}-windows-multilib.7z`,
binpath: ""
binpath: `\\ldc2-${version}-windows-multilib\\bin`
};
case "linux": return {
name: "ldc",
name: "ldc2",
version: version,
url: `https://github.com/ldc-developers/ldc/releases/download/v${version}/ldc2-${version}-linux-x86_64.tar.xz`,
binpath: ""
binpath: `/ldc2-${version}-linux-x86_64/bin`
};
case "darwin": return {
name: "ldc",
name: "ldc2",
version: version,
url: `https://github.com/ldc-developers/ldc/releases/download/v${version}/ldc2-${version}-osx-x86_64.tar.xz`,
binpath: ""
binpath: `/ldc2-${version}-osx-x86_64/bin`
};
default:
throw new Error("unsupported platform: " + process.platform);
Expand Down
38 changes: 18 additions & 20 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Expand All @@ -17,7 +18,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const tc = __importStar(require("@actions/tool-cache"));
const io_1 = require("@actions/io");
const compiler_1 = require("./compiler");
function run() {
return __awaiter(this, void 0, void 0, function* () {
Expand All @@ -27,37 +27,35 @@ function run() {
const input = core.getInput('compiler');
const descr = compiler_1.compiler(input);
console.log(`Enabling ${input}`);
{
const cached = tc.find('dc', input);
if (cached) {
console.log("Using cache");
core.addPath(cached + descr.binpath);
return;
}
let cached = tc.find('dc', input);
if (cached) {
console.log("Using cache");
}
else {
console.log(`Downloading ${descr.url}`);
const archive = yield tc.downloadTool(descr.url);
core.debug("downloaded");
const dc_path = yield extract(archive);
core.debug("extracted");
cached = yield tc.cacheDir(dc_path, 'dc', input);
}
console.log(`Downloading ${descr.url}`);
const archive = yield tc.downloadTool(descr.url);
const home = process.env['HOME'];
const dest = `${home}/dc/${input}`;
yield io_1.mkdirP(dest);
const dc_path = yield extract(archive, dest);
const cached = yield tc.cacheDir(dc_path, 'dc', input);
core.addPath(cached + descr.binpath);
console.log("Done, PATH updated");
core.exportVariable("DC", descr.name);
console.log("Done");
}
catch (error) {
core.setFailed(error.message);
}
});
}
function extract(archive, dest) {
function extract(archive) {
return __awaiter(this, void 0, void 0, function* () {
switch (process.platform) {
case "win32":
return yield tc.extract7z(archive, dest);
return yield tc.extract7z(archive);
case "linux":
case "darwin":
return yield tc.extractTar(archive, dest, 'x');
return yield tc.extractTar(archive, undefined, 'x');
default:
throw new Error("unsupported platform: " + process.platform);
}
Expand Down
1 change: 0 additions & 1 deletion node_modules/.bin/semver

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/uuid

This file was deleted.

7 changes: 0 additions & 7 deletions node_modules/@actions/core/LICENSE.md

This file was deleted.

81 changes: 0 additions & 81 deletions node_modules/@actions/core/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions node_modules/@actions/core/lib/command.d.ts

This file was deleted.

66 changes: 0 additions & 66 deletions node_modules/@actions/core/lib/command.js

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/@actions/core/lib/command.js.map

This file was deleted.

Loading

0 comments on commit fe60581

Please sign in to comment.