Allow setting cabal version too
This commit is contained in:
@@ -33,6 +33,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
ghc: [ '8.2.2', '8.6.5' ]
|
ghc: [ '8.2.2', '8.6.5' ]
|
||||||
|
cabal: [ '2.0', '3.0' ]
|
||||||
name: Haskell GHC ${{ matrix.ghc }} sample
|
name: Haskell GHC ${{ matrix.ghc }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
@@ -40,6 +41,7 @@ jobs:
|
|||||||
uses: actions/setup-haskell@v1
|
uses: actions/setup-haskell@v1
|
||||||
with:
|
with:
|
||||||
ghc-version: ${{ matrix.ghc }}
|
ghc-version: ${{ matrix.ghc }}
|
||||||
|
cabal-version: ${{ matrix.cabal }}
|
||||||
- run: runghc Hello.hs
|
- run: runghc Hello.hs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,16 @@ export async function cacheHaskellTool(installDir: string, tool: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function findHaskellGHCVersion(version: string) {
|
export async function findHaskellGHCVersion(version: string) {
|
||||||
|
if (!version) {
|
||||||
|
version = '8.6.5';
|
||||||
|
}
|
||||||
return _findHaskellToolVersion('ghc', version);
|
return _findHaskellToolVersion('ghc', version);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function findHaskellCabalVersion(version: string) {
|
export async function findHaskellCabalVersion(version: string) {
|
||||||
|
if (!version) {
|
||||||
|
version = '3.0';
|
||||||
|
}
|
||||||
return _findHaskellToolVersion('cabal', version);
|
return _findHaskellToolVersion('cabal', version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {findHaskellGHCVersion, cacheHaskellTool} from './installer';
|
import {
|
||||||
|
findHaskellGHCVersion,
|
||||||
|
findHaskellCabalVersion,
|
||||||
|
cacheHaskellTool
|
||||||
|
} from './installer';
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
@@ -7,6 +11,9 @@ async function run() {
|
|||||||
await cacheHaskellTool('/opt', 'cabal');
|
await cacheHaskellTool('/opt', 'cabal');
|
||||||
let ghcVersion = core.getInput('ghc-version');
|
let ghcVersion = core.getInput('ghc-version');
|
||||||
await findHaskellGHCVersion(ghcVersion);
|
await findHaskellGHCVersion(ghcVersion);
|
||||||
|
|
||||||
|
let cabalVersion = core.getInput('cabal-version');
|
||||||
|
await findHaskellCabalVersion(cabalVersion);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user