Skip to content

Commit 87b88a7

Browse files
authored
Merge pull request #1816 from swiftwasm/maxd/5.3-ubuntu-20.04
Build 5.3 branch for Ubuntu 20.04 on CI
2 parents 9ac5acf + a9c1026 commit 87b88a7

File tree

4 files changed

+135
-28
lines changed

4 files changed

+135
-28
lines changed

.github/workflows/main.yml

Lines changed: 96 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- swiftwasm-release/5.3
1212

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

@@ -39,19 +39,65 @@ jobs:
3939
- uses: actions/cache@v1
4040
with:
4141
path: ../build-cache
42-
key: ${{ runner.os }}-sccache-v10-5.3-${{ steps.cache_timestamp.outputs.timestamp }}
42+
key: ubuntu-18.04-sccache-v10-5.3-${{ steps.cache_timestamp.outputs.timestamp }}
4343
restore-keys: |
44-
${{ runner.os }}-sccache-v10-5.3-
45-
- name: Build Linux installable archive
44+
ubuntu-18.04-sccache-v10-5.3-
45+
- name: Build Ubuntu 18.04 installable archive
4646
run: |
4747
./utils/webassembly/ci.sh
4848
echo "Cleanup build directory to free disk space"
4949
rm -rf ../build
50-
- name: Upload Linux installable archive
50+
- name: Upload 18.04 installable archive
51+
uses: actions/upload-artifact@v1
52+
with:
53+
name: ubuntu18.04-installable
54+
path: ../swift-wasm-5.3-SNAPSHOT-ubuntu18.04.tar.gz
55+
# - name: Pack test results
56+
# run: tar cJf swift-test-results.tar.gz ../build/*/swift-linux-x86_64/swift-test-results
57+
# - name: Upload test results
58+
# uses: actions/upload-artifact@v1
59+
# with:
60+
# name: linux-test-results
61+
# path: ./swift-test-results.tar.gz
62+
63+
ubuntu2004_build:
64+
timeout-minutes: 0
65+
runs-on: ubuntu-20.04
66+
67+
steps:
68+
- name: Free disk space
69+
run: |
70+
df -h
71+
sudo swapoff -a
72+
sudo rm -f /swapfile
73+
sudo rm -rf /opt/hostedtoolcache
74+
sudo rm -rf /usr/share/dotnet
75+
sudo apt clean
76+
docker rmi $(docker image ls -aq)
77+
df -h
78+
- uses: actions/checkout@v1
79+
with:
80+
path: swift
81+
- name: Prepare sccache timestamp
82+
id: cache_timestamp
83+
shell: cmake -P {0}
84+
run: |
85+
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
86+
message("::set-output name=timestamp::${current_date}")
87+
- uses: actions/cache@v1
88+
with:
89+
path: ../build-cache
90+
key: ubuntu-20.04-sccache-v10-5.3-${{ steps.cache_timestamp.outputs.timestamp }}
91+
restore-keys: |
92+
ubuntu-20.04-sccache-v10-5.3-
93+
- name: Build Ubuntu 20.04 installable archive
94+
run: |
95+
./utils/webassembly/ci.sh
96+
- name: Upload Ubuntu 20.04 installable archive
5197
uses: actions/upload-artifact@v1
5298
with:
53-
name: linux-installable
54-
path: ../swift-wasm-5.3-SNAPSHOT-linux.tar.gz
99+
name: ubuntu20.04-installable
100+
path: ../swift-wasm-5.3-SNAPSHOT-ubuntu20.04.tar.gz
55101
# - name: Pack test results
56102
# run: tar cJf swift-test-results.tar.gz ../build/*/swift-linux-x86_64/swift-test-results
57103
# - name: Upload test results
@@ -138,15 +184,51 @@ jobs:
138184
name: macos-hello.wasm
139185
path: hello.wasm
140186

