From f2abe2b804591ec41b7b20892ae6461769eb1235 Mon Sep 17 00:00:00 2001 From: YOCKOW Date: Tue, 2 Dec 2025 11:58:22 +0900 Subject: [PATCH 1/3] CI: Change dev snapshot version. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e16ded..bac50d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ 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 From 20fc48a20522a296cf86bccfcd070a41df01f9a7 Mon Sep 17 00:00:00 2001 From: YOCKOW Date: Tue, 2 Dec 2025 12:25:24 +0900 Subject: [PATCH 2/3] Test clang. Checks https://github.com/YOCKOW/Action-setup-swift/issues/99 --- .github/workflows/ci.yml | 6 ++++-- .gitignore | 1 + clang-test-source/test.c | 12 ++++++++++++ utils/clang-test | 19 +++++++++++++++++++ utils/update-gitignore | 1 + 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 clang-test-source/test.c create mode 100755 utils/clang-test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bac50d8..d9dabba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - DEVELOPMENT-SNAPSHOT-2025-11-26-a runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Install Swift. uses: ./ with: @@ -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: @@ -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: diff --git a/.gitignore b/.gitignore index 1b54151..d4038f8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .DS_Store +.vscode __pycache__ *.pyc /node_modules/* diff --git a/clang-test-source/test.c b/clang-test-source/test.c new file mode 100644 index 0000000..0c3a22a --- /dev/null +++ b/clang-test-source/test.c @@ -0,0 +1,12 @@ +/* ************************************************************************************************* + test.c + © 2025 YOCKOW. + Licensed under MIT License. + See "LICENSE.txt" for more information. + ************************************************************************************************ */ + +#include + +int main(int argc, char *argv[]){ + printf("Hello, %s!\n", "World"); +} diff --git a/utils/clang-test b/utils/clang-test new file mode 100755 index 0000000..f4e222b --- /dev/null +++ b/utils/clang-test @@ -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 diff --git a/utils/update-gitignore b/utils/update-gitignore index d1e357b..dd0c2fc 100755 --- a/utils/update-gitignore +++ b/utils/update-gitignore @@ -7,6 +7,7 @@ from typing import List ignorables: List[str] = [ '.DS_Store', + '.vscode', '__pycache__', '*.pyc', '/node_modules/*', From 2710baf812b372cc9fc8b0a4ba5390ebc0c9ab59 Mon Sep 17 00:00:00 2001 From: YOCKOW Date: Tue, 2 Dec 2025 12:53:26 +0900 Subject: [PATCH 3/3] Export `SDKROOT` environment variable. --- lib/main.js | 10 ++++++++++ src/main.ts | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/main.js b/lib/main.js index b2c8ce2..3600815 100644 --- a/lib/main.js +++ b/lib/main.js @@ -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); }); diff --git a/src/main.ts b/src/main.ts index c29172b..4622a97 100644 --- a/src/main.ts +++ b/src/main.ts @@ -179,7 +179,21 @@ async function switch_swift(swift_version: string): Promise { } 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);