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