Skip to content

Commit 1d78375

Browse files
committed
Add Ubuntu 20.04 smoke test, update archive names
1 parent efd9ef7 commit 1d78375

File tree

3 files changed

+68
-20
lines changed

3 files changed

+68
-20
lines changed

.github/workflows/main.yml

+50-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- swiftwasm-release/5.3
1212

1313
jobs:
14-
ubuntu_1804_build:
14+
ubuntu1804_build:
1515
timeout-minutes: 0
1616
runs-on: ubuntu-18.04
1717

@@ -48,8 +48,8 @@ jobs:
4848
- name: Upload Ubuntu 18.04 installable archive
4949
uses: actions/upload-artifact@v1
5050
with:
51-
name: ubuntu_18.04-installable
52-
path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-linux.tar.gz
51+
name: ubuntu18.04-installable
52+
path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-ubuntu18.04.tar.gz
5353
# - name: Pack test results
5454
# run: tar cJf swift-test-results.tar.gz ../build/*/swift-linux-x86_64/swift-test-results
5555
# - name: Upload test results
@@ -58,7 +58,7 @@ jobs:
5858
# name: linux-test-results
5959
# path: ./swift-test-results.tar.gz
6060

61-
ubuntu_2004_build:
61+
ubuntu2004_build:
6262
timeout-minutes: 0
6363
runs-on: ubuntu-20.04
6464

@@ -91,11 +91,11 @@ jobs:
9191
- name: Build Ubuntu 20.04 installable archive
9292
run: |
9393
./utils/webassembly/ci.sh
94-
# - name: Upload Linux installable archive
95-
# uses: actions/upload-artifact@v1
96-
# with:
97-
# name: linux-installable
98-
# path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-linux.tar.gz
94+
- name: Upload Ubuntu 20.04 installable archive
95+
uses: actions/upload-artifact@v1
96+
with:
97+
name: ubuntu20.04-installable
98+
path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-ubuntu20.04.tar.gz
9999
# - name: Pack test results
100100
# run: tar cJf swift-test-results.tar.gz ../build/*/swift-linux-x86_64/swift-test-results
101101
# - name: Upload test results
@@ -140,6 +140,7 @@ jobs:
140140
with:
141141
name: macos-test-results
142142
path: ./swift-test-results.tar.gz
143+
143144
macos_smoke_test:
144145
name: Run smoke tests on macOS
145146
runs-on: macos-latest
@@ -176,15 +177,15 @@ jobs:
176177
name: macos-hello.wasm
177178
path: hello.wasm
178179

179-
ubuntu_1804_smoke_test:
180+
ubuntu1804_smoke_test:
180181
name: Run smoke tests on Ubuntu 18.04
181182
runs-on: ubuntu-18.04
182-
needs: ubuntu_1804_build
183+
needs: ubuntu1804_build
183184
steps:
184185
- name: Download installable Ubuntu 18.04 archive
185186
uses: actions/download-artifact@v1
186187
with:
187-
name: ubuntu_18.04-installable
188+
name: ubuntu18.04-installable
188189
- name: Build hello.wasm
189190
shell: bash
190191
run: |
@@ -209,5 +210,41 @@ jobs:
209210
- name: Upload hello.wasm compiled with Ubuntu 18.04 package
210211
uses: actions/upload-artifact@v1
211212
with:
212-
name: linux-hello.wasm
213+
name: ubuntu18.04-hello.wasm
213214
path: hello.wasm
215+
216+
ubuntu2004_smoke_test:
217+
name: Run smoke tests on Ubuntu 20.04
218+
runs-on: ubuntu-20.04
219+
needs: ubuntu2004_build
220+
steps:
221+
- name: Download installable Ubuntu 20.04 archive
222+
uses: actions/download-artifact@v1
223+
with:
224+
name: ubuntu20.04-installable
225+
- name: Build hello.wasm
226+
shell: bash
227+
run: |
228+
set -x
229+
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
230+
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
231+
echo 'print("Hello, world!")' > hello.swift
232+
$TOOLCHAIN_PATH/usr/bin/swiftc \
233+
-target wasm32-unknown-wasi \
234+
-sdk $TOOLCHAIN_PATH/usr/share/wasi-sysroot \
235+
hello.swift -o hello.wasm && \
236+
echo "Successfully linked hello.wasm"
237+
- name: Test SwiftPM
238+
shell: bash
239+
run: |
240+
set -x
241+
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
242+
mkdir test
243+
cd test
244+
$TOOLCHAIN_PATH/usr/bin/swift package init
245+
$TOOLCHAIN_PATH/usr/bin/swift build --triple wasm32-unknown-wasi
246+
- name: Upload hello.wasm compiled with Ubuntu 20.04 package
247+
uses: actions/upload-artifact@v1
248+
with:
249+
name: ubuntu2004-hello.wasm
250+
path: hello.wasm

