Allow setting cabal version too

This commit is contained in:
Timothy Clem
2019-09-23 20:07:29 -07:00
parent 343ceb1920
commit 8cd05073c6
3 changed files with 16 additions and 1 deletions

View File

@@ -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
```

View File

@@ -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);
}

View File

@@ -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);
}