141-
linux_smoke_test:
142-
name: Run smoke tests on Linux
187+
ubuntu1804_smoke_test:
188+
name: Run smoke tests on Ubuntu 18.04
143189
runs-on: ubuntu-18.04
144-
needs: linux_build
190+
needs: ubuntu1804_build
191+
steps:
192+
- name: Download installable Ubuntu 18.04 archive
193+
uses: actions/download-artifact@v1
194+
with:
195+
name: ubuntu18.04-installable
196+
- name: Build hello.wasm
197+
shell: bash
198+
run: |
199+
set -x
200+
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
201+
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
202+
echo 'print("Hello, world!")' > hello.swift
203+
$TOOLCHAIN_PATH/usr/bin/swiftc \
204+
-target wasm32-unknown-wasi \
205+
-sdk $TOOLCHAIN_PATH/usr/share/wasi-sysroot \
206+
hello.swift -o hello.wasm && \
207+
echo "Successfully linked hello.wasm"
208+
- name: Test SwiftPM
209+
shell: bash
210+
run: |
211+
set -x
212+
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
213+
mkdir test
214+
cd test
215+
$TOOLCHAIN_PATH/usr/bin/swift package init
216+
$TOOLCHAIN_PATH/usr/bin/swift build --triple wasm32-unknown-wasi
217+
- name: Upload hello.wasm compiled with Ubuntu 18.04 package
218+
uses: actions/upload-artifact@v1
219+
with:
220+
name: ubuntu18.04-hello.wasm
221+
path: hello.wasm
222+
223+
ubuntu2004_smoke_test:
224+
name: Run smoke tests on Ubuntu 20.04
225+
runs-on: ubuntu-20.04
226+
needs: ubuntu2004_build
145227
steps:
146-
- name: Download installable Linux archive
228+
- name: Download installable Ubuntu 20.04 archive
147229
uses: actions/download-artifact@v1
148230
with:
149-
name: linux-installable
231+
name: ubuntu20.04-installable
150232
- name: Build hello.wasm
151233
shell: bash
152234
run: |
@@ -168,8 +250,8 @@ jobs:
168250
cd test
169251
$TOOLCHAIN_PATH/usr/bin/swift package init
170252
$TOOLCHAIN_PATH/usr/bin/swift build --triple wasm32-unknown-wasi
171-
- name: Upload hello.wasm compiled with Linux package
253+
- name: Upload hello.wasm compiled with Ubuntu 20.04 package
172254
uses: actions/upload-artifact@v1
173255
with:
174-
name: linux-hello.wasm
256+
name: ubuntu2004-hello.wasm
175257
path: hello.wasm

utils/webassembly/build-toolchain.sh

Lines changed: 8 additions & 1 deletion
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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,25 +97,29 @@ upload_tarball() {
9797

9898
tmp_dir=$(mktemp -d)
9999
pushd $tmp_dir
100-
download_artifact linux-installable
100+
download_artifact ubuntu18.04-installable
101+
download_artifact ubuntu20.04-installable
101102
download_artifact macos-installable
102-
unzip linux-installable.zip
103+
unzip ubuntu18.04-installable.zip
104+
unzip ubuntu20.04-installable.zip
103105
unzip macos-installable.zip
104106

105-
toolchain_name=$(basename $(tar tfz swift-wasm-$2-SNAPSHOT-linux.tar.gz | head -n1))
107+
toolchain_name=$(basename $(tar tfz swift-wasm-$2-SNAPSHOT-ubuntu18.04.tar.gz | head -n1))
106108

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

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

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

121+
upload_tarball $release_id "$toolchain_name-ubuntu18.04.tar.gz"
122+
upload_tarball $release_id "$toolchain_name-ubuntu20.04.tar.gz"
118123
upload_tarball $release_id "$toolchain_name-osx.tar.gz"
119-
upload_tarball $release_id "$toolchain_name-linux.tar.gz"
120124

121125
popd

utils/webassembly/linux/install-dependencies.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,27 @@
33
set -ex
44

55
sudo apt update
6-
sudo apt install -y \
7-
git ninja-build clang python python-six \
8-
uuid-dev libicu-dev icu-devtools libbsd-dev \
9-
libedit-dev libxml2-dev libsqlite3-dev swig \
10-
libpython-dev libncurses5-dev pkg-config \
11-
libblocksruntime-dev libcurl4-openssl-dev \
12-
systemtap-sdt-dev tzdata rsync wget llvm zip unzip
6+
7+
if [ $(grep RELEASE /etc/lsb-release) == "DISTRIB_RELEASE=18.04" ]; then
8+
sudo apt install -y \
9+
git ninja-build clang python python-six \
10+
uuid-dev libicu-dev icu-devtools libbsd-dev \
11+
libedit-dev libxml2-dev libsqlite3-dev swig \
12+
libpython-dev libncurses5-dev pkg-config \
13+
libblocksruntime-dev libcurl4-openssl-dev \
14+
systemtap-sdt-dev tzdata rsync wget llvm zip unzip
15+
elif [ $(grep RELEASE /etc/lsb-release) == "DISTRIB_RELEASE=20.04" ]; then
16+
sudo apt install -y \
17+
git ninja-build clang python python-six \
18+
uuid-dev libicu-dev icu-devtools libbsd-dev \
19+
libedit-dev libxml2-dev libsqlite3-dev swig \
20+
libpython2-dev libncurses5-dev pkg-config \
21+
libblocksruntime-dev libcurl4-openssl-dev \
22+
systemtap-sdt-dev tzdata rsync wget llvm zip unzip
23+
else
24+
echo "Unknown Ubuntu version"
25+
exit 1
26+
fi
1327
sudo apt clean
1428

1529
SOURCE_PATH="$( cd "$(dirname $0)/../../../.." && pwd )"

0 commit comments

Comments
 (0)