[macOS] add pester tests to install scripts part-1. (#2286)

* [macOS] add pester tests to install scripts part-1.

* changed version

* added changes related to common utils installation

* added source tests file

* removed tests from homebrew

* moved jq to homebrew

* fix nitpicks

* incorrect things are fixed.

* fixed some mistakes in the text

* commonutils changed.

* remove swiftlint installation from toolsets

* removed useless string
This commit is contained in:
Darii Nurgaleev
2020-12-23 22:14:13 +07:00
committed by GitHub
parent ac87b63b13
commit 7403f33180
20 changed files with 310 additions and 199 deletions

View File

@@ -106,7 +106,7 @@ function Invoke-PesterTests {
$configuration.Filter.FullName = $TestName
}
# Switch ErrorActionPreference to Stop temporary to make sure that tests will on silent errors too
# Switch ErrorActionPreference to make sure that tests will fail on silent errors too
$backupErrorActionPreference = $ErrorActionPreference
$ErrorActionPreference = "Stop"
$results = Invoke-Pester -Configuration $configuration

View File

@@ -1,10 +1,11 @@
#!/bin/bash -e -o pipefail
source ~/utils/invoke-tests.sh
# Setup the Cocoapods
echo "Installing Cocoapods..."
# Setup the Cocoapods master repo
echo Setting up the Cocoapods master repository...
pod setup
# Create a symlink to /usr/local/bin since it was removed due to Homebrew change.
ln -sf $(which pod) /usr/local/bin/pod
invoke_tests "Common" "CocoaPods"

View File

@@ -1,60 +1,21 @@
#!/bin/bash -e -o pipefail
source ~/utils/utils.sh
source ~/utils/invoke-tests.sh
# TO-DO: Move the list of brew packages and casks to toolset
# brew install
binst_common_utils=(
carthage
cmake
subversion
go
gnupg
llvm
libpq
zstd
packer
helm
aliyun-cli
bazelisk
gh
p7zip
ant
aria2
gnu-tar
)
if is_Less_BigSur; then
binst_common_utils+=(
xctool
bats
parallel
)
fi
for package in ${binst_common_utils[@]}; do
echo "Install $package"
common_packages=$(get_toolset_value '.brew.common_packages[]')
for package in $common_packages; do
echo "Installing $package..."
brew install $package
done
# brew cask install
bcask_common_utils=(
julia
)
if is_Less_BigSur; then
bcask_common_utils+=(
virtualbox
vagrant
r
)
fi
for package in ${bcask_common_utils[@]}; do
echo "Install $package"
cask_packages=$(get_toolset_value '.brew.cask_packages[]')
for package in $cask_packages; do
echo "Installing $package..."
brew install --cask $package
done
# Invoke bazel to download the latest bazel version via bazelisk
bazel
# Invoke tests for all common tools
invoke_tests "Common" "CommonUtils"

View File

@@ -8,6 +8,7 @@
###########################################################################
source ~/utils/utils.sh
source ~/utils/invoke-tests.sh
export DOTNET_CLI_TELEMETRY_OPTOUT=1
@@ -57,3 +58,5 @@ fi
echo 'export PATH="$PATH:$HOME/.dotnet/tools"' >> "$HOME/.bashrc"
echo "Dotnet operations have been completed successfully..."
invoke_tests "Common" ".NET"

View File

@@ -1,4 +1,5 @@
#!/bin/bash -e -o pipefail
source ~/utils/invoke-tests.sh
echo "Installing GCC@8 using homebrew..."
brew install gcc@8
@@ -10,3 +11,5 @@ brew install gcc@9
echo "Installing GCC@10 using homebrew..."
brew install gcc@10
rm $(which gfortran)
invoke_tests "Common" "GCC"

View File

@@ -1,4 +1,5 @@
#!/bin/bash -e -o pipefail
source ~/utils/invoke-tests.sh
echo Installing Git...
brew install git
@@ -28,3 +29,5 @@ git config --global advice.implicitIdentity false
git config --global advice.detachedHead false
git config --global advice.amWorkDir false
git config --global advice.rmHints false
invoke_tests "Common" "Git"

View File

@@ -1,4 +1,5 @@
#!/bin/bash -e -o pipefail
source ~/utils/invoke-tests.sh
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
export PATH="$HOME/.ghcup/bin:$PATH"
@@ -18,3 +19,5 @@ done
echo "install cabal..."
ghcup install-cabal
invoke_tests "Common" "Haskell"

View File

@@ -7,14 +7,15 @@ HOMEBREW_INSTALL_URL="https://raw.githubusercontent.com/Homebrew/install/master/
echo "Disabling Homebrew analytics..."
brew analytics off
echo "Installing the latest curl..."
# jq is required for further installation scripts
echo "Installing jq..."
brew install jq
echo "Installing curl..."
brew install curl
echo "Installing wget..."
brew install wget
echo "Installing jq..."
brew install jq
# init brew bundle feature
brew tap Homebrew/bundle

View File

@@ -1,4 +1,5 @@
#!/bin/bash -e -o pipefail
source ~/utils/invoke-tests.sh
MINICONDA_INSTALLER="/tmp/miniconda.sh"
curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o $MINICONDA_INSTALLER
@@ -10,3 +11,5 @@ sudo ln -s /usr/local/miniconda/bin/conda /usr/local/bin/conda
if [ -d "$HOME/.conda" ]; then
sudo chown -R $USER "$HOME/.conda"
fi
invoke_tests "Common" "Miniconda"

View File

@@ -1,4 +1,5 @@
#!/bin/bash -e -o pipefail
source ~/utils/invoke-tests.sh
# MongoDB object-value database
# installs last version of MongoDB Community Edition
@@ -8,3 +9,5 @@ echo "Installing mongodb..."
brew tap mongodb/brew
brew install mongodb-community
invoke_tests "Common" "Mongo"

View File

@@ -1,5 +1,5 @@
#!/bin/bash -e -o pipefail
source ~/utils/invoke-tests.sh
source ~/utils/utils.sh
node_modules=(
@@ -43,3 +43,5 @@ if is_Less_BigSur; then
echo "Install node-gyp"
npm install -g node-gyp
fi
invoke_tests "Node" "Node.js"

View File

@@ -4,6 +4,7 @@
#
###########################################################################
source ~/utils/utils.sh
source ~/utils/invoke-tests.sh
VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name')
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash
@@ -30,3 +31,5 @@ else
fi
echo "Node version manager has been installed successfully"
invoke_tests "Node" "nvm"

View File

@@ -1,6 +1,7 @@
#!/bin/bash -e -o pipefail
source ~/utils/utils.sh
source ~/utils/invoke-tests.sh
installAzulJDK() {
local URL=$1
@@ -49,3 +50,5 @@ brew install maven
echo Installing Gradle ...
brew install gradle
invoke_tests "Java"

View File

@@ -1,6 +1,6 @@
#!/bin/bash -e -o pipefail
source ~/utils/utils.sh
source ~/utils/invoke-tests.sh
echo "Install latest openssl"
brew install openssl
@@ -10,3 +10,5 @@ brew install openssl@1.1
# Symlink brew openssl@1.1 to `/usr/local/bin` as Homebrew refuses
ln -sf $(brew --prefix openssl@1.1)/bin/openssl /usr/local/bin/openssl
invoke_tests "Common" "OpenSSL"

View File

@@ -48,19 +48,128 @@ Describe "Audio device" -Skip:($os.IsHighSierra -or $os.IsBigSur) {
}
}
Describe "Common utilities" {
It "Homebrew" {
"brew --version" | Should -ReturnZeroExitCode
Describe "CommonUtils" {
It "Carthage" {
"carthage version" | Should -ReturnZeroExitCode
}
It "DotNet" {
"dotnet --version" | Should -ReturnZeroExitCode
It "cmake" {
"cmake --version" | Should -ReturnZeroExitCode
}
It "Subversion" {
"svn --version" | Should -ReturnZeroExitCode
}
It "Go" {
"go version" | Should -ReturnZeroExitCode
}
It "GnuPG" {
"gpg --version" | Should -ReturnZeroExitCode
}
It "Clang/LLVM is installed" {
"$(brew --prefix llvm)/bin/clang --version" | Should -ReturnZeroExitCode
}
It "zstd" {
"zstd --version" | Should -ReturnZeroExitCode
}
It "Packer" {
"packer --version" | Should -ReturnZeroExitCode
}
It "Helm" {
"helm version --short" | Should -ReturnZeroExitCode
}
It "bazelisk" {
"bazelisk version" | Should -ReturnZeroExitCode
}
It "GitHub CLI" {
"gh --version" | Should -ReturnZeroExitCode
}
It "7-Zip" {
"7z i" | Should -ReturnZeroExitCode
}
It "Apache Ant" {
"ant -version" | Should -ReturnZeroExitCode
}
It "Aria2" {
"aria2c --version" | Should -ReturnZeroExitCode
}
It "GNU Tar" {
"gtar --version" | Should -ReturnZeroExitCode
}
It "bazel" {
"bazel --version" | Should -ReturnZeroExitCode
}
It "Aliyun CLI" {
"aliyun --version" | Should -ReturnZeroExitCode
}
It "Julia" {
"julia --version" | Should -ReturnZeroExitCode
}
It "virtualbox" -Skip:($os.IsBigSur) {
"vboxmanage -v" | Should -ReturnZeroExitCode
}
It "jq" {
"jq --version" | Should -ReturnZeroExitCode
}
It "curl" {
"curl --version" | Should -ReturnZeroExitCode
}
It "wget" {
"wget --version" | Should -ReturnZeroExitCode
}
It "vagrant" -Skip:($os.IsBigSur) {
"vagrant --version" | Should -ReturnZeroExitCode
}
It "xctool" -Skip:($os.IsBigSur) {
"xctool --version" | Should -ReturnZeroExitCode
}
It "R" -Skip:($os.IsBigSur) {
"R --version" | Should -ReturnZeroExitCode
}
}
Describe ".NET" {
It ".NET" {
"dotnet --version" | Should -ReturnZeroExitCode
}
}
Describe "CocoaPods" {
It "CocoaPods" {
"pod --version" | Should -ReturnZeroExitCode
}
}
Describe "Homebrew" {
It "Homebrew" {
"brew --version" | Should -ReturnZeroExitCode
}
}
Describe "Common utilities" {
It "Bundler" {
"bundler --version" | Should -ReturnZeroExitCode
}
@@ -69,14 +178,6 @@ Describe "Common utilities" {
"mvn --version" | Should -ReturnZeroExitCode
}
It "CocoaPods" {
"pod --version" | Should -ReturnZeroExitCode
}
It "Carthage" {
"carthage version" | Should -ReturnZeroExitCode
}
It "App Center CLI" {
"appcenter --version" | Should -ReturnZeroExitCode
}
@@ -98,10 +199,6 @@ Describe "Common utilities" {
}
}
It "Aliyun CLI" {
"aliyun --version" | Should -ReturnZeroExitCode
}
Context "Nomad" -Skip:($os.IsBigSur) {
It "Nomad CLI" {
$result = Get-CommandResult "gem list"
@@ -112,51 +209,30 @@ Describe "Common utilities" {
"ipa --version" | Should -ReturnZeroExitCode
}
}
Describe "Miniconda" {
It "Conda" {
Get-EnvironmentVariable "CONDA" | Should -Not -BeNullOrEmpty
$condaBinPath = Join-Path $env:CONDA "bin" "conda"
"$condaBinPath --version" | Should -ReturnZeroExitCode
}
}
It "Fastlane" {
"fastlane --version" | Should -ReturnZeroExitCode
}
It "Subversion" {
"svn --version" | Should -ReturnZeroExitCode
}
It "cmake" {
"cmake --version" | Should -ReturnZeroExitCode
}
It "curl" {
"curl --version" | Should -ReturnZeroExitCode
}
It "xctool" -Skip:($os.IsBigSur) {
"xctool --version" | Should -ReturnZeroExitCode
}
It "xcpretty" {
"xcpretty --version" | Should -ReturnZeroExitCode
}
It "wget" {
"wget --version" | Should -ReturnZeroExitCode
}
Describe "Mongo" {
It "mongodb" {
"mongo --version" | Should -ReturnZeroExitCode
"mongod --version"| Should -ReturnZeroExitCode
}
It "jq" {
"jq --version" | Should -ReturnZeroExitCode
}
Context "OpenSSL" {
Describe "OpenSSL" {
It "OpenSSL is available" {
"openssl version" | Should -ReturnZeroExitCode
}
@@ -172,10 +248,6 @@ Describe "Common utilities" {
}
}
It "GnuPG" {
"gpg --version" | Should -ReturnZeroExitCode
}
It "PostgreSQL-Client" {
"psql --version" | Should -ReturnZeroExitCode
}
@@ -184,10 +256,6 @@ Describe "Common utilities" {
"pg_config --version" | Should -ReturnZeroExitCode
}
It "Aria2" {
"aria2c --version" | Should -ReturnZeroExitCode
}
It "Azcopy" {
"azcopy --version" | Should -ReturnZeroExitCode
}
@@ -200,58 +268,6 @@ Describe "Common utilities" {
It "Composer" {
"composer --version" | Should -ReturnZeroExitCode
}
It "R" -Skip:($os.IsBigSur) {
"R --version" | Should -ReturnZeroExitCode
}
It "zstd" {
"zstd --version" | Should -ReturnZeroExitCode
}
It "bazel" {
"bazel --version" | Should -ReturnZeroExitCode
}
It "bazelisk" {
"bazelisk version" | Should -ReturnZeroExitCode
}
It "Julia" {
"julia --version" | Should -ReturnZeroExitCode
}
It "Packer" {
"packer --version" | Should -ReturnZeroExitCode
}
It "Helm" {
"helm version --short" | Should -ReturnZeroExitCode
}
It "virtualbox" -Skip:($os.IsBigSur) {
"vboxmanage -v" | Should -ReturnZeroExitCode
}
It "vagrant" -Skip:($os.IsBigSur) {
"vagrant --version" | Should -ReturnZeroExitCode
}
It "GitHub CLI" {
"gh --version" | Should -ReturnZeroExitCode
}
It "7-Zip" {
"7z i" | Should -ReturnZeroExitCode
}
It "Apache Ant" {
"ant -version" | Should -ReturnZeroExitCode
}
It "GNU Tar" {
"gtar --version" | Should -ReturnZeroExitCode
}
}
Describe "Rust" -Skip:($os.IsHighSierra) {
@@ -304,33 +320,23 @@ Describe "Haskell" -Skip:($os.IsHighSierra) {
}
}
Describe "Clang/LLVM" -Skip:($os.IsHighSierra) {
It "Clang/LLVM is installed" {
"$(brew --prefix llvm)/bin/clang --version" | Should -ReturnZeroExitCode
}
}
Describe "GCC" -Skip:($os.IsHighSierra) {
$testCases = @("8", "9", "10") | ForEach-Object { @{Version = $_} }
Describe "Gcc" -Skip:($os.IsHighSierra) {
$testCases = @("8", "9", "10") | ForEach-Object { @{GccVersion = $_} }
It "Gcc <GccVersion>" -TestCases $testCases {
It "GCC <Version>" -TestCases $testCases {
param (
[string] $GccVersion
[string] $Version
)
"gcc-$GccVersion --version" | Should -ReturnZeroExitCode
}
"gcc-$Version --version" | Should -ReturnZeroExitCode
}
Describe "Gfortran" -Skip:($os.IsHighSierra) {
$testCases = @("8", "9", "10") | ForEach-Object { @{GfortranVersion = $_} }
It "Gfortran <GfortranVersion>" -TestCases $testCases {
It "Gfortran <Version>" -TestCases $testCases {
param (
[string] $GfortranVersion
[string] $Version
)
"gfortran-$GfortranVersion --version" | Should -ReturnZeroExitCode
"gfortran-$Version --version" | Should -ReturnZeroExitCode
}
It "Gfortran is not found in the default path" {

View File

@@ -1,17 +1,17 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1"
Describe "Node.JS" {
Describe "Node.js" {
BeforeAll {
$os = Get-OSVersion
$expectedNodeVersion = if ($os.IsHigherThanMojave) { "v14.*" } else { "v8.*" }
}
It "Node.JS is installed" {
It "Node.js is installed" {
"node --version" | Should -ReturnZeroExitCode
}
It "Node.JS $expectedNodeVersion is default" {
It "Node.js $expectedNodeVersion is default" {
(Get-CommandResult "node --version").Output | Should -BeLike $expectedNodeVersion
}
@@ -24,18 +24,18 @@ Describe "Node.JS" {
}
}
Describe "NVM" {
Describe "nvm" {
BeforeAll {
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
$nvmInitCommand = ". $nvmPath > /dev/null 2>&1 || true"
}
It "Nvm is installed" {
It "nvm is installed" {
$nvmPath | Should -Exist
"$nvmInitCommand && nvm --version" | Should -ReturnZeroExitCode
}
Context "Nvm versions" {
Context "nvm versions" {
$NVM_VERSIONS = @(6, 8, 10, 12)
$testCases = $NVM_VERSIONS | ForEach-Object { @{NvmVersion = $_} }

View File

@@ -201,6 +201,36 @@
{"name": "MarkdownPS"},
{"name": "Pester"}
],
"brew": {
"common_packages": [
"carthage",
"cmake",
"subversion",
"go",
"gnupg",
"llvm",
"libpq",
"zstd",
"packer",
"helm",
"aliyun-cli",
"bazelisk",
"gh",
"p7zip",
"ant",
"aria2",
"gnu-tar",
"xctool",
"bats",
"parallel"
],
"cask_packages": [
"julia",
"virtualbox",
"vagrant",
"r"
]
},
"toolcache": [
{
"name": "PyPy",

View File

@@ -221,6 +221,36 @@
{"name": "MarkdownPS"},
{"name": "Pester"}
],
"brew": {
"common_packages": [
"carthage",
"cmake",
"subversion",
"go",
"gnupg",
"llvm",
"libpq",
"zstd",
"packer",
"helm",
"aliyun-cli",
"bazelisk",
"gh",
"p7zip",
"ant",
"aria2",
"gnu-tar",
"xctool",
"bats",
"parallel"
],
"cask_packages": [
"julia",
"virtualbox",
"vagrant",
"r"
]
},
"toolcache": [
{
"name": "Python",

View File

@@ -151,6 +151,36 @@
{"name": "MarkdownPS"},
{"name": "Pester"}
],
"brew": {
"common_packages": [
"carthage",
"cmake",
"subversion",
"go",
"gnupg",
"llvm",
"libpq",
"zstd",
"packer",
"helm",
"aliyun-cli",
"bazelisk",
"gh",
"p7zip",
"ant",
"aria2",
"gnu-tar",
"xctool",
"bats",
"parallel"
],
"cask_packages": [
"julia",
"virtualbox",
"vagrant",
"r"
]
},
"toolcache": [
{
"name": "Python",

View File

@@ -84,6 +84,30 @@
{"name": "MarkdownPS"},
{"name": "Pester"}
],
"brew": {
"common_packages": [
"carthage",
"cmake",
"subversion",
"go",
"gnupg",
"llvm",
"libpq",
"zstd",
"packer",
"helm",
"aliyun-cli",
"bazelisk",
"gh",
"p7zip",
"ant",
"aria2",
"gnu-tar"
],
"cask_packages": [
"julia"
]
},
"toolcache": [
{
"name": "Python",