Skip to content

Commit 0a35622

Browse files
Start v2 development
1 parent e5a6593 commit 0a35622

19 files changed

+927
-45423
lines changed

.eslintignore

-1
This file was deleted.

.github/workflows/test.yml

+10-43
Original file line numberDiff line numberDiff line change
@@ -15,57 +15,24 @@ jobs:
1515
- run: npm ci
1616
- run: npm test
1717

18-
# test action works running from the graph
1918
test:
2019
strategy:
2120
fail-fast: true
2221
matrix:
2322
include:
24-
- swift-version: wasm-5.7.1-RELEASE
25-
os: ubuntu-22.04
26-
- swift-version: wasm-5.6.0-RELEASE
27-
os: macos-11
28-
- swift-version: wasm-5.8.0-RELEASE
29-
os: ubuntu-latest
30-
container: swift:amazonlinux2
23+
- os: macos-11
24+
- os: ubuntu-latest
25+
container: swift:6.0.3
26+
- os: ubuntu-latest
27+
container: swift:6.0.3-amazonlinux2
3128
runs-on: ${{ matrix.os }}
3229
container: ${{ matrix.container }}
3330
steps:
3431
- uses: actions/checkout@v4
35-
- uses: ./
36-
with:
37-
swift-version: ${{ matrix.swift-version }}
3832
- run: swift --version
39-
test-default:
40-
runs-on: ubuntu-22.04
41-
steps:
42-
- uses: actions/checkout@v4
4333
- uses: ./
44-
- run: swift --version
45-
test-skip-add-to-path:
46-
runs-on: ubuntu-22.04
47-
steps:
48-
- uses: actions/checkout@v4
49-
- uses: ./
50-
id: setup
51-
with:
52-
add-to-path: false
53-
- name: Ensure that the toolchain is not added to the PATH
54-
shell: node {0}
55-
run: |
56-
const path = require('path');
57-
const toolchainPath = path.join(process.env.TOOLCHAIN_PATH, 'usr', 'bin');
58-
const pathEnv = process.env.PATH;
59-
console.log(`Checking if ${toolchainPath} is in the PATH (${pathEnv})`);
60-
const pathCandidates = pathEnv.split(path.delimiter);
61-
if (pathCandidates.includes(toolchainPath)) {
62-
throw new Error(`Toolchain path ${toolchainPath} is in the PATH`);
63-
}
64-
env:
65-
TOOLCHAIN_PATH: ${{ steps.setup.outputs.toolchain-path }}
66-
test-nightly:
67-
runs-on: ubuntu-latest
68-
steps:
69-
- uses: actions/checkout@v4
70-
- uses: ./nightly
71-
- run: swift --version
34+
- run: |
35+
mkdir -p /tmp/hello
36+
cd /tmp/hello
37+
swift package init --type executable
38+
swift build --swift-sdk wasm32-unknown-wasi

README.md

+20-15
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
11
# setup-swiftwasm
22

3-
A GitHub Action that downloads a SwiftWasm toolchain and adds it to the `PATH`.
3+
A GitHub Action that installs a Swift SDK for WebAssembly.
44

5+
## Requirements
56

6-
## Usage
7+
This action requires a runner with Swift installed.
78

8-
To run the action with the latest SwiftWasm toolchain, add the following to your workflow file:
9+
## Usage
910

1011
```yaml
11-
- uses: swiftwasm/setup-swiftwasm@v1
12-
- run: swift --version # `swift` command in SwiftWasm
12+
runs-on: ubuntu-latest
13+
container: swift:6.0.3
14+
steps:
15+
- uses: swiftwasm/setup-swiftwasm@v2
16+
- run: swift build --swift-sdk wasm32-unknown-wasi
1317
```
1418
15-
A specific toolchain version can be specified with the `swift-version` input:
19+
To install a Swift SDK compatible with a specific Swift version, add the following to your workflow file:
1620
1721
```yaml
18-
- uses: swiftwasm/setup-swiftwasm@v1
22+
- uses: swiftwasm/setup-swiftwasm@v2
1923
with:
20-
swift-version: "wasm-5.6.0-RELEASE"
24+
tag: "swift-DEVELOPMENT-SNAPSHOT-2025-02-26-a"
2125
```
2226
23-
You can also specify nightly toolchains:
27+
To install a Swift SDK for other targets, add the following to your workflow file:
2428
2529
```yaml
26-
- uses: swiftwasm/setup-swiftwasm@v1
30+
- uses: swiftwasm/setup-swiftwasm@v2
2731
with:
28-
swift-version: "wasm-DEVELOPMENT-SNAPSHOT-2022-10-04-a"
32+
target: "wasm32-unknown-wasip1-threads"
2933
```
3034
31-
You can find the list of available toolchain versions on the [SwiftWasm Releases page](https://github.com/swiftwasm/swift/releases).
32-
33-
## Supported Platforms
35+
## Inputs
3436
35-
The action currently supports macOS and Ubuntu runners.
37+
| Input | Default | Description |
38+
|-------|---------|-------------|
39+
| `tag` | The version of `swift` found in the PATH. | The tag name of swiftlang/swift repository to download the Swift SDK compatible with. |
40+
| `target` | `wasm32-unknown-wasi` | The target to install the Swift SDK for. |

action.yml

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
name: 'Setup SwiftWasm'
2-
description: 'Download a SwiftWasm toolchain and add it to the PATH'
2+
description: 'Install a Swift SDK for WebAssembly'
33
branding:
44
color: orange
55
icon: download
66
inputs:
7-
swift-version:
8-
description: 'Swift version to configure. Reads from .swift-version if unset. Use default value if both are absent.'
9-
add-to-path:
10-
description: 'Add the toolchain to the PATH'
11-
default: 'true'
7+
tag:
8+
description: >
9+
The tag name of swiftlang/swift repository to download the Swift SDK compatible with.
10+
For example, `swift-6.0.3-RELEASE` or `swift-DEVELOPMENT-SNAPSHOT-2025-02-26-a`.
11+
By default, it uses the version of `swift` found in the PATH.
12+
required: false
13+
target:
14+
description: >
15+
The target to install the Swift SDK for.
16+
For example, `wasm32-unknown-wasi` or `wasm32-unknown-wasip1-threads`.
17+
required: false
18+
default: 'wasm32-unknown-wasi'
1219
runs:
1320
using: 'node20'
1421
main: 'dist/index.js'

0 commit comments

Comments
 (0)