Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- macOS-26
swift-version:
- "6.2.1"
- DEVELOPMENT-SNAPSHOT-2025-09-07-a
- DEVELOPMENT-SNAPSHOT-2025-11-26-a
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Install Swift.
uses: ./
with:
Expand All @@ -32,6 +32,8 @@ jobs:
run: swift --version
- name: Run Swift
run: ./utils/swift-test
- name: Test clang
run: ./utils/clang-test
branch-test-with-swift-version-file:
name: Test with ".swift-version" file.
strategy:
Expand All @@ -41,7 +43,7 @@ jobs:
- macOS-26
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Install Swift.
uses: ./
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


.DS_Store
.vscode
__pycache__
*.pyc
/node_modules/*
Expand Down
12 changes: 12 additions & 0 deletions clang-test-source/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* *************************************************************************************************
test.c
© 2025 YOCKOW.
Licensed under MIT License.
See "LICENSE.txt" for more information.
************************************************************************************************ */

#include <stdio.h>

int main(int argc, char *argv[]){
printf("Hello, %s!\n", "World");
}
10 changes: 10 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ async function switch_swift(swift_version) {
await run(`Switch Developer Directory to ${developerDirectory}`, async () => {
await exec.exec('sudo xcode-select', ['-switch', developerDirectory]);
});
await run('Set SDKROOT environment variable', async () => {
await exec.exec('xcrun', ['--sdk', 'macosx', '--show-sdk-path'], {
listeners: {
stdout: (data) => {
const sdkPath = data.toString().trim();
core.exportVariable('SDKROOT', sdkPath);
}
}
});
});
}
core.addPath(swiftBinDirectory);
});
Expand Down
16 changes: 15 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,21 @@ async function switch_swift(swift_version: string): Promise<void> {
}
await run(`Switch Developer Directory to ${developerDirectory}`, async () => {
await exec.exec('sudo xcode-select', ['-switch', developerDirectory]);
})
});
await run('Set SDKROOT environment variable', async () => {
await exec.exec(
'xcrun',
['--sdk', 'macosx', '--show-sdk-path'],
{
listeners: {
stdout: (data: Buffer) => {
const sdkPath = data.toString().trim();
core.exportVariable('SDKROOT', sdkPath);
}
}
}
)
});
}

core.addPath(swiftBinDirectory);
Expand Down
19 changes: 19 additions & 0 deletions utils/clang-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -eu

declare -r utilsDir="$(cd "$(dirname "$0")" && pwd -L)"
declare -r repositoryDir="$(dirname "$utilsDir")"
declare -r clangTestSourceDir="${repositoryDir}/clang-test-source"
declare -r cTestSourcePath="${clangTestSourceDir}/test.c"

cd $(mktemp -d)
clang -O3 "$cTestSourcePath" -o ./test

declare output; output="$(./test)"
if [[ "$output" == "Hello, World!" ]]; then
echo "$output"
else
echo "Unexpected output⁉: $output"
exit 1
fi
1 change: 1 addition & 0 deletions utils/update-gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ from typing import List

ignorables: List[str] = [
'.DS_Store',
'.vscode',
'__pycache__',
'*.pyc',
'/node_modules/*',
Expand Down