|
9 | 9 | branches:
|
10 | 10 | - swiftwasm
|
11 | 11 | - swiftwasm-release/5.3
|
12 |
| - |
13 | 12 | jobs:
|
14 |
| - ubuntu1804_build: |
15 |
| - timeout-minutes: 0 |
16 |
| - runs-on: ubuntu-18.04 |
| 13 | + build_toolchain: |
| 14 | + env: |
| 15 | + TOOLCHAIN_CHANNEL: DEVELOPMENT |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - build_os: ubuntu-18.04 |
| 20 | + target: ubuntu18.04_x86_64 |
| 21 | + run_full_test: false |
| 22 | + run_e2e_test: true |
| 23 | + build_hello_wasm: true |
17 | 24 |
|
18 |
| - steps: |
19 |
| - - name: Free disk space |
20 |
| - run: | |
21 |
| - df -h |
22 |
| - sudo apt-get purge libgcc-9-dev gcc-9 libstdc++-9-dev clang-6.0 llvm-6.0 |
23 |
| - sudo swapoff -a |
24 |
| - sudo rm -f /swapfile |
25 |
| - sudo rm -rf /opt/hostedtoolcache |
26 |
| - sudo rm -rf /usr/share/dotnet |
27 |
| - sudo apt clean |
28 |
| - docker rmi $(docker image ls -aq) |
29 |
| - df -h |
30 |
| - - uses: actions/checkout@v1 |
31 |
| - with: |
32 |
| - 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 |
| 25 | + - build_os: ubuntu-20.04 |
| 26 | + target: ubuntu20.04_x86_64 |
| 27 | + run_full_test: false |
| 28 | + run_e2e_test: true |
| 29 | + build_hello_wasm: true |
60 | 30 |
|
61 |
| - ubuntu2004_build: |
62 |
| - timeout-minutes: 0 |
63 |
| - runs-on: ubuntu-20.04 |
| 31 | + - build_os: ubuntu-20.04 |
| 32 | + target: amazonlinux2_x86_64 |
| 33 | + run_full_test: false |
| 34 | + run_e2e_test: false |
| 35 | + build_hello_wasm: false |
64 | 36 |
|
| 37 | + - build_os: macos-10.15 |
| 38 | + target: macos_x86_64 |
| 39 | + run_full_test: true |
| 40 | + run_e2e_test: true |
| 41 | + build_hello_wasm: true |
| 42 | + |
| 43 | + name: Target ${{ matrix.target }} |
| 44 | + timeout-minutes: 0 |
| 45 | + runs-on: ${{ matrix.build_os }} |
65 | 46 | steps:
|
66 | 47 | - name: Free disk space
|
| 48 | + if: ${{ matrix.build_os == 'ubuntu-20.04' || matrix.build_os == 'ubuntu-18.04' }} |
67 | 49 | run: |
|
68 | 50 | df -h
|
| 51 | + sudo apt-get purge libgcc-9-dev gcc-9 libstdc++-9-dev clang-6.0 llvm-6.0 |
69 | 52 | sudo swapoff -a
|
70 | 53 | sudo rm -f /swapfile
|
71 | 54 | sudo rm -rf /opt/hostedtoolcache
|
72 | 55 | sudo rm -rf /usr/share/dotnet
|
73 | 56 | sudo apt clean
|
74 | 57 | docker rmi $(docker image ls -aq)
|
75 | 58 | 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}") |
85 |
| - - uses: actions/cache@v1 |
86 |
| - with: |
87 |
| - path: ../build-cache |
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 |
92 |
| - run: | |
93 |
| - ./utils/webassembly/ci.sh |
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_x86_64.tar.gz |
99 |
| -# - name: Pack test results |
100 |
| -# run: tar cJf swift-test-results.tar.gz ../build/*/swift-linux-x86_64/swift-test-results |
101 |
| -# - name: Upload test results |
102 |
| -# uses: actions/upload-artifact@v1 |
103 |
| -# with: |
104 |
| -# name: linux-test-results |
105 |
| -# path: ./swift-test-results.tar.gz |
106 |
| - |
107 |
| - macos_build: |
108 |
| - timeout-minutes: 0 |
109 |
| - runs-on: macos-10.15 |
110 | 59 |
|
111 |
| - steps: |
112 | 60 | - uses: actions/checkout@v1
|
113 | 61 | with:
|
114 | 62 | path: swift
|
| 63 | + |
115 | 64 | - name: Prepare sccache timestamp
|
116 | 65 | id: cache_timestamp
|
117 | 66 | shell: cmake -P {0}
|
118 | 67 | run: |
|
119 | 68 | string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
|
120 | 69 | message("::set-output name=timestamp::${current_date}")
|
| 70 | +
|
121 | 71 | - uses: actions/cache@v1
|
122 | 72 | with:
|
123 | 73 | path: ../build-cache
|
124 |
| - key: ${{ runner.os }}-sccache-v10-${{ steps.cache_timestamp.outputs.timestamp }} |
| 74 | + key: ${{ matrix.target }}-sccache-v10-${{ steps.cache_timestamp.outputs.timestamp }} |
125 | 75 | restore-keys: |
|
126 |
| - ${{ runner.os }}-sccache-v10- |
127 |
| - - name: Build macOS installable archive |
| 76 | + ${{ matrix.target }}-sccache-v10- |
| 77 | +
|
| 78 | + - name: Select Xcode version |
| 79 | + if: ${{ matrix.build_os == 'macos-10.15' }} |
128 | 80 | run: |
|
129 | 81 | sudo xcode-select --switch /Applications/Xcode_12.3.app/Contents/Developer/
|
130 | 82 | xcodebuild -version
|
131 |
| - ./utils/webassembly/ci.sh |
| 83 | +
|
| 84 | + - name: Build ${{ matrix.target }} installable archive |
132 | 85 | env:
|
133 |
| - SKIP_XCODE_VERSION_CHECK: 1 # Skip upstream update the compatible Xcode version |
134 |
| - - name: Upload macOS installable archive |
| 86 | + SKIP_XCODE_VERSION_CHECK: 1 |
| 87 | + run: | |
| 88 | +
|
| 89 | + case "${{ matrix.target }}" in |
| 90 | + "ubuntu20.04_x86_64" | "ubuntu18.04_x86_64" | "macos_x86_64") |
| 91 | + ./utils/webassembly/ci.sh |
| 92 | + ;; |
| 93 | + "amazonlinux2_x86_64") |
| 94 | + SWIFT_IMAGE=swiftwasm-amazonlinux2_x86_64:nightly-$GITHUB_SHA |
| 95 | + docker build --build-arg SWIFT_GIT_SHA=$GITHUB_SHA \ |
| 96 | + --tag $SWIFT_IMAGE ./utils/webassembly/amazonlinux |
| 97 | + docker run -v $GITHUB_WORKSPACE/../:/home/host-dir $SWIFT_IMAGE \ |
| 98 | + cp -r /home/ec2-user/swift-wasm-$TOOLCHAIN_CHANNEL-SNAPSHOT-amazonlinux2_x86_64.tar.gz /home/host-dir |
| 99 | + ;; |
| 100 | + *) |
| 101 | + echo "Unrecognised target: ${{ matrix.target }}" |
| 102 | + exit 1 |
| 103 | + ;; |
| 104 | + esac |
| 105 | +
|
| 106 | + - name: Upload ${{ matrix.target }} installable archive |
135 | 107 | uses: actions/upload-artifact@v1
|
136 | 108 | with:
|
137 |
| - name: macos-installable |
138 |
| - path: ../swift-wasm-DEVELOPMENT-SNAPSHOT-macos_x86_64.tar.gz |
| 109 | + name: ${{ matrix.target }}-installable |
| 110 | + path: ../swift-wasm-${{ env.TOOLCHAIN_CHANNEL }}-SNAPSHOT-${{ matrix.target }}.tar.gz |
| 111 | + |
139 | 112 | - name: Pack test results
|
| 113 | + if: ${{ matrix.run_full_test }} |
140 | 114 | working-directory: ${{ github.workspace }}/../
|
141 | 115 | run: |
|
142 | 116 | tar cJf ./swift/swift-test-results.tar.gz target-build/swift-stdlib-wasi-wasm32/swift-test-results
|
143 | 117 | - name: Upload test results
|
144 | 118 | uses: actions/upload-artifact@v1
|
| 119 | + if: ${{ matrix.run_full_test }} |
145 | 120 | with:
|
146 |
| - name: macos-test-results |
| 121 | + name: ${{ matrix.target }}-test-results |
147 | 122 | path: ./swift-test-results.tar.gz
|
148 | 123 |
|
149 |
| - macos_smoke_test: |
150 |
| - name: Run smoke tests on macOS |
151 |
| - runs-on: macos-10.15 |
152 |
| - needs: macos_build |
153 |
| - steps: |
154 |
| - - name: Download installable macOS archive |
155 |
| - uses: actions/download-artifact@v1 |
156 |
| - with: |
157 |
| - name: macos-installable |
158 |
| - - name: Unpack toolchain |
| 124 | + # Run e2e test |
| 125 | + - name: Run E2E test |
| 126 | + working-directory: ${{ github.workspace }}/../ |
159 | 127 | run: |
|
160 |
| - set -x |
161 |
| - tar xf $(find . -name "swift-wasm-*.tar.gz" -type f) |
162 |
| - echo "TOOLCHAIN=$(find "$PWD" -name "swift-wasm-*" -type d)" >> $GITHUB_ENV |
| 128 | + tar xf swift-wasm-$TOOLCHAIN_CHANNEL-SNAPSHOT-${{ matrix.target }}.tar.gz |
| 129 | + echo "TOOLCHAIN=$(find "$PWD" -name "swift-wasm-$TOOLCHAIN_CHANNEL-*" -type d)" >> $GITHUB_ENV |
163 | 130 | - name: Build hello.wasm
|
164 | 131 | shell: bash
|
| 132 | + if: ${{ matrix.build_hello_wasm }} |
165 | 133 | run: |
|
166 | 134 | echo 'print("Hello, world!")' > hello.swift
|
167 | 135 | $TOOLCHAIN/usr/bin/swiftc \
|
168 | 136 | -target wasm32-unknown-wasi \
|
169 | 137 | -sdk $TOOLCHAIN/usr/share/wasi-sysroot \
|
170 | 138 | hello.swift -o hello.wasm && \
|
171 | 139 | echo "Successfully linked hello.wasm"
|
172 |
| - - name: Test SwiftPM |
173 |
| - shell: bash |
174 |
| - run: | |
175 |
| - set -x |
176 |
| - mkdir test |
177 |
| - cd test |
178 |
| - $TOOLCHAIN/usr/bin/swift package init |
179 |
| - $TOOLCHAIN/usr/bin/swift build --triple wasm32-unknown-wasi |
180 |
| - - name: Upload hello.wasm compiled with macOS package |
| 140 | + - name: Upload hello.wasm |
| 141 | + if: ${{ matrix.build_hello_wasm }} |
181 | 142 | uses: actions/upload-artifact@v1
|
182 | 143 | with:
|
183 |
| - name: macos-hello.wasm |
| 144 | + name: ${{ matrix.target }}-hello.wasm |
184 | 145 | path: hello.wasm
|
185 | 146 | - name: Checkout integration-tests
|
| 147 | + if: ${{ matrix.run_e2e_test }} |
186 | 148 | uses: actions/checkout@v2
|
187 | 149 | with:
|
188 | 150 | repository: swiftwasm/integration-tests
|
189 | 151 | path: integration-tests
|
190 | 152 | - name: Run integration tests
|
| 153 | + if: ${{ matrix.run_e2e_test }} |
191 | 154 | run: |
|
192 |
| - sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer/ |
193 | 155 | swift run # Use TOOLCHAIN env value
|
194 | 156 | working-directory: ${{ github.workspace }}/integration-tests
|
195 | 157 |
|
196 |
| - ubuntu1804_smoke_test: |
197 |
| - name: Run smoke tests on Ubuntu 18.04 |
198 |
| - runs-on: ubuntu-18.04 |
199 |
| - needs: ubuntu1804_build |
200 |
| - steps: |
201 |
| - - name: Download installable Ubuntu 18.04 archive |
202 |
| - uses: actions/download-artifact@v1 |
203 |
| - with: |
204 |
| - name: ubuntu18.04-installable |
205 |
| - - name: Unpack toolchain |
206 |
| - run: | |
207 |
| - set -x |
208 |
| - tar xf $(find . -name "swift-wasm-*.tar.gz" -type f) |
209 |
| - echo "TOOLCHAIN=$(find "$PWD" -name "swift-wasm-*" -type d)" >> $GITHUB_ENV |
210 |
| - - name: Build hello.wasm |
211 |
| - shell: bash |
212 |
| - run: | |
213 |
| - echo 'print("Hello, world!")' > hello.swift |
214 |
| - $TOOLCHAIN/usr/bin/swiftc \ |
215 |
| - -target wasm32-unknown-wasi \ |
216 |
| - -sdk $TOOLCHAIN/usr/share/wasi-sysroot \ |
217 |
| - hello.swift -o hello.wasm && \ |
218 |
| - echo "Successfully linked hello.wasm" |
219 |
| - - name: Test SwiftPM |
220 |
| - shell: bash |
221 |
| - run: | |
222 |
| - set -x |
223 |
| - mkdir test |
224 |
| - cd test |
225 |
| - $TOOLCHAIN/usr/bin/swift package init |
226 |
| - $TOOLCHAIN/usr/bin/swift build --triple wasm32-unknown-wasi |
227 |
| - - name: Upload hello.wasm compiled with Ubuntu 18.04 package |
228 |
| - uses: actions/upload-artifact@v1 |
229 |
| - with: |
230 |
| - name: ubuntu18.04-hello.wasm |
231 |
| - path: hello.wasm |
232 |
| - - name: Checkout integration-tests |
233 |
| - uses: actions/checkout@v2 |
234 |
| - with: |
235 |
| - repository: swiftwasm/integration-tests |
236 |
| - path: integration-tests |
237 |
| - - name: Run integration tests |
238 |
| - run: swift run # Use TOOLCHAIN env value |
239 |
| - working-directory: ${{ github.workspace }}/integration-tests |
240 |
| - |
241 |
| - ubuntu2004_smoke_test: |
242 |
| - name: Run smoke tests on Ubuntu 20.04 |
243 |
| - runs-on: ubuntu-20.04 |
244 |
| - needs: ubuntu2004_build |
245 |
| - steps: |
246 |
| - - name: Download installable Ubuntu 20.04 archive |
247 |
| - uses: actions/download-artifact@v1 |
248 |
| - with: |
249 |
| - name: ubuntu20.04-installable |
250 |
| - - name: Unpack toolchain |
251 |
| - run: | |
252 |
| - set -x |
253 |
| - tar xf $(find . -name "swift-wasm-*.tar.gz" -type f) |
254 |
| - echo "TOOLCHAIN=$(find "$PWD" -name "swift-wasm-*" -type d)" >> $GITHUB_ENV |
255 |
| - - name: Build hello.wasm |
256 |
| - shell: bash |
257 |
| - run: | |
258 |
| - echo 'print("Hello, world!")' > hello.swift |
259 |
| - $TOOLCHAIN/usr/bin/swiftc \ |
260 |
| - -target wasm32-unknown-wasi \ |
261 |
| - -sdk $TOOLCHAIN/usr/share/wasi-sysroot \ |
262 |
| - hello.swift -o hello.wasm && \ |
263 |
| - echo "Successfully linked hello.wasm" |
264 |
| - - name: Test SwiftPM |
265 |
| - shell: bash |
266 |
| - run: | |
267 |
| - set -x |
268 |
| - mkdir test |
269 |
| - cd test |
270 |
| - $TOOLCHAIN/usr/bin/swift package init |
271 |
| - $TOOLCHAIN/usr/bin/swift build --triple wasm32-unknown-wasi |
272 |
| - - name: Upload hello.wasm compiled with Ubuntu 20.04 package |
273 |
| - uses: actions/upload-artifact@v1 |
274 |
| - with: |
275 |
| - name: ubuntu20.04-hello.wasm |
276 |
| - path: hello.wasm |
277 |
| - - name: Checkout integration-tests |
278 |
| - uses: actions/checkout@v2 |
279 |
| - with: |
280 |
| - repository: swiftwasm/integration-tests |
281 |
| - path: integration-tests |
282 |
| - - name: Run integration tests |
283 |
| - run: swift run # Use TOOLCHAIN env value |
284 |
| - working-directory: ${{ github.workspace }}/integration-tests |
0 commit comments