mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 14:17:22 +00:00
[Ubuntu] Migrate php to Pester tests (#2341)
* Php Pester tests * Minor fix
This commit is contained in:
committed by
GitHub
parent
82b4e13fb0
commit
02c2fbad69
@@ -7,23 +7,16 @@
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/etc-environment.sh
|
||||
source $HELPER_SCRIPTS/os.sh
|
||||
source $HELPER_SCRIPTS/invoke-tests.sh
|
||||
|
||||
# add repository
|
||||
apt-add-repository ppa:ondrej/php -y
|
||||
apt-get update
|
||||
|
||||
# Install PHP
|
||||
if isUbuntu16 ; then
|
||||
php_versions="5.6 7.0 7.1 7.2 7.3 7.4 8.0"
|
||||
fi
|
||||
toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json"
|
||||
|
||||
if isUbuntu18 ; then
|
||||
php_versions="7.1 7.2 7.3 7.4 8.0"
|
||||
fi
|
||||
|
||||
if isUbuntu20 ; then
|
||||
php_versions="7.4 8.0"
|
||||
fi
|
||||
php_versions=$(jq -r '.php.versions[]' $toolset)
|
||||
|
||||
for version in $php_versions; do
|
||||
echo "Installing PHP $version"
|
||||
@@ -111,28 +104,11 @@ wget -q -O phpunit https://phar.phpunit.de/phpunit-8.phar
|
||||
chmod +x phpunit
|
||||
mv phpunit /usr/local/bin/phpunit
|
||||
|
||||
# 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 composer pear pecl phpunit; do
|
||||
if ! command -v $cmd; then
|
||||
echo "$cmd was not installed"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for version in $php_versions; do
|
||||
if ! command -v php$version; then
|
||||
echo "php$version was not installed"
|
||||
exit 1
|
||||
elif ! command -v php-config$version || ! command -v phpize$version; then
|
||||
echo "php$version-dev was not installed"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# ubuntu 20.04 libzip-dev is libzip5 based and is not compatible libzip-dev of ppa:ondrej/php
|
||||
# see https://github.com/actions/virtual-environments/issues/1084
|
||||
if isUbuntu20 ; then
|
||||
rm /etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list
|
||||
apt-get update
|
||||
fi
|
||||
|
||||
invoke_tests "Common" "PHP"
|
||||
30
images/linux/scripts/tests/Common.Tests.ps1
Normal file
30
images/linux/scripts/tests/Common.Tests.ps1
Normal file
@@ -0,0 +1,30 @@
|
||||
Describe "PHP" {
|
||||
|
||||
[array]$testCases = (Get-ToolsetContent).php.versions | ForEach-Object { @{phpVersion = $_} }
|
||||
|
||||
It "php <phpVersion>" -TestCases $testCases {
|
||||
param (
|
||||
[string] $phpVersion
|
||||
)
|
||||
|
||||
"php$phpVersion --version" | Should -ReturnZeroExitCode
|
||||
"php-config$phpVersion --version" | Should -ReturnZeroExitCode
|
||||
"phpize$phpVersion --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
It "PHPUnit" {
|
||||
"phpunit --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
It "Composer" {
|
||||
"composer --version" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
It "Pear" {
|
||||
"pear" | Should -ReturnZeroExitCode
|
||||
}
|
||||
|
||||
It "Pecl" {
|
||||
"pecl" | Should -ReturnZeroExitCode
|
||||
}
|
||||
}
|
||||
@@ -235,5 +235,16 @@
|
||||
"gfortran-8",
|
||||
"gfortran-9"
|
||||
]
|
||||
},
|
||||
"php": {
|
||||
"versions": [
|
||||
"5.6",
|
||||
"7.0",
|
||||
"7.1",
|
||||
"7.2",
|
||||
"7.3",
|
||||
"7.4",
|
||||
"8.0"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,5 +241,14 @@
|
||||
"gfortran-9",
|
||||
"gfortran-10"
|
||||
]
|
||||
},
|
||||
"php": {
|
||||
"versions": [
|
||||
"7.1",
|
||||
"7.2",
|
||||
"7.3",
|
||||
"7.4",
|
||||
"8.0"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,5 +213,11 @@
|
||||
"gfortran-9",
|
||||
"gfortran-10"
|
||||
]
|
||||
},
|
||||
"php": {
|
||||
"versions": [
|
||||
"7.4",
|
||||
"8.0"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user