Skip to content

Commit 78ffdc9

Browse files
Support Amazon Linux 2 for SwiftWasm distribution (#2654)
* Support Amazon Linux 2 for SwiftWasm distribution * Setup Amazon Linux CI * Refactoring CI script * Fetch merge commit from GitHub * Rename ci yaml file * Fix e2e preparation script * Add missing swift-crypto info for checking out * Stop build toolchain for amazonlinux on CI * Update actions/checkout to v2 * Remove duplicated unzip from distribution script * Checkout with given scheme * Dispatch buildbot repo event after creating a new tag * Add branch name as workflow input * Use actions/checkout v2 * Use SWIFTWASM_BUILDBOT_TOKEN to trigger buildbot ci
1 parent 5fea52c commit 78ffdc9

File tree

8 files changed

+266
-326
lines changed

8 files changed

+266
-326
lines changed

.github/workflows/build-toolchain.yml

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

0 commit comments

Comments
 (0)