Skip to content

Commit 333cada

Browse files
committed
Add workflow for building with Wasm SDK
1 parent 6a86528 commit 333cada

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/pull_request.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ jobs:
2020
cd MyPackage
2121
swift package init --type library
2222
enable_linux_static_sdk_build: true
23+
# Wasm
24+
wasm_sdk_pre_build_command: |
25+
mkdir MyPackage
26+
cd MyPackage
27+
swift package init --type library
28+
enable_wasm_sdk_build: true
2329
# Windows
2430
windows_build_command: |
2531
mkdir MyPackage

.github/workflows/swift_package_test.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ on:
3535
type: string
3636
description: "Linux Swift static SDK version list (JSON)"
3737
default: "[\"nightly-6.2\"]"
38+
wasm_sdk_versions:
39+
type: string
40+
description: "Swift Wasm SDK version list (JSON)"
41+
default: "[\"nightly-6.2\"]"
3842
windows_swift_versions:
3943
type: string
4044
description: "Include Windows Swift version list (JSON)"
@@ -59,6 +63,10 @@ on:
5963
type: string
6064
description: "Linux command to execute before building the Swift package with the static SDK"
6165
default: ""
66+
wasm_sdk_pre_build_command:
67+
type: string
68+
description: "Linux command to execute before building the Swift package with the Wasm SDK"
69+
default: ""
6270
macos_pre_build_command:
6371
type: string
6472
description: "macOS command to execute before building the Swift package"
@@ -99,6 +107,10 @@ on:
99107
type: boolean
100108
description: "Boolean to enable building with the Linux static SDK. Defaults to false"
101109
default: false
110+
enable_wasm_sdk_build:
111+
type: boolean
112+
description: "Boolean to enable building with the Wasm SDK. Defaults to false"
113+
default: false
102114
enable_macos_checks:
103115
type: boolean
104116
description: "Boolean to enable macOS testing. Defaults to false"
@@ -225,6 +237,44 @@ jobs:
225237
curl -s --retry 3 https://raw.githubusercontent.com/jrflat/github-workflows/refs/heads/linux-static-sdk-build/.github/workflows/scripts/install-and-build-with-sdk.sh | \
226238
bash -s -- --static --flags "$BUILD_FLAGS" ${{ matrix.swift_version }}
227239
240+
wasm-sdk-build:
241+
name: Wasm SDK Build (${{ matrix.swift_version }} - ${{ matrix.os_version }})
242+
if: ${{ inputs.enable_wasm_sdk_build }}
243+
runs-on: ubuntu-latest
244+
strategy:
245+
fail-fast: false
246+
matrix:
247+
swift_version: ${{ fromJson(inputs.wasm_sdk_versions) }}
248+
os_version: ${{ fromJson(inputs.linux_os_versions) }}
249+
container:
250+
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
251+
steps:
252+
- name: Swift version
253+
run: swift --version
254+
- name: Checkout repository
255+
uses: actions/checkout@v4
256+
- name: Provide token
257+
if: ${{ inputs.needs_token }}
258+
run: |
259+
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
260+
- name: Set environment variables
261+
if: ${{ inputs.linux_env_vars }}
262+
run: |
263+
for i in "${{ inputs.linux_env_vars }}"
264+
do
265+
printf "%s\n" $i >> $GITHUB_ENV
266+
done
267+
- name: Pre-build
268+
run: ${{ inputs.linux_pre_build_command }}
269+
- name: Install Wasm SDK and build
270+
env:
271+
BUILD_FLAGS: ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
272+
run: |
273+
${{ inputs.wasm_sdk_pre_build_command }}
274+
which curl || (apt -q update && apt -yq install curl)
275+
curl -s --retry 3 https://raw.githubusercontent.com/jrflat/github-workflows/refs/heads/linux-static-sdk-build/.github/workflows/scripts/install-and-build-with-sdk.sh | \
276+
bash -s -- --wasm --flags "$BUILD_FLAGS" ${{ matrix.swift_version }}
277+
228278
windows-build:
229279
name: Windows (${{ matrix.swift_version }} - windows-2022)
230280
if: ${{ inputs.enable_windows_checks }}

0 commit comments

Comments
 (0)