Skip to content

Commit 944a65f

Browse files
David-HaimchausnerautoantwortohanarTrafo
authored
version 0.1.6 (#115)
Co-authored-by: chausner <15180557+chausner@users.noreply.github.com> Co-authored-by: autoantwort <41973254+autoantwort@users.noreply.github.com> Co-authored-by: chausner <chausner@users.noreply.github.com> Co-authored-by: R. Andrew Ohana <1442822+ohanar@users.noreply.github.com> Co-authored-by: Mathias Eggert <Mathias.Eggert@outlook.com> Co-authored-by: Mathias Eggert <mathias.eggert@nordsec.com>
1 parent 0c612ae commit 944a65f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2196
-1040
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CMake Build
2+
description: Build CMake Project
3+
4+
inputs:
5+
cmake:
6+
description: Path to CMake executable
7+
required: True
8+
ninja:
9+
description: Path to ninja executable
10+
required: True
11+
source:
12+
description: Path to source directory
13+
required: True
14+
build:
15+
description: Path to build directory
16+
required: True
17+
jobs:
18+
description: Number of jobs to use
19+
default: 1
20+
config:
21+
description: CMake configuration to build
22+
default: RelWithDebInfo
23+
args:
24+
description: Extra arguments to pass CMake
25+
26+
runs:
27+
using: composite
28+
steps:
29+
- shell: pwsh
30+
run: |
31+
function Invoke-NativeCommand {
32+
$command = $args[0]
33+
$arguments = $args[1..($args.Length)]
34+
& $command @arguments
35+
if ($LastExitCode -ne 0) {
36+
Write-Error "Exit code $LastExitCode while running $command $arguments"
37+
}
38+
}
39+
if ($IsWindows) {
40+
$vsPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -Property InstallationPath
41+
Import-Module (Get-ChildItem $vsPath -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName
42+
Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments '-arch=x64'
43+
}
44+
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 }}
45+
Invoke-NativeCommand '${{ inputs.cmake }}' --build '${{ inputs.build }}' --config '${{ inputs.config }}' -j${{ inputs.jobs }} '--' -k0
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Fetch Clang
2+
description: Puts clang's path into the output
3+
4+
inputs:
5+
version:
6+
description: Version of Clang to fetch
7+
required: true
8+
base-directory:
9+
description: Directory in which to install clang
10+
outputs:
11+
clang:
12+
description: Path of clang executable
13+
value: ${{ steps.script.outputs.clang }}
14+
clangxx:
15+
description: Path of clang++ executable
16+
value: ${{ steps.script.outputs.clangxx }}
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- id: script
22+
shell: pwsh
23+
working-directory: ${{ inputs.base-directory }}
24+
run: |
25+
$version = ${{ inputs.version }}
26+
function Invoke-NativeCommand {
27+
$command = $args[0]
28+
$arguments = $args[1..($args.Length)]
29+
& $command @arguments
30+
if ($LastExitCode -ne 0) {
31+
Write-Error "Exit code $LastExitCode while running $command $arguments"
32+
}
33+
}
34+
if ($IsMacOs) {
35+
} elseif ($IsLinux) {
36+
$tmp = New-TemporaryFile
37+
Invoke-WebRequest -Uri 'https://apt.llvm.org/llvm-snapshot.gpg.key' -OutFile $tmp
38+
Invoke-NativeCommand sudo apt-key add $tmp
39+
$tmp | Remove-Item
40+
Invoke-NativeCommand sudo add-apt-repository -y "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${version} main"
41+
Invoke-NativeCommand sudo apt-get update
42+
$pkgs = @("clang-${version}", "libc++-${version}-dev", "libc++abi-${version}-dev")
43+
if (${version} -eq 12) {
44+
$pkgs += "libunwind-${version}-dev"
45+
}
46+
if (${version} -ge 14) {
47+
$pkgs += "libclang-rt-${version}-dev"
48+
}
49+
Invoke-NativeCommand sudo apt-get install -y $pkgs
50+
Add-Content "${env:GITHUB_OUTPUT}" "clang=$((Get-Command clang-${version}).Source)"
51+
Add-Content "${env:GITHUB_OUTPUT}" "clangxx=$((Get-Command clang++-${version}).Source)"
52+
} elseif ($IsWindows) {
53+
$release = Invoke-WebRequest -Uri 'https://api.github.com/repos/llvm/llvm-project/releases' -UseBasicParsing |
54+
ConvertFrom-Json |
55+
Select-Object -Property @{Name = 'version'; Expression = {[System.Management.Automation.SemanticVersion]$_.tag_name.Substring('llvmorg-'.Length)}},assets |
56+
Where-Object {$_.version.Major -eq $version -and ($_.assets | Where-Object {$_.name -like "LLVM-*-win64.exe"})} |
57+
Sort-Object |
58+
Select-Object -First 1
59+
$uri = ($release.assets | Where-Object {$_.name -eq "LLVM-$($release.version)-win64.exe"}).browser_download_url
60+
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'exe' } –PassThru
61+
Invoke-WebRequest -Uri $uri -OutFile $tmp
62+
Start-Process "$tmp" -Wait -NoNewWindow -ArgumentList /S,"/D=$(Join-Path (Get-Location) LLVM)"
63+
$tmp | Remove-Item
64+
Add-Content "${env:GITHUB_OUTPUT}" "clang=$(Join-Path (Get-Location) LLVM bin clang)"
65+
Add-Content "${env:GITHUB_OUTPUT}" "clangxx=$(Join-Path (Get-Location) LLVM bin clang++)"
66+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Fetch CMake
2+
description: Puts CMake's path into the output
3+
4+
inputs:
5+
version:
6+
description: Version of CMake to fetch
7+
default: 3.24.2
8+
base-directory:
9+
description: Directory in which to install CMake
10+
outputs:
11+
cmake:
12+
description: Path of CMake executable
13+
value: ${{ steps.script.outputs.cmake }}
14+
ctest:
15+
description: Path of CTest executable
16+
value: ${{ steps.script.outputs.ctest }}
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- id: script
22+
shell: pwsh
23+
working-directory: ${{ inputs.base-directory }}
24+
run: |
25+
$version = '${{ inputs.version }}'
26+
$oldVersion = [System.Version]$version -lt [System.Version]'3.20.0'
27+
$arch = 'x86_64'
28+
$ext = 'tar.gz'
29+
$binDir = 'bin'
30+
if ($IsMacOs) {
31+
if ($oldVersion) {
32+
$os = 'Darwin'
33+
} else {
34+
$os = 'macos'
35+
$arch = 'universal'
36+
}
37+
$binDir = 'CMake.app/Contents/bin'
38+
} elseif ($IsLinux) {
39+
if ($oldVersion) {
40+
$os = 'Linux'
41+
} else {
42+
$os = 'linux'
43+
}
44+
} elseif ($IsWindows) {
45+
if ($oldVersion) {
46+
$os = 'win64'
47+
$arch = 'x64'
48+
} else {
49+
$os = 'windows'
50+
}
51+
$ext = 'zip'
52+
}
53+
$base = "cmake-${version}-${os}-${arch}"
54+
$uri = "https://github.com/Kitware/CMake/releases/download/v${version}/${base}.${ext}"
55+
$tmp = New-TemporaryFile
56+
Invoke-WebRequest -Uri $uri -OutFile $tmp
57+
cmake -E tar xf $tmp
58+
$tmp | Remove-Item
59+
Add-Content "${env:GITHUB_OUTPUT}" "cmake=$(Join-Path (Get-Location) $base $binDir cmake)"
60+
Add-Content "${env:GITHUB_OUTPUT}" "ctest=$(Join-Path (Get-Location) $base $binDir ctest)"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Fetch libstdc++
2+
description: Fetches libstdc++
3+
4+
inputs:
5+
version:
6+
description: Version of libstdc++ to fetch
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- shell: pwsh
13+
run: |
14+
function Invoke-NativeCommand {
15+
$command = $args[0]
16+
$arguments = $args[1..($args.Length)]
17+
& $command @arguments
18+
if ($LastExitCode -ne 0) {
19+
Write-Error "Exit code $LastExitCode while running $command $arguments"
20+
}
21+
}
22+
Invoke-NativeCommand sudo apt-get update
23+
Invoke-NativeCommand sudo apt-get install -y libstdc++-${{ inputs.version }}-dev
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Fetch Ninja
2+
description: Puts ninja's path into the output
3+
4+
inputs:
5+
version:
6+
description: Version of Ninja to fetch
7+
default: 1.11.1
8+
base-directory:
9+
description: Directory in which to install Ninja
10+
outputs:
11+
ninja:
12+
description: Path of ninja executable
13+
value: ${{ steps.script.outputs.ninja }}
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- id: script
19+
shell: pwsh
20+
working-directory: ${{ inputs.base-directory }}
21+
run: |
22+
$version = '${{ inputs.version }}'
23+
if ($IsMacOs) {
24+
$os = 'mac'
25+
} elseif ($IsLinux) {
26+
$os = 'linux'
27+
} elseif ($IsWindows) {
28+
$os = 'win'
29+
}
30+
$uri = "https://github.com/ninja-build/ninja/releases/download/v${version}/ninja-${os}.zip"
31+
$tmp = New-TemporaryFile
32+
Invoke-WebRequest -Uri $uri -OutFile $tmp
33+
cmake -E tar xf $tmp
34+
$tmp | Remove-Item
35+
Add-Content "${env:GITHUB_OUTPUT}" "ninja=$(Join-Path (Get-Location) ninja)"

.github/actions/run-tests/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Run Tests
2+
description: Run Tests
3+
4+
inputs:
5+
ctest:
6+
description: Path to CTest executable
7+
required: True
8+
test-dir:
9+
description: Path to test directory
10+
required: True
11+
attempts:
12+
description: Number of attempts to run per test
13+
default: 3
14+
jobs:
15+
description: Number of jobs to use
16+
default: 1
17+
config:
18+
description: CTest configuration to test
19+
default: RelWithDebInfo
20+
21+
runs:
22+
using: composite
23+
steps:
24+
- shell: pwsh
25+
run: |
26+
& '${{ inputs.ctest }}' --test-dir '${{ inputs.test-dir }}' -C ${{ inputs.config }} -V -j${{ inputs.jobs }} --repeat until-pass:${{ inputs.attempts }}

0 commit comments

Comments
 (0)