Skip to content

Commit

Permalink
Build
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Feb 10, 2024
1 parent 649c703 commit 4382ac1
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ExecStack {
.concat(args);
}
async upgrade() {
return await exec.exec("stack", ["upgrade"]);
return await exec.exec("stack", ["upgrade"], { ignoreReturnCode: true });
}
async exec(args, options) {
return await exec.exec("stack", this.stackArguments.concat(args), options);
Expand Down Expand Up @@ -129,11 +129,10 @@ const glob_1 = __nccwpck_require__(8090);
exports.ALL_SOURCES_PATTERNS = `**\n!**${path.sep}.stack-work\n!.git\n`;
exports.BUILD_FILES_PATTERNS = `**${path.sep}package.yaml\n**${path.sep}*.cabal\n`;
async function hashProject(stackYaml) {
const workspace = process.cwd();
return {
snapshot: await (0, glob_1.hashFiles)(stackYaml, workspace),
package: await (0, glob_1.hashFiles)(exports.BUILD_FILES_PATTERNS, workspace),
sources: await (0, glob_1.hashFiles)(exports.ALL_SOURCES_PATTERNS, workspace),
snapshot: await (0, glob_1.hashFiles)(stackYaml),
package: await (0, glob_1.hashFiles)(exports.BUILD_FILES_PATTERNS),
sources: await (0, glob_1.hashFiles)(exports.ALL_SOURCES_PATTERNS),
};
}
exports.hashProject = hashProject;
Expand Down Expand Up @@ -277,8 +276,10 @@ async function run() {
await stack.upgrade();
});
const stackRoot = (await stack.parse(["path", "--stack-root]"], parse_stack_path_1.parseStackPath))["stack-root"];
core.info(`Stack root: ${stackRoot}`);
const stackYaml = (0, stack_yaml_1.readStackYamlSync)(inputs.stackYaml);
const stackWorks = (0, stack_yaml_1.packagesStackWorks)(stackYaml);
core.info(`Stack works:\n - ${stackWorks.join("\n - ")}`);
await core.group("Dependencies", async () => {
const cacheKeys = (0, get_cache_keys_1.getCacheKeys)([
inputs.cachePrefix("stack-deps", stackYaml.resolver),
Expand All @@ -303,15 +304,22 @@ async function run() {
skipOnHit: false,
});
});
if (inputs.test) {
await core.group("Test", async () => await test(stack, inputs));
}
await core.group("Test", async () => {
if (inputs.test) {
await test(stack, inputs);
}
});
const stackQuery = await stack.parse(["query", "compiler"], parse_stack_query_1.parseStackQuery);
core.setOutput("compiler", stackQuery.compiler.actual);
core.setOutput("compiler-version", stackQuery.compiler.actual.replace(/^ghc-/, ""));
const compiler = stackQuery.compiler.actual;
const compilerVersion = compiler.replace(/^ghc-/, "");
core.debug(`Setting compiler outputs: ${compiler} / ${compilerVersion}`);
core.setOutput("compiler", compiler);
core.setOutput("compiler-version", compilerVersion);
const stackPath = await stack.parse(["path"], parse_stack_path_1.parseStackPath);
for (const k in stackPath) {
core.setOutput(k, stackPath[k]);
const v = stackPath[k];
core.debug(`Setting stack-path output: ${k}=${v}`);
core.setOutput(k, v);
}
}
catch (error) {
Expand Down

0 comments on commit 4382ac1

Please sign in to comment.