Skip to content

Commit 3230532

Browse files
authored
Add enable_embedded_wasm_sdk_build to swift_package_test.yml (#150)
* Add Embedded Swift for Wasm in `swift_package_test.yml` Also cleaned up incorrect "SDK" naming: we're using Swift SDKs and not plain Clang or Xcode SDKs in these workflows. * Update swift_package_test.yml * Update swift_package_test.yml * Update swift_package_test.yml * Update swift_package_test.yml * Fix capitalization * Use `main` branch script in `swift_package_test.yml` * Fix typo in `swift_package_test.yml` * Update pull_request.yml * Update pull_request.yml * Update pull_request.yml * Update pull_request.yml * Update pull_request.yml
1 parent b8f8a6c commit 3230532

File tree

2 files changed

+75
-11
lines changed

2 files changed

+75
-11
lines changed

.github/workflows/pull_request.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ on:
55
types: [opened, reopened, synchronize]
66

77
jobs:
8+
tests_with_docker_embedded_swift:
9+
name: Test Embedded Swift SDKs
10+
uses: ./.github/workflows/swift_package_test.yml
11+
with:
12+
# Wasm
13+
enable_linux_checks: false
14+
enable_macos_checks: false
15+
enable_windows_checks: false
16+
wasm_sdk_pre_build_command: |
17+
mkdir MyPackage
18+
cd MyPackage
19+
swift package init --type library
20+
enable_embedded_wasm_sdk_build: true
21+
822
tests_with_docker:
923
name: Test with Docker
1024
uses: ./.github/workflows/swift_package_test.yml

.github/workflows/swift_package_test.yml

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ on:
3333
default: "[\"jammy\"]"
3434
linux_static_sdk_versions:
3535
type: string
36-
description: "Linux Swift static SDK version list (JSON)"
36+
description: "Static Linux Swift SDK version list (JSON)"
3737
default: "[\"nightly-6.2\"]"
3838
wasm_sdk_versions:
3939
type: string
40-
description: "Swift Wasm SDK version list (JSON)"
41-
default: "[\"nightly-6.2\"]"
40+
description: "Wasm Swift SDK version list (JSON)"
41+
default: "[\"nightly-main\", \"nightly-6.2\"]"
42+
wasm_exclude_swift_versions:
43+
type: string
44+
description: "Exclude Wasm Swift SDK version list (JSON)"
45+
default: "[{\"swift_version\": \"\"}]"
4246
windows_swift_versions:
4347
type: string
4448
description: "Include Windows Swift version list (JSON)"
@@ -61,11 +65,11 @@ on:
6165
default: ""
6266
linux_static_sdk_pre_build_command:
6367
type: string
64-
description: "Linux command to execute before building the Swift package with the static SDK"
68+
description: "Linux command to execute before building the Swift package with the Static Linux Swift SDK"
6569
default: ""
6670
wasm_sdk_pre_build_command:
6771
type: string
68-
description: "Linux command to execute before building the Swift package with the Wasm SDK"
72+
description: "Linux command to execute before building the Swift package with the Embedded Swift SDK for Wasm"
6973
default: ""
7074
macos_pre_build_command:
7175
type: string
@@ -113,11 +117,15 @@ on:
113117
default: true
114118
enable_linux_static_sdk_build:
115119
type: boolean
116-
description: "Boolean to enable building with the Linux static SDK. Defaults to false"
120+
description: "Boolean to enable building with the Static Linux Swift SDK. Defaults to false"
117121
default: false
118122
enable_wasm_sdk_build:
119123
type: boolean
120-
description: "Boolean to enable building with the Wasm SDK. Defaults to false"
124+
description: "Boolean to enable building with the Swift SDK for Wasm. Defaults to false"
125+
default: false
126+
enable_embedded_wasm_sdk_build:
127+
type: boolean
128+
description: "Boolean to enable building with the Embedded Swift SDK for Wasm. Defaults to false"
121129
default: false
122130
enable_macos_checks:
123131
type: boolean
@@ -208,7 +216,7 @@ jobs:
208216
run: ${{ inputs.linux_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
209217

210218
linux-static-sdk-build:
211-
name: Linux Static SDK Build (${{ matrix.swift_version }} - ${{ matrix.os_version }})
219+
name: Static Linux Swift SDK Build (${{ matrix.swift_version }} - ${{ matrix.os_version }})
212220
if: ${{ inputs.enable_linux_static_sdk_build }}
213221
runs-on: ubuntu-latest
214222
strategy:
@@ -236,7 +244,7 @@ jobs:
236244
done
237245
- name: Pre-build
238246
run: ${{ inputs.linux_pre_build_command }}
239-
- name: Install static SDK and build
247+
- name: Install Static Linux Swift SDK and build
240248
env:
241249
BUILD_FLAGS: ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
242250
run: |
@@ -246,14 +254,16 @@ jobs:
246254
bash -s -- --static --flags="$BUILD_FLAGS" --build-command="${{ inputs.linux_static_sdk_build_command }}" ${{ matrix.swift_version }}
247255
248256
wasm-sdk-build:
249-
name: Wasm SDK Build (${{ matrix.swift_version }} - ${{ matrix.os_version }})
257+
name: Swift SDK for Wasm Build (${{ matrix.swift_version }} - ${{ matrix.os_version }})
250258
if: ${{ inputs.enable_wasm_sdk_build }}
251259
runs-on: ubuntu-latest
252260
strategy:
253261
fail-fast: false
254262
matrix:
255263
swift_version: ${{ fromJson(inputs.wasm_sdk_versions) }}
256264
os_version: ${{ fromJson(inputs.linux_os_versions) }}
265+
exclude:
266+
- ${{ fromJson(inputs.wasm_exclude_swift_versions) }}
257267
container:
258268
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
259269
steps:
@@ -274,7 +284,7 @@ jobs:
274284
done
275285
- name: Pre-build
276286
run: ${{ inputs.linux_pre_build_command }}
277-
- name: Install Wasm SDK and build
287+
- name: Install Swift SDK for Wasm and build
278288
env:
279289
BUILD_FLAGS: ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
280290
run: |
@@ -283,6 +293,46 @@ jobs:
283293
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \
284294
bash -s -- --wasm --flags="$BUILD_FLAGS" --build-command="${{ inputs.wasm_sdk_build_command }}" ${{ matrix.swift_version }}
285295
296+
embedded-wasm-sdk-build:
297+
name: Embedded Swift SDK for Wasm Build (${{ matrix.swift_version }} - ${{ matrix.os_version }})
298+
if: ${{ inputs.enable_embedded_wasm_sdk_build }}
299+
runs-on: ubuntu-latest
300+
strategy:
301+
fail-fast: false
302+
matrix:
303+
swift_version: ${{ fromJson(inputs.wasm_sdk_versions) }}
304+
os_version: ${{ fromJson(inputs.linux_os_versions) }}
305+
exclude:
306+
- ${{ fromJson(inputs.wasm_exclude_swift_versions) }}
307+
container:
308+
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
309+
steps:
310+
- name: Swift version
311+
run: swift --version
312+
- name: Checkout repository
313+
uses: actions/checkout@v4
314+
- name: Provide token
315+
if: ${{ inputs.needs_token }}
316+
run: |
317+
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
318+
- name: Set environment variables
319+
if: ${{ inputs.linux_env_vars }}
320+
run: |
321+
for i in "${{ inputs.linux_env_vars }}"
322+
do
323+
printf "%s\n" $i >> $GITHUB_ENV
324+
done
325+
- name: Pre-build
326+
run: ${{ inputs.linux_pre_build_command }}
327+
- name: Install Swift SDK for Wasm and build
328+
env:
329+
BUILD_FLAGS: ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
330+
run: |
331+
${{ inputs.wasm_sdk_pre_build_command }}
332+
which curl || (apt -q update && apt -yq install curl)
333+
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \
334+
bash -s -- --embedded-wasm --flags="$BUILD_FLAGS" ${{ matrix.swift_version }}
335+
286336
windows-build:
287337
name: Windows (${{ matrix.swift_version }} - windows-2022)
288338
if: ${{ inputs.enable_windows_checks }}

0 commit comments

Comments
 (0)