Skip to content

Commit fbeca65

Browse files
Merge remote-tracking branch 'swiftwasm/swiftwasm' into katei/wasm-thin-lto
2 parents 179aeb3 + 4fdc97a commit fbeca65

File tree

2,749 files changed

+120096
-73471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,749 files changed

+120096
-73471
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: MaxDesiatov # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
3+
github: [kateinoigakukun, MaxDesiatov] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-fi username

.github/pull.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
version: "1"
22
rules:
33
- base: swiftwasm
4-
upstream: master
4+
upstream: main
55
mergeMethod: merge
6-
- base: master
7-
upstream: apple:master
6+
- base: main
7+
upstream: apple:main
88
mergeMethod: hardreset
99
- base: release/5.3
1010
upstream: apple:release/5.3

.github/workflows/main.yml

Lines changed: 168 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,91 @@ 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

1818
steps:
1919
- name: Free disk space
2020
run: |
2121
df -h
22-
sudo apt-get purge libgcc-9-dev gcc-9 libstdc++-9-dev
22+
sudo apt-get purge libgcc-9-dev gcc-9 libstdc++-9-dev clang-6.0 llvm-6.0
2323
sudo swapoff -a
2424
sudo rm -f /swapfile
25+
sudo rm -rf /opt/hostedtoolcache
26+
sudo rm -rf /usr/share/dotnet
2527
sudo apt clean
2628
docker rmi $(docker image ls -aq)
2729
df -h
2830
- uses: actions/checkout@v1
2931
with:
3032
path: swift
33+
- name: Prepare sccache timestamp
34+
id: cache_timestamp
35+
shell: cmake -P {0}
36+
run: |
37+
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
38+
message("::set-output name=timestamp::${current_date}")
39+
- uses: actions/cache@v1
40+
with:
41+
path: ../build-cache
42+
key: ubuntu-18.04-sccache-v10-${{ steps.cache_timestamp.outputs.timestamp }}
43+
restore-keys: |
44+
ubuntu-18.04-sccache-v10-
45+
- name: Build Ubuntu 18.04 installable archive
46+
run: |
47+
./utils/webassembly/ci.sh
48+
- name: Upload Ubuntu 18.04 installable archive
49+
uses: actions/upload-artifact@v1
50+
with:
51+
name: ubuntu18.04-installable
52+
path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-ubuntu18.04_x86_64.tar.gz
53+
# - name: Pack test results
54+
# run: tar cJf swift-test-results.tar.gz ../build/*/swift-linux-x86_64/swift-test-results
55+
# - name: Upload test results
56+
# uses: actions/upload-artifact@v1
57+
# with:
58+
# name: linux-test-results
59+
# path: ./swift-test-results.tar.gz
60+
61+
ubuntu2004_build:
62+
timeout-minutes: 0
63+
runs-on: ubuntu-20.04
64+
65+
steps:
66+
- name: Free disk space
67+
run: |
68+
df -h
69+
sudo swapoff -a
70+
sudo rm -f /swapfile
71+
sudo rm -rf /opt/hostedtoolcache
72+
sudo rm -rf /usr/share/dotnet
73+
sudo apt clean
74+
docker rmi $(docker image ls -aq)
75+
df -h
76+
- uses: actions/checkout@v1
77+
with:
78+
path: swift
79+
- name: Prepare sccache timestamp
80+
id: cache_timestamp
81+
shell: cmake -P {0}
82+
run: |
83+
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
84+
message("::set-output name=timestamp::${current_date}")
3185
- uses: actions/cache@v1
3286
with:
3387
path: ../build-cache
34-
key: ${{ runner.os }}-sccache-v9
35-
- name: Build Linux installable archive
88+
key: ubuntu-20.04-sccache-v10-${{ steps.cache_timestamp.outputs.timestamp }}
89+
restore-keys: |
90+
ubuntu-20.04-sccache-v10-
91+
- name: Build Ubuntu 20.04 installable archive
3692
run: |
3793
./utils/webassembly/ci.sh
38-
echo "Cleanup build directory to free disk space"
39-
rm -rf ../build
40-
- name: Upload Linux installable archive
94+
- name: Upload Ubuntu 20.04 installable archive
4195
uses: actions/upload-artifact@v1
4296
with:
43-
name: linux-installable
44-
path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-linux.tar.gz
97+
name: ubuntu20.04-installable
98+
path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-ubuntu20.04_x86_64.tar.gz
4599
# - name: Pack test results
46100
# run: tar cJf swift-test-results.tar.gz ../build/*/swift-linux-x86_64/swift-test-results
47101
# - name: Upload test results
@@ -52,99 +106,177 @@ jobs:
52106

