Skip to content

Commit

Permalink
[macOS] Add GCC 11 (actions#3361)
Browse files Browse the repository at this point in the history
* Add gcc@11 to macOS images

* Change tests and software report to use gcc toolset versions

* Add natural sort
  • Loading branch information
miketimofeev committed May 13, 2021
1 parent 3b20fa3 commit 0f3523c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 13 deletions.
17 changes: 9 additions & 8 deletions images/macos/provision/core/gcc.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/bin/bash -e -o pipefail
source ~/utils/utils.sh

echo "Installing GCC@8 using homebrew..."
brew_smart_install "gcc@8"
gccVersions=$(get_toolset_value '.gcc.versions | .[]')

echo "Installing GCC@9 using homebrew..."
brew_smart_install "gcc@9"
for gccVersion in $gccVersions; do
brew_smart_install "gcc@${gccVersion}"
done

# https://github.com/actions/virtual-environments/issues/1280
echo "Installing GCC@10 using homebrew..."
brew_smart_install "gcc@10"
rm $(which gfortran)
# Delete default gfortran link if it exists https://github.com/actions/virtual-environments/issues/1280
gfortranPath=$(which gfortran)
if [ $gfortranPath ]; then
rm $gfortranPath
fi

invoke_tests "Common" "GCC"
6 changes: 3 additions & 3 deletions images/macos/software-report/SoftwareReport.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ function Get-VcpkgVersion {
}

function Get-GccVersion {
$versionList = @("8", "9", "10")
$versionList = Get-ToolsetValue -KeyPath gcc.versions
$versionList | Foreach-Object {
$version = Run-Command "gcc-${_} --version" | Select-Object -First 1
"$version - available by ``gcc-${_}`` alias"
}
}

function Get-FortranVersion {
$versionList = @("8", "9", "10")
$versionList = Get-ToolsetValue -KeyPath gcc.versions
$versionList | Foreach-Object {
$version = Run-Command "gfortran-${_} --version" | Select-Object -First 1
"$version - available by ``gfortran-${_}`` alias"
"$version - available by ``gfortran-${_}`` alias"
}
}

Expand Down
4 changes: 3 additions & 1 deletion images/macos/software-report/SoftwareReport.Generator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ if ($os.IsLessThanBigSur) {
)
}

$markdown += New-MDList -Style Unordered -Lines ($languageAndRuntimeList | Sort-Object)
# To sort GCC and Gfortran correctly, we need to use natural sort https://gist.github.com/markwragg/e2a9dc05f3464103d6998298fb575d4e#file-sort-natural-ps1
$toNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) }
$markdown += New-MDList -Style Unordered -Lines ($languageAndRuntimeList | Sort-Object $toNatural)

# Package Management
$markdown += New-MDHeader "Package Management" -Level 3
Expand Down
2 changes: 1 addition & 1 deletion images/macos/tests/Common.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Describe ".NET" {
}

Describe "GCC" -Skip:($os.IsHighSierra) {
$testCases = @("8", "9", "10") | ForEach-Object { @{Version = $_} }
$testCases = Get-ToolsetValue -KeyPath gcc.versions | ForEach-Object { @{Version = $_} }

It "GCC <Version>" -TestCases $testCases {
param (
Expand Down
8 changes: 8 additions & 0 deletions images/macos/toolsets/toolset-10.14.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@
"virtualbox"
]
},
"gcc": {
"versions": [
"8",
"9",
"10",
"11"
]
},
"toolcache": [
{
"name": "Python",
Expand Down
8 changes: 8 additions & 0 deletions images/macos/toolsets/toolset-10.15.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@
"virtualbox"
]
},
"gcc": {
"versions": [
"8",
"9",
"10",
"11"
]
},
"toolcache": [
{
"name": "Python",
Expand Down
8 changes: 8 additions & 0 deletions images/macos/toolsets/toolset-11.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@
"julia"
]
},
"gcc": {
"versions": [
"8",
"9",
"10",
"11"
]
},
"toolcache": [
{
"name": "Python",
Expand Down

0 comments on commit 0f3523c

Please sign in to comment.