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 b52c996 commit b57cfe0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ const with_cache_1 = __nccwpck_require__(4739);
function setOutputs(stackQuery, stackPath) {
core.setOutput("compiler", stackQuery.compiler.actual);
core.setOutput("compiler-version", stackQuery.compiler.actual.replace(/^ghc-/, ""));
for (const k in stackPath) {
core.setOutput(k, stackPath[k]);
}
}
async function dependencies(stack, inputs) {
await stack.exec(["setup"].concat(inputs.stackSetupArguments));
Expand Down Expand Up @@ -280,32 +277,32 @@ async function run() {
const stackWorks = (0, parse_stack_query_1.getLocalStackWorks)(stackQuery, [stackWork]);
core.info(`Found .stack-works:\n - ${stackWorks.join("\n - ")}`);
const hashes = await (0, hash_project_1.hashProject)(inputs.stackYaml);
core.group("Dependencies", async () => {
await core.group("Dependencies", async () => {
const cacheKeys = (0, get_cache_keys_1.getCacheKeys)([
inputs.cachePrefix("stack-deps", stackQuery.compiler.actual),
hashes.snapshot,
hashes.package,
]);
const cachePaths = [stackPath["stack-root"], stackPath.programs].concat(stackWorks);
await (0, with_cache_1.withCache)(cachePaths, cacheKeys, async () => await dependencies(stack, inputs), {
await (0, with_cache_1.withCache)(cachePaths, cacheKeys, dependencies(stack, inputs), {
...with_cache_1.DEFAULT_CACHE_OPTIONS,
skipOnHit: !inputs.cacheSaveAlways,
});
});
core.group("Build", async () => {
await core.group("Build", async () => {
const cacheKeys = (0, get_cache_keys_1.getCacheKeys)([
inputs.cachePrefix("stack-deps", stackQuery.compiler.actual),
hashes.snapshot,
hashes.package,
hashes.sources,
]);
await (0, with_cache_1.withCache)(stackWorks, cacheKeys, async () => await build(stack, inputs), {
await (0, with_cache_1.withCache)(stackWorks, cacheKeys, build(stack, inputs), {
...with_cache_1.DEFAULT_CACHE_OPTIONS,
skipOnHit: !inputs.cacheSaveAlways,
});
});
if (inputs.test) {
core.group("Test", async () => await test(stack, inputs));
await core.group("Test", async () => await test(stack, inputs));
}
}
catch (error) {
Expand Down Expand Up @@ -460,7 +457,7 @@ async function withCache(paths, keys, act, options = exports.DEFAULT_CACHE_OPTIO
return;
}
try {
return await act();
return await act;
}
finally {
await cacheDelegate.saveCache(paths, keys.primaryKey);
Expand Down

0 comments on commit b57cfe0

Please sign in to comment.