53107
macos_build:
54108
timeout-minutes: 0
55-
runs-on: macos-latest
109+
runs-on: macos-10.15
56110

57111
steps:
58112
- uses: actions/checkout@v1
59113
with:
60114
path: swift
115+
- name: Prepare sccache timestamp
116+
id: cache_timestamp
117+
shell: cmake -P {0}
118+
run: |
119+
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
120+
message("::set-output name=timestamp::${current_date}")
61121
- uses: actions/cache@v1
62122
with:
63123
path: ../build-cache
64-
key: ${{ runner.os }}-sccache-v9
124+
key: ${{ runner.os }}-sccache-v10-${{ steps.cache_timestamp.outputs.timestamp }}
125+
restore-keys: |
126+
${{ runner.os }}-sccache-v10-
65127
- name: Build macOS installable archive
66128
run: |
67-
sudo xcode-select --switch /Applications/Xcode_12_beta.app/Contents/Developer/
129+
sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer/
130+
xcodebuild -version
68131
./utils/webassembly/ci.sh
69132
- name: Upload macOS installable archive
70133
uses: actions/upload-artifact@v1
71134
with:
72135
name: macos-installable
73-
path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-osx.tar.gz
136+
path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-macos_x86_64.tar.gz
74137
- name: Pack test results
75-
run: tar cJf swift-test-results.tar.gz ../build/*/swift-macosx-x86_64/swift-test-results
138+
working-directory: ${{ github.workspace }}/../
139+
run: |
140+
tar cJf ./swift/swift-test-results.tar.gz target-build/*/swift-macosx-x86_64/swift-test-results
76141
- name: Upload test results
77142
uses: actions/upload-artifact@v1
78143
with:
79144
name: macos-test-results
80145
path: ./swift-test-results.tar.gz
146+
81147
macos_smoke_test:
82148
name: Run smoke tests on macOS
83-
runs-on: macos-latest
149+
runs-on: macos-10.15
84150
needs: macos_build
85151
steps:
86152
- name: Download installable macOS archive
87153
uses: actions/download-artifact@v1
88154
with:
89155
name: macos-installable
90-
- name: Build hello.wasm
91-
shell: bash
156+
- name: Unpack toolchain
92157
run: |
93158
set -x
94159
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
95-
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: |
96164
echo 'print("Hello, world!")' > hello.swift
97-
$TOOLCHAIN_PATH/usr/bin/swiftc \
165+
$TOOLCHAIN/usr/bin/swiftc \
98166
-target wasm32-unknown-wasi \
99-
-sdk $TOOLCHAIN_PATH/usr/share/wasi-sysroot \
167+
-sdk $TOOLCHAIN/usr/share/wasi-sysroot \
100168
hello.swift -o hello.wasm && \
101169
echo "Successfully linked hello.wasm"
102170
- name: Test SwiftPM
103171
shell: bash
104172
run: |
105173
set -x
106-
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
107174
mkdir test
108175
cd test
109-
$TOOLCHAIN_PATH/usr/bin/swift package init
110-
$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
111178
- name: Upload hello.wasm compiled with macOS package
112179
uses: actions/upload-artifact@v1
113180
with:
114181
name: macos-hello.wasm
115182
path: hello.wasm
116-
linux_smoke_test:
117-
name: Run smoke tests on Linux
183+
- name: Checkout integration-tests
184+
uses: actions/checkout@v2
185+
with:
186+
repository: swiftwasm/integration-tests
187+
path: integration-tests
188+
- name: Run integration tests
189+
run: |
190+
sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer/
191+
swift run # Use TOOLCHAIN env value
192+
working-directory: ${{ github.workspace }}/integration-tests
193+
194+
ubuntu1804_smoke_test:
195+
name: Run smoke tests on Ubuntu 18.04
118196
runs-on: ubuntu-18.04
119-
needs: linux_build
197+
needs: ubuntu1804_build
120198
steps:
121-
- name: Download installable Linux archive
199+
- name: Download installable Ubuntu 18.04 archive
122200
uses: actions/download-artifact@v1
123201
with:
124-
name: linux-installable
202+
name: ubuntu18.04-installable
203+
- name: Unpack toolchain
204+
run: |
205+
set -x
206+
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
207+
echo "TOOLCHAIN=$(find "$PWD" -name "swift-wasm-*" -type d)" >> $GITHUB_ENV
125208
- name: Build hello.wasm
209+
shell: bash
210+
run: |
211+
echo 'print("Hello, world!")' > hello.swift
212+
$TOOLCHAIN/usr/bin/swiftc \
213+
-target wasm32-unknown-wasi \
214+
-sdk $TOOLCHAIN/usr/share/wasi-sysroot \
215+
hello.swift -o hello.wasm && \
216+
echo "Successfully linked hello.wasm"
217+
- name: Test SwiftPM
126218
shell: bash
219+
run: |
220+
set -x
221+
mkdir test
222+
cd test
223+
$TOOLCHAIN/usr/bin/swift package init
224+
$TOOLCHAIN/usr/bin/swift build --triple wasm32-unknown-wasi
225+
- name: Upload hello.wasm compiled with Ubuntu 18.04 package
226+
uses: actions/upload-artifact@v1
227+
with:
228+
name: ubuntu18.04-hello.wasm
229+
path: hello.wasm
230+
- name: Checkout integration-tests
231+
uses: actions/checkout@v2
232+
with:
233+
repository: swiftwasm/integration-tests
234+
path: integration-tests
235+
- name: Run integration tests
236+
run: swift run # Use TOOLCHAIN env value
237+
working-directory: ${{ github.workspace }}/integration-tests
238+
239+
ubuntu2004_smoke_test:
240+
name: Run smoke tests on Ubuntu 20.04
241+
runs-on: ubuntu-20.04
242+
needs: ubuntu2004_build
243+
steps:
244+
- name: Download installable Ubuntu 20.04 archive
245+
uses: actions/download-artifact@v1
246+
with:
247+
name: ubuntu20.04-installable
248+
- name: Unpack toolchain
127249
run: |
128250
set -x
129251
tar xf $(find . -name "swift-wasm-*.tar.gz" -type f)
130-
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
252+
echo "TOOLCHAIN=$(find "$PWD" -name "swift-wasm-*" -type d)" >> $GITHUB_ENV
253+
- name: Build hello.wasm
254+
shell: bash
255+
run: |
131256
echo 'print("Hello, world!")' > hello.swift
132-
$TOOLCHAIN_PATH/usr/bin/swiftc \
257+
$TOOLCHAIN/usr/bin/swiftc \
133258
-target wasm32-unknown-wasi \
134-
-sdk $TOOLCHAIN_PATH/usr/share/wasi-sysroot \
259+
-sdk $TOOLCHAIN/usr/share/wasi-sysroot \
135260
hello.swift -o hello.wasm && \
136261
echo "Successfully linked hello.wasm"
137262
- name: Test SwiftPM
138263
shell: bash
139264
run: |
140265
set -x
141-
TOOLCHAIN_PATH=$(find "$PWD" -name "swift-wasm-*" -type d)
142266
mkdir test
143267
cd test
144-
$TOOLCHAIN_PATH/usr/bin/swift package init
145-
$TOOLCHAIN_PATH/usr/bin/swift build --triple wasm32-unknown-wasi
146-
- name: Upload hello.wasm compiled with Linux package
268+
$TOOLCHAIN/usr/bin/swift package init
269+
$TOOLCHAIN/usr/bin/swift build --triple wasm32-unknown-wasi
270+
- name: Upload hello.wasm compiled with Ubuntu 20.04 package
147271
uses: actions/upload-artifact@v1
148272
with:
149-
name: linux-hello.wasm
273+
name: ubuntu20.04-hello.wasm
150274
path: hello.wasm
275+
- name: Checkout integration-tests
276+
uses: actions/checkout@v2
277+
with:
278+
repository: swiftwasm/integration-tests
279+
path: integration-tests
280+
- name: Run integration tests
281+
run: swift run # Use TOOLCHAIN env value
282+
working-directory: ${{ github.workspace }}/integration-tests
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Manual distribution
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
channel:
6+
description: 'Release channel'
7+
required: true
8+
toolchain_name:
9+
description: 'Toolchain name'
10+
required: true
11+
display_name:
12+
description: 'Display name for Darwin toolchain'
13+
display_name_short:
14+
description: 'Short display name for Darwin toolchain'
15+
jobs:
16+
manual-distribution:
17+
runs-on: macos-latest
18+
steps:
19+
- uses: actions/checkout@v1
20+
- name: Setup keychain
21+
run: |
22+
security create-keychain -p "$KEYCHAIN_PASSWORD" swiftwasm-ci
23+
KEYCHAIN=$HOME/Library/Keychains/swiftwasm-ci-db
24+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN
25+
security set-keychain-settings -lut 7200 $KEYCHAIN
26+
security default-keychain -s $KEYCHAIN
27+
echo "$DARWIN_TOOLCHAIN_APPLICATION_CERT_BASE64" | base64 --decode -o developerID_application.p12
28+
security import developerID_application.p12 -P "$DARWIN_TOOLCHAIN_APPLICATION_CERT_PASSWORD" -T /usr/bin/pkgbuild -T /usr/bin/codesign
29+
echo "$DARWIN_TOOLCHAIN_INSTALLER_CERT_BASE64" | base64 --decode -o developerID_installer.p12
30+
security import developerID_installer.p12 -P "$DARWIN_TOOLCHAIN_INSTALLER_CERT_PASSWORD" -T /usr/bin/pkgbuild -T /usr/bin/codesign
31+
security set-key-partition-list -S "apple-tool:,apple:" -s -k "$KEYCHAIN_PASSWORD" $KEYCHAIN
32+
env:
33+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
34+
DARWIN_TOOLCHAIN_APPLICATION_CERT: ${{ secrets.DARWIN_TOOLCHAIN_APPLICATION_CERT }}
35+
DARWIN_TOOLCHAIN_APPLICATION_CERT_BASE64: ${{ secrets.DARWIN_TOOLCHAIN_APPLICATION_CERT_BASE64 }}
36+
DARWIN_TOOLCHAIN_APPLICATION_CERT_PASSWORD: ${{ secrets.DARWIN_TOOLCHAIN_APPLICATION_CERT_PASSWORD }}
37+
DARWIN_TOOLCHAIN_INSTALLER_CERT: ${{ secrets.DARWIN_TOOLCHAIN_INSTALLER_CERT }}
38+
DARWIN_TOOLCHAIN_INSTALLER_CERT_BASE64: ${{ secrets.DARWIN_TOOLCHAIN_INSTALLER_CERT_BASE64 }}
39+
DARWIN_TOOLCHAIN_INSTALLER_CERT_PASSWORD: ${{ secrets.DARWIN_TOOLCHAIN_INSTALLER_CERT_PASSWORD }}
40+
- run: |
41+
case "${{ github.event.inputs.channel }}" in
42+
"DEVELOPMENT")
43+
./utils/webassembly/distribute-latest-toolchain.sh swiftwasm DEVELOPMENT "${{ github.event.inputs.toolchain_name }}"
44+
;;
45+
"5.3")
46+
./utils/webassembly/distribute-latest-toolchain.sh swiftwasm-release/5.3 5.3 "${{ github.event.inputs.toolchain_name }}"
47+
;;
48+
*)
49+
echo "Unrecognised release channel: ${{ github.event.inputs.channel }}"
50+
exit 1
51+
;;
52+
esac
53+
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
DARWIN_TOOLCHAIN_APPLICATION_CERT: ${{ secrets.DARWIN_TOOLCHAIN_APPLICATION_CERT }}
57+
DARWIN_TOOLCHAIN_INSTALLER_CERT: ${{ secrets.DARWIN_TOOLCHAIN_INSTALLER_CERT }}
58+
DARWIN_TOOLCHAIN_NOTARIZE_EMAIL: ${{ secrets.DARWIN_TOOLCHAIN_NOTARIZE_EMAIL }}
59+
DARWIN_TOOLCHAIN_NOTARIZE_PASSWORD: ${{ secrets.DARWIN_TOOLCHAIN_NOTARIZE_PASSWORD }}
60+
DARWIN_TOOLCHAIN_DISPLAY_NAME: ${{ github.event.inputs.display_name }}
61+
DARWIN_TOOLCHAIN_DISPLAY_NAME_SHORT: ${{ github.event.inputs.display_name_short }}

0 commit comments

Comments
 (0)