utils/webassembly/build-toolchain.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ case $(uname -s) in
1414
HOST_SUFFIX=macosx-x86_64
1515
;;
1616
Linux)
17-
OS_SUFFIX=linux
17+
if [ $(grep RELEASE /etc/lsb-release) == "DISTRIB_RELEASE=18.04" ]; then
18+
OS_SUFFIX=ubuntu18.04
19+
elif [ $(grep RELEASE /etc/lsb-release) == "DISTRIB_RELEASE=20.04" ]; then
20+
OS_SUFFIX=ubuntu20.04
21+
else
22+
echo "Unknown Ubuntu version"
23+
exit 1
24+
fi
1825
HOST_PRESET=webassembly-linux-host
1926
TARGET_PRESET=webassembly-linux-target
2027
HOST_SUFFIX=linux-x86_64

utils/webassembly/distribute-latest-toolchain.sh

+10-6
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,29 @@ upload_tarball() {
9696

9797
tmp_dir=$(mktemp -d)
9898
pushd $tmp_dir
99-
download_artifact linux-installable
99+
download_artifact ubuntu18.04-installable
100+
download_artifact ubuntu20.04-installable
100101
download_artifact macos-installable
101-
unzip linux-installable.zip
102+
unzip ubuntu18.04-installable.zip
103+
unzip ubuntu20.04-installable.zip
102104
unzip macos-installable.zip
103105

104-
toolchain_name=$(basename $(tar tfz swift-wasm-$2-SNAPSHOT-linux.tar.gz | head -n1))
106+
toolchain_name=$(basename $(tar tfz swift-wasm-$2-SNAPSHOT-ubuntu18.04.tar.gz | head -n1))
105107

106108
if is_released $toolchain_name; then
107109
echo "Latest toolchain $toolchain_name has been already released"
108110
exit 0
109111
fi
110112

111-
cp swift-wasm-$2-SNAPSHOT-linux.tar.gz "$toolchain_name-linux.tar.gz"
112-
cp swift-wasm-$2-SNAPSHOT-osx.tar.gz "$toolchain_name-osx.tar.gz"
113+
mv swift-wasm-$2-SNAPSHOT-ubuntu18.04.tar.gz "$toolchain_name-ubuntu18.04.tar.gz"
114+
mv swift-wasm-$2-SNAPSHOT-ubuntu20.04.tar.gz "$toolchain_name-ubuntu20.04.tar.gz"
115+
mv swift-wasm-$2-SNAPSHOT-osx.tar.gz "$toolchain_name-osx.tar.gz"
113116

114117
create_tag $toolchain_name $head_sha
115118
release_id=$(create_release $toolchain_name $toolchain_name $head_sha)
116119

120+
upload_tarball $release_id "$toolchain_name-ubuntu18.04.tar.gz"
121+
upload_tarball $release_id "$toolchain_name-ubuntu20.04.tar.gz"
117122
upload_tarball $release_id "$toolchain_name-osx.tar.gz"
118-
upload_tarball $release_id "$toolchain_name-linux.tar.gz"
119123

120124
popd

0 commit comments

Comments
 (0)