Skip to content

Commit 3d2a882

Browse files
Merge pull request #2894 from swiftwasm/swiftwasm-release/5.4-new-ci
Update CI artifact style for 5.4 branch
2 parents 6a0a814 + 1c5d76e commit 3d2a882

File tree

8 files changed

+276
-326
lines changed

8 files changed

+276
-326
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Build Toolchain
2+
3+
on:
4+
push:
5+
branches:
6+
- swiftwasm
7+
- swiftwasm-release/5.3
8+
- swiftwasm-release/5.4
9+
pull_request:
10+
branches:
11+
- swiftwasm
12+
- swiftwasm-release/5.3
13+
- swiftwasm-release/5.4
14+
jobs:
15+
build_toolchain:
16+
env:
17+
TOOLCHAIN_CHANNEL: 5.4
18+
strategy:
19+
matrix:
20+
include:
21+
- build_os: ubuntu-18.04
22+
target: ubuntu18.04_x86_64
23+
run_full_test: false
24+
run_e2e_test: true
25+
build_hello_wasm: true
26+
27+
- build_os: ubuntu-20.04
28+
target: ubuntu20.04_x86_64
29+
run_full_test: false
30+
run_e2e_test: true
31+
build_hello_wasm: true
32+
33+
- build_os: macos-10.15
34+
target: macos_x86_64
35+
run_full_test: true
36+
run_e2e_test: true
37+
build_hello_wasm: true
38+
39+
name: Target ${{ matrix.target }}
40+
timeout-minutes: 0
41+
runs-on: ${{ matrix.build_os }}
42+
steps:
43+
- name: Free disk space
44+
if: ${{ matrix.build_os == 'ubuntu-20.04' || matrix.build_os == 'ubuntu-18.04' }}
45+
run: |
46+
df -h
47+
sudo apt-get purge libgcc-9-dev gcc-9 libstdc++-9-dev clang-6.0 llvm-6.0
48+
sudo swapoff -a
49+
sudo rm -f /swapfile
50+
sudo rm -rf /opt/hostedtoolcache
51+
sudo rm -rf /usr/share/dotnet
52+
sudo apt clean
53+
docker rmi $(docker image ls -aq)
54+
df -h
55+
56+
- uses: actions/checkout@v2
57+
with:
58+
path: swift
59+
fetch-depth: 0
60+
61+
- name: Prepare sccache timestamp
62+
id: cache_timestamp
63+
shell: cmake -P {0}
64+
run: |
65+
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
66+
message("::set-output name=timestamp::${current_date}")
67+
68+
- uses: actions/cache@v1
69+
with:
70+
path: build-cache
71+
key: ${{ matrix.target }}-sccache-v10-${{ steps.cache_timestamp.outputs.timestamp }}
72+
restore-keys: |
73+
${{ matrix.target }}-sccache-v10-
74+
75+
- name: Select Xcode version
76+
if: ${{ matrix.build_os == 'macos-10.15' }}
77+
run: |
78+
sudo xcode-select --switch /Applications/Xcode_12.3.app/Contents/Developer/
79+
xcodebuild -version
80+
81+
- name: Build ${{ matrix.target }} installable archive
82+
env:
83+
SKIP_XCODE_VERSION_CHECK: 1
84+
run: |
85+
86+
case "${{ matrix.target }}" in
87+
"ubuntu20.04_x86_64" | "ubuntu18.04_x86_64" | "macos_x86_64")
88+
./swift/utils/webassembly/ci.sh
89+
;;
90+
*)
91+
echo "Unrecognised target: ${{ matrix.target }}"
92+
exit 1
93+
;;
94+
esac
95+
96+
- name: Upload ${{ matrix.target }} installable archive
97+
uses: actions/upload-artifact@v1
98+
with:
99+
name: ${{ matrix.target }}-installable
100+
path: swift-wasm-${{ env.TOOLCHAIN_CHANNEL }}-SNAPSHOT-${{ matrix.target }}.tar.gz
101+
102+
- name: Pack test results
103+
if: ${{ matrix.run_full_test }}
104+
run: |
105+
tar cJf ./swift-test-results.tar.gz target-build/swift-stdlib-wasi-wasm32/swift-test-results
106+
- name: Upload test results
107+
uses: actions/upload-artifact@v1
108+
if: ${{ matrix.run_full_test }}
109+
with:
110+
name: ${{ matrix.target }}-test-results
111+
path: ./swift-test-results.tar.gz
112+
113+
# Run e2e test
114+
- name: Prepare E2E test
115+
run: |
116+
INSTALL_DIR=$(mktemp -d)
117+
tar xf swift-wasm-$TOOLCHAIN_CHANNEL-SNAPSHOT-${{ matrix.target }}.tar.gz -C "$INSTALL_DIR"
118+
echo "TOOLCHAIN=$(find "$INSTALL_DIR" -name "swift-wasm-$TOOLCHAIN_CHANNEL-*" -type d | head -n1)" >> $GITHUB_ENV
119+
- name: Build hello.wasm
120+
shell: bash
121+
if: ${{ matrix.build_hello_wasm }}
122+
run: |
123+
echo 'print("Hello, world!")' > hello.swift
124+
$TOOLCHAIN/usr/bin/swiftc \
125+
-target wasm32-unknown-wasi \
126+
-sdk $TOOLCHAIN/usr/share/wasi-sysroot \
127+
hello.swift -o hello.wasm && \
128+
echo "Successfully linked hello.wasm"
129+
- name: Upload hello.wasm
130+
if: ${{ matrix.build_hello_wasm }}
131+
uses: actions/upload-artifact@v1
132+
with:
133+
name: ${{ matrix.target }}-hello.wasm
134+
path: hello.wasm
135+
- name: Checkout integration-tests
136+
if: ${{ matrix.run_e2e_test }}
137+
uses: actions/checkout@v2
138+
with:
139+
repository: swiftwasm/integration-tests
140+
path: integration-tests
141+
- name: Run integration tests
142+
if: ${{ matrix.run_e2e_test }}
143+
run: |
144+
swift run # Use TOOLCHAIN env value
145+
working-directory: ${{ github.workspace }}/integration-tests
146+

0 commit comments

Comments
 (0)