mirror of
https://github.com/actions/runner-images.git
synced 2025-12-14 13:17:54 +00:00
[Ubuntu] Migrate tests for common tools to Pester (part 1) (#2288)
* add common tools tests pt1 * fix tests * fix erlang test * resolve comments * minor changes * remove extra logging
This commit is contained in:
committed by
GitHub
parent
7ff71c853d
commit
a9a236f7e5
@@ -10,5 +10,4 @@ source $HELPER_SCRIPTS/invoke-tests.sh
|
|||||||
apt-get update -y
|
apt-get update -y
|
||||||
apt-get install -y p7zip p7zip-full p7zip-rar
|
apt-get install -y p7zip p7zip-full p7zip-rar
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
|
||||||
invoke_tests "Tools" "7-Zip"
|
invoke_tests "Tools" "7-Zip"
|
||||||
@@ -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
|
||||||
|
|
||||||
# ppa:ansible/ansible doesn't contain packages for Ubuntu20.04
|
# ppa:ansible/ansible doesn't contain packages for Ubuntu20.04
|
||||||
if isUbuntu16 || isUbuntu18 ; then
|
if isUbuntu16 || isUbuntu18 ; then
|
||||||
@@ -16,9 +17,4 @@ fi
|
|||||||
# Install latest Ansible
|
# Install latest Ansible
|
||||||
apt-get install -y --no-install-recommends ansible
|
apt-get install -y --no-install-recommends ansible
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Tools" "Ansible"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v ansible; then
|
|
||||||
echo "Ansible was not installed or found on PATH"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -18,5 +18,4 @@ tar zxvf /tmp/azcopy.tar.gz --strip-components=1 -C /tmp
|
|||||||
mv /tmp/azcopy /usr/local/bin/azcopy10
|
mv /tmp/azcopy /usr/local/bin/azcopy10
|
||||||
chmod +x /usr/local/bin/azcopy10
|
chmod +x /usr/local/bin/azcopy10
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
|
||||||
invoke_tests "Tools" "azcopy"
|
invoke_tests "Tools" "azcopy"
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
## Desc: Installs Bazel and Bazelisk (A user-friendly launcher for Bazel)
|
## Desc: Installs Bazel and Bazelisk (A user-friendly launcher for Bazel)
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# Install bazel
|
# Install bazel
|
||||||
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
|
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
|
||||||
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
|
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
|
||||||
@@ -13,14 +15,4 @@ apt-get install -y bazel
|
|||||||
# Install bazelisk
|
# Install bazelisk
|
||||||
npm install -g @bazel/bazelisk
|
npm install -g @bazel/bazelisk
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Tools" "Bazel"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v bazel; then
|
|
||||||
echo "Bazel was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v bazelisk; then
|
|
||||||
echo "Bazelisk was not installed"
|
|
||||||
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
|
||||||
|
|
||||||
function InstallClang {
|
function InstallClang {
|
||||||
local version=$1
|
local version=$1
|
||||||
@@ -17,15 +18,6 @@ function InstallClang {
|
|||||||
else
|
else
|
||||||
apt-get install -y "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version"
|
apt-get install -y "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
for cmd in clang-$version clang++-$version; do
|
|
||||||
if ! command -v $cmd; then
|
|
||||||
echo "$cmd was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetDefaultClang {
|
function SetDefaultClang {
|
||||||
@@ -41,15 +33,10 @@ function SetDefaultClang {
|
|||||||
wget https://apt.llvm.org/llvm.sh
|
wget https://apt.llvm.org/llvm.sh
|
||||||
chmod +x llvm.sh
|
chmod +x llvm.sh
|
||||||
|
|
||||||
if isUbuntu16 || isUbuntu18; then
|
toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json"
|
||||||
versions=( "6.0" "8" "9" )
|
|
||||||
default_clang_version="9"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if isUbuntu20 ; then
|
versions=$(jq -r '.clang.versions[]' $toolset)
|
||||||
versions=( "8" "9" "10" )
|
default_clang_version=$(jq -r '.clang.default_version' $toolset)
|
||||||
default_clang_version="10"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for version in ${versions[*]}; do
|
for version in ${versions[*]}; do
|
||||||
InstallClang $version
|
InstallClang $version
|
||||||
@@ -57,3 +44,5 @@ done
|
|||||||
|
|
||||||
SetDefaultClang $default_clang_version
|
SetDefaultClang $default_clang_version
|
||||||
rm llvm.sh
|
rm llvm.sh
|
||||||
|
|
||||||
|
invoke_tests "Tools" "clang"
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
## Desc: Installs CMake
|
## Desc: Installs CMake
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
# 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
|
||||||
echo "Checking to see if the installer script has already been run"
|
echo "Checking to see if the installer script has already been run"
|
||||||
if command -v cmake; then
|
if command -v cmake; then
|
||||||
@@ -16,9 +18,4 @@ else
|
|||||||
&& rm cmakeinstall.sh
|
&& rm cmakeinstall.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Tools" "Cmake"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v cmake; then
|
|
||||||
echo "cmake was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
## Desc: Installs erlang
|
## Desc: Installs erlang
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
source_list=/etc/apt/sources.list.d/eslerlang.list
|
source_list=/etc/apt/sources.list.d/eslerlang.list
|
||||||
|
|
||||||
# Install Erlang
|
# Install Erlang
|
||||||
@@ -17,14 +19,7 @@ wget -q -O rebar3 https://s3.amazonaws.com/rebar3/rebar3
|
|||||||
chmod +x rebar3
|
chmod +x rebar3
|
||||||
mv rebar3 /usr/local/bin/rebar3
|
mv rebar3 /usr/local/bin/rebar3
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
invoke_tests "Tools" "erlang"
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
for cmd in erl erlc rebar3; do
|
|
||||||
if ! command -v $cmd; then
|
|
||||||
echo "$cmd was not installed or not found on PATH"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Clean up source list
|
# Clean up source list
|
||||||
rm $source_list
|
rm $source_list
|
||||||
|
|||||||
@@ -6,35 +6,25 @@
|
|||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
function InstallGcc {
|
function InstallGcc {
|
||||||
version=$1
|
version=$1
|
||||||
|
|
||||||
echo "Installing $version..."
|
echo "Installing $version..."
|
||||||
apt-get install $version -y
|
apt-get install $version -y
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v $version; then
|
|
||||||
echo "$version was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install GNU C++ compiler
|
# Install GNU C++ compiler
|
||||||
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
|
|
||||||
versions=(
|
toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json"
|
||||||
"g++-7"
|
|
||||||
"g++-8"
|
|
||||||
"g++-9"
|
|
||||||
)
|
|
||||||
|
|
||||||
if ! isUbuntu16; then
|
versions=$(jq -r '.gcc.versions[]' $toolset)
|
||||||
versions+=("g++-10")
|
|
||||||
fi
|
|
||||||
|
|
||||||
for version in ${versions[*]}; do
|
for version in ${versions[*]}; do
|
||||||
InstallGcc $version
|
InstallGcc $version
|
||||||
done
|
done
|
||||||
|
|
||||||
|
invoke_tests "Tools" "gcc"
|
||||||
@@ -3,36 +3,27 @@
|
|||||||
## File: gfortran.sh
|
## File: gfortran.sh
|
||||||
## Desc: Installs GNU Fortran
|
## Desc: Installs GNU Fortran
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
source $HELPER_SCRIPTS/os.sh
|
source $HELPER_SCRIPTS/os.sh
|
||||||
|
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||||
|
|
||||||
function InstallFortran {
|
function InstallFortran {
|
||||||
version=$1
|
version=$1
|
||||||
|
|
||||||
echo "Installing $version..."
|
echo "Installing $version..."
|
||||||
apt-get install $version -y
|
apt-get install $version -y
|
||||||
|
|
||||||
# Run tests to determine that the software installed as expected
|
|
||||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
|
||||||
if ! command -v $version; then
|
|
||||||
echo "$version was not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install GNU Fortran compiler
|
# Install GNU Fortran compiler
|
||||||
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
|
|
||||||
versions=(
|
toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json"
|
||||||
"gfortran-8"
|
versions=$(jq -r '.gfortran.versions[]' $toolset)
|
||||||
"gfortran-9"
|
|
||||||
)
|
|
||||||
|
|
||||||
if ! isUbuntu16; then
|
|
||||||
versions+=("gfortran-10")
|
|
||||||
fi
|
|
||||||
|
|
||||||
for version in ${versions[*]}
|
for version in ${versions[*]}
|
||||||
do
|
do
|
||||||
InstallFortran $version
|
InstallFortran $version
|
||||||
done
|
done
|
||||||
|
|
||||||
|
invoke_tests "Tools" "gfortran"
|
||||||
@@ -15,3 +15,73 @@ Describe "azcopy" {
|
|||||||
"azcopy10 --version" | Should -ReturnZeroExitCode
|
"azcopy10 --version" | Should -ReturnZeroExitCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Describe "Ansible" {
|
||||||
|
It "Ansible" {
|
||||||
|
"ansible --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Bazel" {
|
||||||
|
It "<ToolName>" -TestCases @(
|
||||||
|
@{ ToolName = "bazel" }
|
||||||
|
@{ ToolName = "bazelisk" }
|
||||||
|
) {
|
||||||
|
"$ToolName --version"| Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "clang" {
|
||||||
|
[array]$testCases = (Get-ToolsetContent).clang.Versions | ForEach-Object { @{ClangVersion = $_} }
|
||||||
|
|
||||||
|
It "clang <ClangVersion>" -TestCases $testCases {
|
||||||
|
param (
|
||||||
|
[string] $ClangVersion
|
||||||
|
)
|
||||||
|
|
||||||
|
"clang-$ClangVersion --version" | Should -ReturnZeroExitCode
|
||||||
|
"clang++-$ClangVersion --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "Cmake" {
|
||||||
|
It "cmake" {
|
||||||
|
"cmake --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "erlang" {
|
||||||
|
$testCases = @("erl", "erlc", "rebar3") | ForEach-Object { @{ErlangCommand = $_} }
|
||||||
|
|
||||||
|
It "erlang <ErlangCommand>" -TestCases $testCases {
|
||||||
|
param (
|
||||||
|
[string] $ErlangCommand
|
||||||
|
)
|
||||||
|
|
||||||
|
"$ErlangCommand -v" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "gcc" {
|
||||||
|
[array]$testCases = (Get-ToolsetContent).gcc.Versions | ForEach-Object { @{GccVersion = $_} }
|
||||||
|
|
||||||
|
It "gcc <GccVersion>" -TestCases $testCases {
|
||||||
|
param (
|
||||||
|
[string] $GccVersion
|
||||||
|
)
|
||||||
|
|
||||||
|
"$GccVersion --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Describe "gfortran" {
|
||||||
|
[array]$testCases = (Get-ToolsetContent).gfortran.Versions | ForEach-Object { @{GfortranVersion = $_} }
|
||||||
|
|
||||||
|
It "gfortran <GfortranVersion>" -TestCases $testCases {
|
||||||
|
param (
|
||||||
|
[string] $GfortranVersion
|
||||||
|
)
|
||||||
|
|
||||||
|
"$GfortranVersion --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -214,5 +214,26 @@
|
|||||||
"3.1",
|
"3.1",
|
||||||
"5.0"
|
"5.0"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"clang": {
|
||||||
|
"versions": [
|
||||||
|
"6.0",
|
||||||
|
"8",
|
||||||
|
"9"
|
||||||
|
],
|
||||||
|
"default_version": "9"
|
||||||
|
},
|
||||||
|
"gcc": {
|
||||||
|
"versions": [
|
||||||
|
"g++-7",
|
||||||
|
"g++-8",
|
||||||
|
"g++-9"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gfortran": {
|
||||||
|
"versions": [
|
||||||
|
"gfortran-8",
|
||||||
|
"gfortran-9"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,5 +218,28 @@
|
|||||||
"3.1",
|
"3.1",
|
||||||
"5.0"
|
"5.0"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"clang": {
|
||||||
|
"versions": [
|
||||||
|
"6.0",
|
||||||
|
"8",
|
||||||
|
"9"
|
||||||
|
],
|
||||||
|
"default_version": "9"
|
||||||
|
},
|
||||||
|
"gcc": {
|
||||||
|
"versions": [
|
||||||
|
"g++-7",
|
||||||
|
"g++-8",
|
||||||
|
"g++-9",
|
||||||
|
"g++-10"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gfortran": {
|
||||||
|
"versions": [
|
||||||
|
"gfortran-8",
|
||||||
|
"gfortran-9",
|
||||||
|
"gfortran-10"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,5 +190,28 @@
|
|||||||
"3.1",
|
"3.1",
|
||||||
"5.0"
|
"5.0"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"clang": {
|
||||||
|
"versions": [
|
||||||
|
"8",
|
||||||
|
"9",
|
||||||
|
"10"
|
||||||
|
],
|
||||||
|
"default_version": "10"
|
||||||
|
},
|
||||||
|
"gcc": {
|
||||||
|
"versions": [
|
||||||
|
"g++-7",
|
||||||
|
"g++-8",
|
||||||
|
"g++-9",
|
||||||
|
"g++-10"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gfortran": {
|
||||||
|
"versions": [
|
||||||
|
"gfortran-8",
|
||||||
|
"gfortran-9",
|
||||||
|
"gfortran-10"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user