mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
[Ubuntu] Migrate tests to Pester (#2340)
* Add Pester tests * Fix incorrect merging * Remove swift test from installing script * Minor fix * Remove Haskell tests from commons tests * Fix selenium test * Fix SVN test * Fix pipx tests * Debug * Fix pipx packages test * Skip pipx for 16.04
This commit is contained in:
committed by
GitHub
parent
f58f2c1e02
commit
0a768b0726
@@ -4,6 +4,8 @@
|
|||||||
## Desc: Installs Mono
|
## Desc: Installs Mono
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
LSB_CODENAME=$(lsb_release -cs)
|
LSB_CODENAME=$(lsb_release -cs)
|
||||||
|
|
||||||
# Test to see if the software in question is already installed, if not install it
|
# Test to see if the software in question is already installed, if not install it
|
||||||
@@ -14,13 +16,4 @@ echo "deb https://download.mono-project.com/repo/ubuntu stable-$LSB_CODENAME mai
|
|||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y --no-install-recommends apt-transport-https mono-complete nuget
|
apt-get install -y --no-install-recommends apt-transport-https mono-complete nuget
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Tools" "Mono"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v mono; then
|
|
||||||
echo "mono was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! command -v nuget; then
|
|
||||||
echo "nuget was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
## Desc: Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017)
|
## Desc: Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017)
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
export ACCEPT_EULA=Y
|
export ACCEPT_EULA=Y
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
@@ -11,8 +13,4 @@ apt-get install -y mssql-tools unixodbc-dev
|
|||||||
apt-get -f install
|
apt-get -f install
|
||||||
ln -s /opt/mssql-tools/bin/* /usr/local/bin/
|
ln -s /opt/mssql-tools/bin/* /usr/local/bin/
|
||||||
|
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
invoke_tests "Tools" "MSSQLCommandLineTools"
|
||||||
if ! command -v sqlcmd; then
|
|
||||||
echo "sqlcmd was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
## Desc: Installs MySQL Client
|
## Desc: Installs MySQL Client
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
|
||||||
export ACCEPT_EULA=Y
|
export ACCEPT_EULA=Y
|
||||||
|
|
||||||
if isUbuntu16 || isUbuntu18 ; then
|
if isUbuntu16 || isUbuntu18 ; then
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
## Desc: Install tools via pipx
|
## Desc: Install tools via pipx
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
export PATH="$PATH:/opt/pipx_bin"
|
export PATH="$PATH:/opt/pipx_bin"
|
||||||
|
|
||||||
@@ -21,10 +22,6 @@ for package in $pipx_packages; do
|
|||||||
pipx install $package
|
pipx install $package
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
|
||||||
cmd=$(jq -r ".pipx[] | select(.package == \"$package\") .cmd" $toolset)
|
|
||||||
if ! command -v $cmd; then
|
|
||||||
echo "$package was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
invoke_tests "Common" "PipxPackages"
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# install R
|
# install R
|
||||||
osLabel=$(getOSVersionLabel)
|
osLabel=$(getOSVersionLabel)
|
||||||
@@ -11,4 +12,5 @@ sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $osLab
|
|||||||
|
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install r-base
|
sudo apt install r-base
|
||||||
version=$(R --version | grep "R version" | cut -d " " -f 3)
|
|
||||||
|
invoke_tests "Tools" "R"
|
||||||
@@ -4,9 +4,13 @@
|
|||||||
## Desc: Installs sbt
|
## Desc: Installs sbt
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Install sbt
|
# Install sbt
|
||||||
# https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html
|
# https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html
|
||||||
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
|
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
|
||||||
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add
|
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add
|
||||||
apt-get -q update
|
apt-get -q update
|
||||||
apt-get -y install sbt
|
apt-get -y install sbt
|
||||||
|
|
||||||
|
invoke_tests "Tools" "Sbt"
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
## Desc: Installs selenium server
|
## Desc: Installs selenium server
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Determine latest selenium standalone server version
|
# Determine latest selenium standalone server version
|
||||||
SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/releases/latest
|
SELENIUM_LATEST_VERSION_URL=https://api.github.com/repos/SeleniumHQ/selenium/releases/latest
|
||||||
SELENIUM_VERSION=$(curl $SELENIUM_LATEST_VERSION_URL | jq '.name' | tr -d '"' | cut -d ' ' -f 2)
|
SELENIUM_VERSION=$(curl $SELENIUM_LATEST_VERSION_URL | jq '.name' | tr -d '"' | cut -d ' ' -f 2)
|
||||||
@@ -14,12 +16,8 @@ echo "Downloading selenium-server-standalone v$SELENIUM_VERSION..."
|
|||||||
SELENIUM_JAR_NAME="selenium-server-standalone-$SELENIUM_VERSION.jar"
|
SELENIUM_JAR_NAME="selenium-server-standalone-$SELENIUM_VERSION.jar"
|
||||||
wget https://selenium-release.storage.googleapis.com/$SELENIUM_VERSION_MAJOR_MINOR/$SELENIUM_JAR_NAME
|
wget https://selenium-release.storage.googleapis.com/$SELENIUM_VERSION_MAJOR_MINOR/$SELENIUM_JAR_NAME
|
||||||
|
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if [ ! -f "$SELENIUM_JAR_NAME" ]; then
|
|
||||||
echo "Selenium server was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
SELENIUM_JAR_PATH="/usr/share/java/selenium-server-standalone.jar"
|
SELENIUM_JAR_PATH="/usr/share/java/selenium-server-standalone.jar"
|
||||||
mv $SELENIUM_JAR_NAME $SELENIUM_JAR_PATH
|
mv $SELENIUM_JAR_NAME $SELENIUM_JAR_PATH
|
||||||
echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH" | tee -a /etc/environment
|
echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH" | tee -a /etc/environment
|
||||||
|
|
||||||
|
invoke_tests "Tools" "Selenium"
|
||||||
@@ -4,5 +4,9 @@
|
|||||||
## Desc: Installs Sphinx
|
## Desc: Installs Sphinx
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Install Sphinx
|
# Install Sphinx
|
||||||
apt-get install -y sphinxsearch
|
apt-get install -y sphinxsearch
|
||||||
|
|
||||||
|
invoke_tests "Tools" "Sphinx"
|
||||||
@@ -4,12 +4,9 @@
|
|||||||
## Desc: Installs Subversion client
|
## Desc: Installs Subversion client
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Install Subversion
|
# Install Subversion
|
||||||
apt-get install -y --no-install-recommends subversion
|
apt-get install -y --no-install-recommends subversion
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Tools" "SVN"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v svn; then
|
|
||||||
echo "Subversion (svn) was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
## Desc: Installs Swift
|
## Desc: Installs Swift
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
image_label="$(lsb_release -rs)"
|
image_label="$(lsb_release -rs)"
|
||||||
swift_version=$(curl -s -L -N https://swift.org/download|awk -F"[ <]" '/id="swift-/ {print $4; exit}')
|
swift_version=$(curl -s -L -N https://swift.org/download|awk -F"[ <]" '/id="swift-/ {print $4; exit}')
|
||||||
@@ -20,14 +22,4 @@ ln -s "$SWIFT_BIN" /usr/local/bin/swift
|
|||||||
ln -s "$SWIFTC_BIN" /usr/local/bin/swiftc
|
ln -s "$SWIFTC_BIN" /usr/local/bin/swiftc
|
||||||
echo "SWIFT_PATH=$SWIFT_PATH" | tee -a /etc/environment
|
echo "SWIFT_PATH=$SWIFT_PATH" | tee -a /etc/environment
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Common" "Swift"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v swift; then
|
|
||||||
echo "Swift was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v swiftc; then
|
|
||||||
echo "Swiftc is not linked to swift binary"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -1,11 +1,8 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Install Swig
|
# Install Swig
|
||||||
sudo apt-get install -y swig
|
sudo apt-get install -y swig
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Tools" "Swig"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v swig; then
|
|
||||||
echo "Swig was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -4,15 +4,12 @@
|
|||||||
## Desc: Installs terraform
|
## Desc: Installs terraform
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Install Terraform
|
# Install Terraform
|
||||||
TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version)
|
TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version)
|
||||||
curl -LO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
|
curl -LO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
|
||||||
unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -d /usr/local/bin
|
unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -d /usr/local/bin
|
||||||
rm -f "terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
|
rm -f "terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Tools" "Terraform"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v terraform; then
|
|
||||||
echo "Terraform was not installed or found on PATH"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
# Source the helpers for use with the script
|
# Source the helpers for use with the script
|
||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Set env variable for vcpkg
|
# Set env variable for vcpkg
|
||||||
VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg
|
VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg
|
||||||
@@ -29,9 +30,4 @@ if isUbuntu16; then
|
|||||||
ln -sf g++-5 /usr/bin/g++
|
ln -sf g++-5 /usr/bin/g++
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Tools" "Vcpkg"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v vcpkg; then
|
|
||||||
echo "vcpkg was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -28,3 +28,21 @@ Describe "PHP" {
|
|||||||
"pecl" | Should -ReturnZeroExitCode
|
"pecl" | Should -ReturnZeroExitCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Describe "Swift" {
|
||||||
|
It "swift" {
|
||||||
|
"swift --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
|
||||||
|
It "swiftc" {
|
||||||
|
"swiftc --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "PipxPackages" -Skip:(Test-IsUbuntu16) {
|
||||||
|
[array]$testCases = (Get-ToolsetContent).pipx | ForEach-Object { @{cmd = $_.cmd} }
|
||||||
|
|
||||||
|
It "<package>" -TestCases $testCases {
|
||||||
|
"$cmd --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -163,6 +163,70 @@ Describe "gfortran" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Describe "Mono" {
|
||||||
|
It "mono" {
|
||||||
|
"mono --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
|
||||||
|
It "nuget" {
|
||||||
|
"nuget" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "MSSQLCommandLineTools" {
|
||||||
|
It "sqlcmd" {
|
||||||
|
"sqlcmd -?" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "R" {
|
||||||
|
It "r" {
|
||||||
|
"R --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Sbt" {
|
||||||
|
It "sbt" {
|
||||||
|
"sbt --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Sphinx" {
|
||||||
|
It "sphinx" {
|
||||||
|
"searchd -h" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Selenium" {
|
||||||
|
It "Selenium Server 'selenium-server-standalone.jar' is installed" {
|
||||||
|
"/usr/share/java/selenium-server-standalone.jar" | Should -Exist
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "SVN" {
|
||||||
|
It "svn" {
|
||||||
|
"svn --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Swig" {
|
||||||
|
It "swig" {
|
||||||
|
"swig -version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Terraform" {
|
||||||
|
It "terraform" {
|
||||||
|
"terraform --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Vcpkg" {
|
||||||
|
It "vcpkg" {
|
||||||
|
"vcpkg version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Describe "Git" {
|
Describe "Git" {
|
||||||
It "git" {
|
It "git" {
|
||||||
"git --version" | Should -ReturnZeroExitCode
|
"git --version" | Should -ReturnZeroExitCode
|
||||||
|
|||||||
@@ -264,6 +264,7 @@
|
|||||||
"{{template_dir}}/scripts/installers/pipx-packages.sh"
|
"{{template_dir}}/scripts/installers/pipx-packages.sh"
|
||||||
],
|
],
|
||||||
"environment_vars": [
|
"environment_vars": [
|
||||||
|
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
|
||||||
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}"
|
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}"
|
||||||
],
|
],
|
||||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
|||||||
@@ -264,6 +264,7 @@
|
|||||||
"{{template_dir}}/scripts/installers/pipx-packages.sh"
|
"{{template_dir}}/scripts/installers/pipx-packages.sh"
|
||||||
],
|
],
|
||||||
"environment_vars": [
|
"environment_vars": [
|
||||||
|
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
|
||||||
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}"
|
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}"
|
||||||
],
|
],
|
||||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||||
|
|||||||
Reference in New Issue
Block a user