Skip to content
Merged
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
15 changes: 15 additions & 0 deletions .github/workflows/wasm_sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: WebAssembly SDK

on:
workflow_call:

jobs:
wasm-sdk:
name: WebAssembly Swift SDK
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
with:
enable_wasm_sdk_build: true
enable_linux_checks: false
enable_windows_checks: false
swift_flags: --target NIOCore
swift_nightly_flags: --target NIOCore
Comment on lines +14 to +15
Copy link

@kkebo kkebo Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: Thanks to swiftlang/github-workflows#149, these two lines can be shortened into one line.

Suggested change
swift_flags: --target NIOCore
swift_nightly_flags: --target NIOCore
wasm_sdk_build_command: swift build --target NIOCore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC swift_nightly_flags in absence of a defined value is auto-populated from swift_flags, so the workflow here should just specify the latter without a need for wasm_sdk_build_command.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be missing something, but there's || inputs.swift_flags on the line you've linked to?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I linked to the following line.

BUILD_FLAGS: ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a ternary operator.

Copy link
Member

@MaxDesiatov MaxDesiatov Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. If swift_nightly_flags is undefined, the first operand of || is falsy, which then evaluates to the second operand swift_flags. You can also see swift_flags respected for nightlies in this workflow, where swift_nightly_flags is not defined at all https://github.com/swiftlang/swift-for-wasm-examples/blob/main/.github/workflows/pull_request.yml

Copy link

@kkebo kkebo Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was wrong. I didn't expect that the empty string was falsy. Thank you.

Loading