mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 12:48:18 +00:00
[Ubuntu] Add Ninja (#11706)
This commit is contained in:
17
images/ubuntu/scripts/build/install-ninja.sh
Normal file
17
images/ubuntu/scripts/build/install-ninja.sh
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
################################################################################
|
||||||
|
## File: install-ninja.sh
|
||||||
|
## Desc: Install ninja-build
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Source the helpers for use with the script
|
||||||
|
source $HELPER_SCRIPTS/install.sh
|
||||||
|
|
||||||
|
# Install ninja
|
||||||
|
download_url=$(resolve_github_release_asset_url "ninja-build/ninja" "endswith(\"ninja-linux.zip\")" "latest")
|
||||||
|
ninja_binary_path=$(download_with_retry "${download_url}")
|
||||||
|
|
||||||
|
# Unzip the ninja binary
|
||||||
|
unzip -qq "$ninja_binary_path" -d /usr/local/bin
|
||||||
|
|
||||||
|
invoke_tests "Tools" "Ninja"
|
||||||
@@ -156,6 +156,7 @@ if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
|
|||||||
$tools.AddToolVersion("yamllint", $(Get-YamllintVersion))
|
$tools.AddToolVersion("yamllint", $(Get-YamllintVersion))
|
||||||
$tools.AddToolVersion("yq", $(Get-YqVersion))
|
$tools.AddToolVersion("yq", $(Get-YqVersion))
|
||||||
$tools.AddToolVersion("zstd", $(Get-ZstdVersion))
|
$tools.AddToolVersion("zstd", $(Get-ZstdVersion))
|
||||||
|
$tools.AddToolVersion("Ninja", $(Get-NinjaVersion))
|
||||||
|
|
||||||
# CLI Tools
|
# CLI Tools
|
||||||
$cliTools = $installedSoftware.AddHeader("CLI Tools")
|
$cliTools = $installedSoftware.AddHeader("CLI Tools")
|
||||||
|
|||||||
@@ -275,6 +275,10 @@ function Get-ZstdVersion {
|
|||||||
return "$zstdVersion"
|
return "$zstdVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-NinjaVersion {
|
||||||
|
return $(ninja --version)
|
||||||
|
}
|
||||||
|
|
||||||
function Get-YqVersion {
|
function Get-YqVersion {
|
||||||
$yqVersion = $(yq -V) | Get-StringPart -Part 3
|
$yqVersion = $(yq -V) | Get-StringPart -Part 3
|
||||||
return $yqVersion.TrimStart("v").Trim()
|
return $yqVersion.TrimStart("v").Trim()
|
||||||
|
|||||||
@@ -411,3 +411,25 @@ Describe "Kotlin" {
|
|||||||
"kotlinc-js -version" | Should -ReturnZeroExitCode
|
"kotlinc-js -version" | Should -ReturnZeroExitCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Describe "Ninja" {
|
||||||
|
New-item -Path "/tmp/ninjaproject" -ItemType Directory -Force
|
||||||
|
Set-Location '/tmp/ninjaproject'
|
||||||
|
@'
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
project(NinjaTest NONE)
|
||||||
|
'@ | Out-File -FilePath "./CMakeLists.txt"
|
||||||
|
|
||||||
|
It "Make a simple ninja project" {
|
||||||
|
"cmake -GNinja /tmp/ninjaproject" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
|
||||||
|
It "build.ninja file should exist" {
|
||||||
|
$buildFilePath = Join-Path "/tmp/ninjaproject" "build.ninja"
|
||||||
|
$buildFilePath | Should -Exist
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Ninja" {
|
||||||
|
"ninja --version" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -328,7 +328,8 @@ build {
|
|||||||
"${path.root}/../scripts/build/install-android-sdk.sh",
|
"${path.root}/../scripts/build/install-android-sdk.sh",
|
||||||
"${path.root}/../scripts/build/install-pypy.sh",
|
"${path.root}/../scripts/build/install-pypy.sh",
|
||||||
"${path.root}/../scripts/build/install-python.sh",
|
"${path.root}/../scripts/build/install-python.sh",
|
||||||
"${path.root}/../scripts/build/install-zstd.sh"
|
"${path.root}/../scripts/build/install-zstd.sh",
|
||||||
|
"${path.root}/../scripts/build/install-ninja.sh"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -324,7 +324,8 @@ build {
|
|||||||
"${path.root}/../scripts/build/install-android-sdk.sh",
|
"${path.root}/../scripts/build/install-android-sdk.sh",
|
||||||
"${path.root}/../scripts/build/install-pypy.sh",
|
"${path.root}/../scripts/build/install-pypy.sh",
|
||||||
"${path.root}/../scripts/build/install-python.sh",
|
"${path.root}/../scripts/build/install-python.sh",
|
||||||
"${path.root}/../scripts/build/install-zstd.sh"
|
"${path.root}/../scripts/build/install-zstd.sh",
|
||||||
|
"${path.root}/../scripts/build/install-ninja.sh"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -313,7 +313,8 @@ provisioner "shell" {
|
|||||||
"${path.root}/../scripts/build/install-android-sdk.sh",
|
"${path.root}/../scripts/build/install-android-sdk.sh",
|
||||||
"${path.root}/../scripts/build/install-pypy.sh",
|
"${path.root}/../scripts/build/install-pypy.sh",
|
||||||
"${path.root}/../scripts/build/install-python.sh",
|
"${path.root}/../scripts/build/install-python.sh",
|
||||||
"${path.root}/../scripts/build/install-zstd.sh"
|
"${path.root}/../scripts/build/install-zstd.sh",
|
||||||
|
"${path.root}/../scripts/build/install-ninja.sh"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user