Skip to content

Commit bcb1103

Browse files
committed
relocate script, merge workflow files
1 parent 63e728d commit bcb1103

File tree

7 files changed

+107
-99
lines changed

7 files changed

+107
-99
lines changed

.github/workflows/analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
with:
2121
brew: ninja
2222
- uses: SonarSource/sonarcloud-github-c-cpp@v3.2.0
23-
- name: "Setup metal-cpp"
24-
run: ./setup-metal-cpp.ps1 -Folder "externals" -FileName "metal-cpp_macOS15.2_iOS18.2.zip"
23+
- name: "Run setup-metal-cpp.ps1"
24+
run: scripts/setup-metal-cpp.ps1 -Folder "externals" -FileName "metal-cpp_macOS15_iOS18.zip"
2525
shell: pwsh
2626
- uses: lukka/get-cmake@v4.0.0
2727
with:

.github/workflows/build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: "Build"
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
branches: ["**"]
8+
workflow_dispatch:
9+
10+
jobs:
11+
swiftpm:
12+
name: "Swift Package Manager"
13+
runs-on: macos-13
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: mobiledevops/xcode-select-version-action@v1
17+
with:
18+
xcode-select-version: "15.2.0"
19+
- uses: swift-actions/setup-swift@v2
20+
with:
21+
swift-version: "6.0.2"
22+
- uses: ConorMacBride/install-package@v1.1.0
23+
with:
24+
brew: swiftlint
25+
- name: "Run setup-metal-cpp.ps1"
26+
run: scripts/setup-metal-cpp.ps1 -Folder "externals" -FileName "metal-cpp_macOS15_iOS18.zip"
27+
shell: pwsh
28+
- name: "Swift Build(Debug)"
29+
run: swift build --configuration debug # --verbose --target ...
30+
- name: "Swift Build(Release)"
31+
run: swift build --configuration release
32+
- name: "Swift Test"
33+
run: swift test --verbose --enable-code-coverage
34+
- name: "Swift Lint"
35+
run: swiftlint lint --output docs/lint.md --reporter markdown # --autocorrect
36+
37+
cmake:
38+
name: "CMake"
39+
runs-on: macos-13
40+
env:
41+
VCPKG_FEATURE_FLAGS: "manifests,binarycaching,registries"
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: swift-actions/setup-swift@v2
45+
with:
46+
swift-version: "6.0.2"
47+
- name: "Run setup-metal-cpp.ps1"
48+
run: scripts/setup-metal-cpp.ps1 -Folder "externals" -FileName "metal-cpp_macOS15_iOS18.zip"
49+
shell: pwsh
50+
- uses: lukka/get-cmake@v4.0.0
51+
with:
52+
cmakeVersion: "~4.0.0"
53+
- uses: lukka/run-vcpkg@v11.5
54+
with:
55+
vcpkgDirectory: "${{ runner.tool_cache }}/vcpkg"
56+
vcpkgGitCommitId: b02e341c927f16d991edbd915d8ea43eac52096c # 2025.03.19
57+
vcpkgJsonGlob: "**/vcpkg.json"
58+
vcpkgConfigurationJsonGlob: "**/vcpkg-configuration.json"
59+
runVcpkgInstall: true
60+
- uses: lukka/run-cmake@v10.7
61+
with:
62+
configurePreset: "x64-osx"
63+
buildPreset: "x64-osx-debug"
64+
testPreset: "x64-osx-debug"

.github/workflows/cmake.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/swift.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
### Setup
1818

19-
```bash
20-
pwsh setup-metal-cpp.ps1
19+
```powershell
20+
scripts/setup-metal-cpp.ps1 -Folder "externals" -FileName "metal-cpp_macOS15_iOS18.zip"
2121
```
2222

2323
### Build

scripts/setup-metal-cpp.ps1

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<#
2+
.SYNOPSIS
3+
Script to download and extract Metal-cpp sources
4+
.DESCRIPTION
5+
Download sources from https://developer.apple.com/metal/cpp/ and extract them to the designated folder
6+
7+
.EXAMPLE
8+
PS> ./setup-metal-cpp.ps1 -Folder "externals"
9+
#>
10+
using namespace System
11+
param
12+
(
13+
[String]$Folder = "externals",
14+
[String]$FileName = "metal-cpp_macOS15.2_iOS18.2.zip"
15+
)
16+
17+
$Candidates = @(
18+
"metal-cpp_macOS15.2_iOS18.2.zip",
19+
"metal-cpp_macOS15_iOS18.zip",
20+
"metal-cpp_macOS15_iOS18-beta.zip",
21+
"metal-cpp_macOS14.2_iOS17.2.zip",
22+
"metal-cpp_macOS14_iOS17-beta.zip",
23+
"metal-cpp_macOS13.3_iOS16.4.zip",
24+
"metal-cpp_macOS13_iOS16.zip",
25+
"metal-cpp_macOS12_iOS15.zip"
26+
)
27+
if ($Candidates -notcontains $FileName) {
28+
Write-Warning "The '$FileName' is not recognized. Please check the file exists in https://developer.apple.com/metal/cpp/"
29+
Write-Host "The known values are: $($Candidates -join ', ')"
30+
}
31+
32+
# Download if not exists
33+
if ($(Test-Path -Path $FileName) -eq $false) {
34+
[Uri]$Remote = "https://developer.apple.com/metal/cpp/files/${FileName}"
35+
Invoke-WebRequest -Uri $Remote -OutFile $FileName
36+
}
37+
38+
# Overwrite existing files
39+
Expand-Archive -Path $FileName -DestinationPath $Folder -Force

setup-metal-cpp.ps1

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)