Skip to content

Commit

Permalink
version 0.1.6 (#115)
Browse files Browse the repository at this point in the history
Co-authored-by: chausner <[email protected]>
Co-authored-by: autoantwort <[email protected]>
Co-authored-by: chausner <[email protected]>
Co-authored-by: R. Andrew Ohana <[email protected]>
Co-authored-by: Mathias Eggert <[email protected]>
Co-authored-by: Mathias Eggert <[email protected]>
  • Loading branch information
7 people authored Mar 21, 2023
1 parent 0c612ae commit 944a65f
Show file tree
Hide file tree
Showing 66 changed files with 2,196 additions and 1,040 deletions.
45 changes: 45 additions & 0 deletions .github/actions/cmake-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CMake Build
description: Build CMake Project

inputs:
cmake:
description: Path to CMake executable
required: True
ninja:
description: Path to ninja executable
required: True
source:
description: Path to source directory
required: True
build:
description: Path to build directory
required: True
jobs:
description: Number of jobs to use
default: 1
config:
description: CMake configuration to build
default: RelWithDebInfo
args:
description: Extra arguments to pass CMake

runs:
using: composite
steps:
- shell: pwsh
run: |
function Invoke-NativeCommand {
$command = $args[0]
$arguments = $args[1..($args.Length)]
& $command @arguments
if ($LastExitCode -ne 0) {
Write-Error "Exit code $LastExitCode while running $command $arguments"
}
}
if ($IsWindows) {
$vsPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -Property InstallationPath
Import-Module (Get-ChildItem $vsPath -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments '-arch=x64'
}
Invoke-NativeCommand '${{ inputs.cmake }}' '-S${{ inputs.source }}' '-B${{ inputs.build }}' '-GNinja Multi-Config' '-DCMAKE_MAKE_PROGRAM=${{ inputs.ninja }}' '-DCMAKE_INSTALL_PREFIX=${{ inputs.build }}/prefix' ${{ inputs.args }}
Invoke-NativeCommand '${{ inputs.cmake }}' --build '${{ inputs.build }}' --config '${{ inputs.config }}' -j${{ inputs.jobs }} '--' -k0
66 changes: 66 additions & 0 deletions .github/actions/fetch-clang/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Fetch Clang
description: Puts clang's path into the output

inputs:
version:
description: Version of Clang to fetch
required: true
base-directory:
description: Directory in which to install clang
outputs:
clang:
description: Path of clang executable
value: ${{ steps.script.outputs.clang }}
clangxx:
description: Path of clang++ executable
value: ${{ steps.script.outputs.clangxx }}

runs:
using: composite
steps:
- id: script
shell: pwsh
working-directory: ${{ inputs.base-directory }}
run: |
$version = ${{ inputs.version }}
function Invoke-NativeCommand {
$command = $args[0]
$arguments = $args[1..($args.Length)]
& $command @arguments
if ($LastExitCode -ne 0) {
Write-Error "Exit code $LastExitCode while running $command $arguments"
}
}
if ($IsMacOs) {
} elseif ($IsLinux) {
$tmp = New-TemporaryFile
Invoke-WebRequest -Uri 'https://apt.llvm.org/llvm-snapshot.gpg.key' -OutFile $tmp
Invoke-NativeCommand sudo apt-key add $tmp
$tmp | Remove-Item
Invoke-NativeCommand sudo add-apt-repository -y "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${version} main"
Invoke-NativeCommand sudo apt-get update
$pkgs = @("clang-${version}", "libc++-${version}-dev", "libc++abi-${version}-dev")
if (${version} -eq 12) {
$pkgs += "libunwind-${version}-dev"
}
if (${version} -ge 14) {
$pkgs += "libclang-rt-${version}-dev"
}
Invoke-NativeCommand sudo apt-get install -y $pkgs
Add-Content "${env:GITHUB_OUTPUT}" "clang=$((Get-Command clang-${version}).Source)"
Add-Content "${env:GITHUB_OUTPUT}" "clangxx=$((Get-Command clang++-${version}).Source)"
} elseif ($IsWindows) {
$release = Invoke-WebRequest -Uri 'https://api.github.com/repos/llvm/llvm-project/releases' -UseBasicParsing |
ConvertFrom-Json |
Select-Object -Property @{Name = 'version'; Expression = {[System.Management.Automation.SemanticVersion]$_.tag_name.Substring('llvmorg-'.Length)}},assets |
Where-Object {$_.version.Major -eq $version -and ($_.assets | Where-Object {$_.name -like "LLVM-*-win64.exe"})} |
Sort-Object |
Select-Object -First 1
$uri = ($release.assets | Where-Object {$_.name -eq "LLVM-$($release.version)-win64.exe"}).browser_download_url
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'exe' } –PassThru
Invoke-WebRequest -Uri $uri -OutFile $tmp
Start-Process "$tmp" -Wait -NoNewWindow -ArgumentList /S,"/D=$(Join-Path (Get-Location) LLVM)"
$tmp | Remove-Item
Add-Content "${env:GITHUB_OUTPUT}" "clang=$(Join-Path (Get-Location) LLVM bin clang)"
Add-Content "${env:GITHUB_OUTPUT}" "clangxx=$(Join-Path (Get-Location) LLVM bin clang++)"
}
60 changes: 60 additions & 0 deletions .github/actions/fetch-cmake/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Fetch CMake
description: Puts CMake's path into the output

inputs:
version:
description: Version of CMake to fetch
default: 3.24.2
base-directory:
description: Directory in which to install CMake
outputs:
cmake:
description: Path of CMake executable
value: ${{ steps.script.outputs.cmake }}
ctest:
description: Path of CTest executable
value: ${{ steps.script.outputs.ctest }}

runs:
using: composite
steps:
- id: script
shell: pwsh
working-directory: ${{ inputs.base-directory }}
run: |
$version = '${{ inputs.version }}'
$oldVersion = [System.Version]$version -lt [System.Version]'3.20.0'
$arch = 'x86_64'
$ext = 'tar.gz'
$binDir = 'bin'
if ($IsMacOs) {
if ($oldVersion) {
$os = 'Darwin'
} else {
$os = 'macos'
$arch = 'universal'
}
$binDir = 'CMake.app/Contents/bin'
} elseif ($IsLinux) {
if ($oldVersion) {
$os = 'Linux'
} else {
$os = 'linux'
}
} elseif ($IsWindows) {
if ($oldVersion) {
$os = 'win64'
$arch = 'x64'
} else {
$os = 'windows'
}
$ext = 'zip'
}
$base = "cmake-${version}-${os}-${arch}"
$uri = "https://github.com/Kitware/CMake/releases/download/v${version}/${base}.${ext}"
$tmp = New-TemporaryFile
Invoke-WebRequest -Uri $uri -OutFile $tmp
cmake -E tar xf $tmp
$tmp | Remove-Item
Add-Content "${env:GITHUB_OUTPUT}" "cmake=$(Join-Path (Get-Location) $base $binDir cmake)"
Add-Content "${env:GITHUB_OUTPUT}" "ctest=$(Join-Path (Get-Location) $base $binDir ctest)"
23 changes: 23 additions & 0 deletions .github/actions/fetch-libstdc++/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Fetch libstdc++
description: Fetches libstdc++

inputs:
version:
description: Version of libstdc++ to fetch
required: true

runs:
using: composite
steps:
- shell: pwsh
run: |
function Invoke-NativeCommand {
$command = $args[0]
$arguments = $args[1..($args.Length)]
& $command @arguments
if ($LastExitCode -ne 0) {
Write-Error "Exit code $LastExitCode while running $command $arguments"
}
}
Invoke-NativeCommand sudo apt-get update
Invoke-NativeCommand sudo apt-get install -y libstdc++-${{ inputs.version }}-dev
35 changes: 35 additions & 0 deletions .github/actions/fetch-ninja/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Fetch Ninja
description: Puts ninja's path into the output

inputs:
version:
description: Version of Ninja to fetch
default: 1.11.1
base-directory:
description: Directory in which to install Ninja
outputs:
ninja:
description: Path of ninja executable
value: ${{ steps.script.outputs.ninja }}

runs:
using: composite
steps:
- id: script
shell: pwsh
working-directory: ${{ inputs.base-directory }}
run: |
$version = '${{ inputs.version }}'
if ($IsMacOs) {
$os = 'mac'
} elseif ($IsLinux) {
$os = 'linux'
} elseif ($IsWindows) {
$os = 'win'
}
$uri = "https://github.com/ninja-build/ninja/releases/download/v${version}/ninja-${os}.zip"
$tmp = New-TemporaryFile
Invoke-WebRequest -Uri $uri -OutFile $tmp
cmake -E tar xf $tmp
$tmp | Remove-Item
Add-Content "${env:GITHUB_OUTPUT}" "ninja=$(Join-Path (Get-Location) ninja)"
26 changes: 26 additions & 0 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run Tests
description: Run Tests

inputs:
ctest:
description: Path to CTest executable
required: True
test-dir:
description: Path to test directory
required: True
attempts:
description: Number of attempts to run per test
default: 3
jobs:
description: Number of jobs to use
default: 1
config:
description: CTest configuration to test
default: RelWithDebInfo

runs:
using: composite
steps:
- shell: pwsh
run: |
& '${{ inputs.ctest }}' --test-dir '${{ inputs.test-dir }}' -C ${{ inputs.config }} -V -j${{ inputs.jobs }} --repeat until-pass:${{ inputs.attempts }}
Loading

0 comments on commit 944a65f

Please sign in to comment.