Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Fix #29: new input 'cabal-update: false' to turn off 'cabal update'
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Jan 10, 2023
1 parent 074f9de commit fab017e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 12 deletions.
12 changes: 8 additions & 4 deletions setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,20 @@ inputs:
default: 'latest'
enable-stack:
required: false
description: 'If specified, will setup Stack'
description: 'If specified, will setup Stack.'
stack-no-global:
required: false
description: 'If specified, enable-stack must be set. Prevents installing GHC and Cabal globally'
description: 'If specified, enable-stack must be set. Prevents installing GHC and Cabal globally.'
stack-setup-ghc:
required: false
description: 'If specified, enable-stack must be set. Will run stack setup to install the specified GHC'
description: 'If specified, enable-stack must be set. Will run stack setup to install the specified GHC.'
cabal-update:
required: false
default: true
description: 'Set to false to prevent `cabal update` from being run.'
disable-matcher:
required: false
description: 'If specified, disables match messages from GHC as GitHub CI annotations'
description: 'If specified, disables match messages from GHC as GitHub CI annotations.'
outputs:
ghc-path:
description: 'The path of the ghc executable _directory_'
Expand Down
6 changes: 4 additions & 2 deletions setup/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion setup/lib/opts.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion setup/lib/opts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion setup/lib/setup-haskell.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions setup/src/opts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface ProgramOpt {

export interface Options {
ghc: ProgramOpt;
cabal: ProgramOpt;
cabal: ProgramOpt & {update: boolean};
stack: ProgramOpt & {setup: boolean};
general: {matcher: {enable: boolean}};
}
Expand Down Expand Up @@ -93,6 +93,7 @@ export function getOpts(
const stackSetupGhc = (inputs['stack-setup-ghc'] || '') !== '';
const stackEnable = (inputs['enable-stack'] || '') !== '';
const matcherDisable = (inputs['disable-matcher'] || '') !== '';
const cabalUpdate = inputs['cabal-update'] !== 'false';
core.debug(`${stackNoGlobal}/${stackSetupGhc}/${stackEnable}`);
const verInpt = {
ghc: inputs['ghc-version'] || ghc.version,
Expand Down Expand Up @@ -136,7 +137,8 @@ export function getOpts(
os,
cabalEnable // if true: inform user about resolution
),
enable: cabalEnable
enable: cabalEnable,
update: cabalUpdate
},
stack: {
raw: verInpt.stack,
Expand Down
2 changes: 1 addition & 1 deletion setup/src/setup-haskell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default async function run(
// https://github.com/haskell/cabal/issues/6823
// await exec('cabal user-config update');
}
if (!opts.stack.enable) await exec('cabal update');
if (opts.cabal.update && !opts.stack.enable) await exec('cabal update');
});

core.info(`##[add-matcher]${path.join(__dirname, '..', 'matcher.json')}`);
Expand Down

0 comments on commit fab017e

Please sign in to comment.