Skip to content

Commit 54574be

Browse files
Merge pull request #1253 from swiftwasm/5.3-swiftpm-smoke-test
Test SwiftPM included in the distribution on CI
2 parents 192832b + 13d5ae8 commit 54574be

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ jobs:
8383
with:
8484
name: macos-test-results
8585
path: ./swift-test-results.tar.gz
86+
8687
macos_smoke_test:
87-
name: Compile hello.swift on macOS
88+
name: Run smoke tests on macOS
8889
runs-on: macos-latest
8990
needs: macos_build
9091
steps:
@@ -97,16 +98,60 @@ jobs:
9798
run: |
9899
set -x
99100
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
100-
TOOLCHAIN_PATH=$(find . -name "swift-wasm-*" -type d)
101+
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
101102
echo 'print("Hello, world!")' > hello.swift
102103
$TOOLCHAIN_PATH/usr/bin/swiftc \
103104
-target wasm32-unknown-wasi \
104105
-sdk $TOOLCHAIN_PATH/usr/share/wasi-sysroot \
105106
hello.swift -o hello.wasm && \
106107
echo "Successfully linked hello.wasm"
107-
108+
- name: Test SwiftPM
109+
shell: bash
110+
run: |
111+
set -x
112+
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
113+
mkdir test
114+
cd test
115+
$TOOLCHAIN_PATH/usr/bin/swift package init
116+
$TOOLCHAIN_PATH/usr/bin/swift build --triple wasm32-unknown-wasi
108117
- name: Upload hello.wasm compiled with macOS package
109118
uses: actions/upload-artifact@v1
110119
with:
111120
name: macos-hello.wasm
112121
path: hello.wasm
122+
123+
linux_smoke_test:
124+
name: Run smoke tests on Linux
125+
runs-on: ubuntu-18.04
126+
needs: linux_build
127+
steps:
128+
- name: Download installable Linux archive
129+
uses: actions/download-artifact@v1
130+
with:
131+
name: linux-installable
132+
- name: Build hello.wasm
133+
shell: bash
134+
run: |
135+
set -x
136+
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
137+
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
138+
echo 'print("Hello, world!")' > hello.swift
139+
$TOOLCHAIN_PATH/usr/bin/swiftc \
140+
-target wasm32-unknown-wasi \
141+
-sdk $TOOLCHAIN_PATH/usr/share/wasi-sysroot \
142+
hello.swift -o hello.wasm && \
143+
echo "Successfully linked hello.wasm"
144+
- name: Test SwiftPM
145+
shell: bash
146+
run: |
147+
set -x
148+
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
149+
mkdir test
150+
cd test
151+
$TOOLCHAIN_PATH/usr/bin/swift package init
152+
$TOOLCHAIN_PATH/usr/bin/swift build --triple wasm32-unknown-wasi
153+
- name: Upload hello.wasm compiled with Linux package
154+
uses: actions/upload-artifact@v1
155+
with:
156+
name: linux-hello.wasm
157+
path: hello.wasm

0 commit comments

Comments
 (0)