Skip to content

Commit 3ee49a8

Browse files
[WASM] Add integration tests
1 parent d487b3d commit 3ee49a8

File tree

1 file changed

+45
-24
lines changed

1 file changed

+45
-24
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -153,32 +153,39 @@ jobs:
153153
uses: actions/download-artifact@v1
154154
with:
155155
name: macos-installable
156-
- name: Build hello.wasm
157-
shell: bash
156+
- name: Unpack toolchain
158157
run: |
159158
set -x
160159
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
161-
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
160+
echo "TOOLCHAIN=$(find "$PWD" -name "swift-wasm-*" -type d)" >> $GITHUB_ENV
161+
- name: Build hello.wasm
162+
shell: bash
163+
run: |
162164
echo 'print("Hello, world!")' > hello.swift
163-
$TOOLCHAIN_PATH/usr/bin/swiftc \
165+
$TOOLCHAIN/usr/bin/swiftc \
164166
-target wasm32-unknown-wasi \
165-
-sdk $TOOLCHAIN_PATH/usr/share/wasi-sysroot \
167+
-sdk $TOOLCHAIN/usr/share/wasi-sysroot \
166168
hello.swift -o hello.wasm && \
167169
echo "Successfully linked hello.wasm"
168170
- name: Test SwiftPM
169171
shell: bash
170172
run: |
171173
set -x
172-
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
173174
mkdir test
174175
cd test
175-
$TOOLCHAIN_PATH/usr/bin/swift package init
176-
$TOOLCHAIN_PATH/usr/bin/swift build --triple wasm32-unknown-wasi
176+
$TOOLCHAIN/usr/bin/swift package init
177+
$TOOLCHAIN/usr/bin/swift build --triple wasm32-unknown-wasi
177178
- name: Upload hello.wasm compiled with macOS package
178179
uses: actions/upload-artifact@v1
179180
with:
180181
name: macos-hello.wasm
181182
path: hello.wasm
183+
- name: Checkout integration-tests
184+
uses: actions/checkout@v2
185+
with:
186+
repository: swiftwasm/integration-tests
187+
- name: Run integration tests
188+
run: swift run # Use TOOLCHAIN env value
182189

183190
ubuntu1804_smoke_test:
184191
name: Run smoke tests on Ubuntu 18.04
@@ -189,32 +196,39 @@ jobs:
189196
uses: actions/download-artifact@v1
190197
with:
191198
name: ubuntu18.04-installable
192-
- name: Build hello.wasm
193-
shell: bash
199+
- name: Unpack toolchain
194200
run: |
195201
set -x
196202
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
197-
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
203+
echo "TOOLCHAIN=$(find "$PWD" -name "swift-wasm-*" -type d)" >> $GITHUB_ENV
204+
- name: Build hello.wasm
205+
shell: bash
206+
run: |
198207
echo 'print("Hello, world!")' > hello.swift
199-
$TOOLCHAIN_PATH/usr/bin/swiftc \
208+
$TOOLCHAIN/usr/bin/swiftc \
200209
-target wasm32-unknown-wasi \
201-
-sdk $TOOLCHAIN_PATH/usr/share/wasi-sysroot \
210+
-sdk $TOOLCHAIN/usr/share/wasi-sysroot \
202211
hello.swift -o hello.wasm && \
203212
echo "Successfully linked hello.wasm"
204213
- name: Test SwiftPM
205214
shell: bash
206215
run: |
207216
set -x
208-
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
209217
mkdir test
210218
cd test
211-
$TOOLCHAIN_PATH/usr/bin/swift package init
212-
$TOOLCHAIN_PATH/usr/bin/swift build --triple wasm32-unknown-wasi
219+
$TOOLCHAIN/usr/bin/swift package init
220+
$TOOLCHAIN/usr/bin/swift build --triple wasm32-unknown-wasi
213221
- name: Upload hello.wasm compiled with Ubuntu 18.04 package
214222
uses: actions/upload-artifact@v1
215223
with:
216224
name: ubuntu18.04-hello.wasm
217225
path: hello.wasm
226+
- name: Checkout integration-tests
227+
uses: actions/checkout@v2
228+
with:
229+
repository: swiftwasm/integration-tests
230+
- name: Run integration tests
231+
run: swift run # Use TOOLCHAIN env value
218232

219233
ubuntu2004_smoke_test:
220234
name: Run smoke tests on Ubuntu 20.04
@@ -225,29 +239,36 @@ jobs:
225239
uses: actions/download-artifact@v1
226240
with:
227241
name: ubuntu20.04-installable
228-
- name: Build hello.wasm
229-
shell: bash
242+
- name: Unpack toolchain
230243
run: |
231244
set -x
232245
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
233-
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
246+
echo "TOOLCHAIN=$(find "$PWD" -name "swift-wasm-*" -type d)" >> $GITHUB_ENV
247+
- name: Build hello.wasm
248+
shell: bash
249+
run: |
234250
echo 'print("Hello, world!")' > hello.swift
235-
$TOOLCHAIN_PATH/usr/bin/swiftc \
251+
$TOOLCHAIN/usr/bin/swiftc \
236252
-target wasm32-unknown-wasi \
237-
-sdk $TOOLCHAIN_PATH/usr/share/wasi-sysroot \
253+
-sdk $TOOLCHAIN/usr/share/wasi-sysroot \
238254
hello.swift -o hello.wasm && \
239255
echo "Successfully linked hello.wasm"
240256
- name: Test SwiftPM
241257
shell: bash
242258
run: |
243259
set -x
244-
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
245260
mkdir test
246261
cd test
247-
$TOOLCHAIN_PATH/usr/bin/swift package init
248-
$TOOLCHAIN_PATH/usr/bin/swift build --triple wasm32-unknown-wasi
262+
$TOOLCHAIN/usr/bin/swift package init
263+
$TOOLCHAIN/usr/bin/swift build --triple wasm32-unknown-wasi
249264
- name: Upload hello.wasm compiled with Ubuntu 20.04 package
250265
uses: actions/upload-artifact@v1
251266
with:
252267
name: ubuntu20.04-hello.wasm
253268
path: hello.wasm
269+
- name: Checkout integration-tests
270+
uses: actions/checkout@v2
271+
with:
272+
repository: swiftwasm/integration-tests
273+
- name: Run integration tests
274+
run: swift run # Use TOOLCHAIN env value

0 commit comments

Comments
 (0)