mirror of
https://github.com/actions/runner-images.git
synced 2025-12-16 06:40:32 +00:00
[Ubuntu] Migrate tests for Haskell to Pester (#2314)
* Add Pester tests for Haskell on Ubuntu * Add tests for all installed ghc versions * Minor fix * Minor fix * Fix number of installed ghc versions test * Fix GHC number test
This commit is contained in:
committed by
GitHub
parent
7f1a7b4177
commit
ee8132a978
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/etc-environment.sh
|
source $HELPER_SCRIPTS/etc-environment.sh
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu.
|
# Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu.
|
||||||
# https://launchpad.net/~hvr/+archive/ubuntu/ghc
|
# https://launchpad.net/~hvr/+archive/ubuntu/ghc
|
||||||
@@ -33,27 +34,8 @@ apt-get install -y cabal-install-$cabalVersion
|
|||||||
# Install the latest stable release of haskell stack
|
# Install the latest stable release of haskell stack
|
||||||
curl -sSL https://get.haskellstack.org/ | sh
|
curl -sSL https://get.haskellstack.org/ | sh
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
# Check all ghc versions
|
|
||||||
for version in ${ghcInstalledVersions[@]}; do
|
|
||||||
if ! command -v /opt/ghc/$version/bin/ghc; then
|
|
||||||
echo "ghc $version was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check cabal
|
|
||||||
if ! command -v /opt/cabal/$cabalVersion/bin/cabal; then
|
|
||||||
echo "cabal $cabalVersion was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check stack
|
|
||||||
if ! command -v stack; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create symlink for ghc and cabal in /usr/bin
|
# Create symlink for ghc and cabal in /usr/bin
|
||||||
ln -s "/opt/ghc/$defaultGHCVersion/bin/ghc" "/usr/bin/ghc"
|
ln -s "/opt/ghc/$defaultGHCVersion/bin/ghc" "/usr/bin/ghc"
|
||||||
ln -s "/opt/cabal/$cabalVersion/bin/cabal" "/usr/bin/cabal"
|
ln -s "/opt/cabal/$cabalVersion/bin/cabal" "/usr/bin/cabal"
|
||||||
|
|
||||||
|
invoke_tests "Common" "Haskell"
|
||||||
31
images/linux/scripts/tests/Common.Tests.ps1
Normal file
31
images/linux/scripts/tests/Common.Tests.ps1
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
Describe "Haskell" {
|
||||||
|
|
||||||
|
$GHCCommonPath = "/opt/ghc"
|
||||||
|
$GHCVersions = Get-ChildItem -Path $GHCCommonPath | Where-Object { $_.Name -match "\d+\.\d+" }
|
||||||
|
|
||||||
|
$testCase = @{ GHCVersions = $GHCVersions }
|
||||||
|
|
||||||
|
It "GHC directory contains three version of GHC" -TestCases $testCase {
|
||||||
|
param ([object] $GHCVersions)
|
||||||
|
$GHCVersions.Count | Should -Be 3
|
||||||
|
}
|
||||||
|
|
||||||
|
$testCases = $GHCVersions | ForEach-Object { @{ GHCPath = "${_}/bin/ghc"} }
|
||||||
|
|
||||||
|
It "GHC version <GHCPath>" -TestCases $testCases {
|
||||||
|
param ([string] $GHCPath)
|
||||||
|
"$GHCPath --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Default GHC" {
|
||||||
|
"ghc --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Cabal" {
|
||||||
|
"cabal --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Stack" {
|
||||||
|
"stack --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user