diff --git a/README.md b/README.md index 4e6604a..a10851a 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ jobs: strategy: matrix: ghc: [ '8.2.2', '8.6.5' ] + cabal: [ '2.0', '3.0' ] name: Haskell GHC ${{ matrix.ghc }} sample steps: - uses: actions/checkout@master @@ -40,6 +41,7 @@ jobs: uses: actions/setup-haskell@v1 with: ghc-version: ${{ matrix.ghc }} + cabal-version: ${{ matrix.cabal }} - run: runghc Hello.hs ``` diff --git a/src/installer.ts b/src/installer.ts index e63a3e3..b9b0fa5 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -17,10 +17,16 @@ export async function cacheHaskellTool(installDir: string, tool: string) { } export async function findHaskellGHCVersion(version: string) { + if (!version) { + version = '8.6.5'; + } return _findHaskellToolVersion('ghc', version); } export async function findHaskellCabalVersion(version: string) { + if (!version) { + version = '3.0'; + } return _findHaskellToolVersion('cabal', version); } diff --git a/src/setup-haskell.ts b/src/setup-haskell.ts index c643ca1..c98045f 100644 --- a/src/setup-haskell.ts +++ b/src/setup-haskell.ts @@ -1,5 +1,9 @@ import * as core from '@actions/core'; -import {findHaskellGHCVersion, cacheHaskellTool} from './installer'; +import { + findHaskellGHCVersion, + findHaskellCabalVersion, + cacheHaskellTool +} from './installer'; async function run() { try { @@ -7,6 +11,9 @@ async function run() { await cacheHaskellTool('/opt', 'cabal'); let ghcVersion = core.getInput('ghc-version'); await findHaskellGHCVersion(ghcVersion); + + let cabalVersion = core.getInput('cabal-version'); + await findHaskellCabalVersion(cabalVersion); } catch (error) { core.setFailed(error.message); }