Skip to content

Commit c490f90

Browse files
authored
Add M1 build to build-toolchain.yml for 5.4 (#3528)
Cherry-pick of #3463 for the 5.4 release branch.
1 parent 7fbe017 commit c490f90

File tree

2 files changed

+53
-27
lines changed

2 files changed

+53
-27
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,52 @@ jobs:
1515
build_toolchain:
1616
env:
1717
TOOLCHAIN_CHANNEL: 5.4
18+
DEVELOPER_DIR: /Applications/Xcode_12.5.app/Contents/Developer/
1819
strategy:
1920
matrix:
2021
include:
2122
- build_os: ubuntu-18.04
23+
agent_query: ubuntu-18.04
2224
target: ubuntu18.04_x86_64
25+
run_stdlib_test: false
2326
run_full_test: false
2427
run_e2e_test: true
2528
build_hello_wasm: true
29+
clean_build_dir: false
2630

2731
- build_os: ubuntu-20.04
32+
agent_query: ubuntu-20.04
2833
target: ubuntu20.04_x86_64
34+
run_stdlib_test: false
2935
run_full_test: false
3036
run_e2e_test: true
3137
build_hello_wasm: true
38+
clean_build_dir: false
3239

33-
- build_os: macos-10.15
40+
- build_os: macos-11
41+
agent_query: macos-11
3442
target: macos_x86_64
43+
run_stdlib_test: true
3544
run_full_test: true
3645
run_e2e_test: true
3746
build_hello_wasm: true
47+
clean_build_dir: false
48+
49+
- build_os: macos-11
50+
agent_query: [self-hosted, macOS, ARM64]
51+
target: macos_arm64
52+
# FIXME: Enable stdlib test after wasmer fixes singlepass bug on arm64,
53+
# fixes cranelift bug on x64, or wasmtime supports arm64
54+
# Currently it's hard to run tests on both x64 and arm64.
55+
run_stdlib_test: false
56+
run_full_test: false
57+
run_e2e_test: false
58+
build_hello_wasm: true
59+
clean_build_dir: true
3860

3961
name: Target ${{ matrix.target }}
4062
timeout-minutes: 0
41-
runs-on: ${{ matrix.build_os }}
63+
runs-on: ${{ matrix.agent_query }}
4264
steps:
4365
- name: Free disk space
4466
if: ${{ matrix.build_os == 'ubuntu-20.04' || matrix.build_os == 'ubuntu-18.04' }}
@@ -65,26 +87,33 @@ jobs:
6587
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
6688
message("::set-output name=timestamp::${current_date}")
6789
90+
- name: Check Xcode version
91+
if: ${{ startsWith(matrix.build_os, 'macos-') }}
92+
run: |
93+
xcodebuild -version
94+
6895
- uses: actions/cache@v1
6996
with:
7097
path: build-cache
7198
key: ${{ matrix.target }}-sccache-v10-${{ steps.cache_timestamp.outputs.timestamp }}
7299
restore-keys: |
73100
${{ matrix.target }}-sccache-v10-
74101
75-
- name: Select Xcode version
76-
if: ${{ matrix.build_os == 'macos-10.15' }}
102+
- name: Clean stdlib build directory
103+
if: ${{ matrix.clean_build_dir }}
77104
run: |
78-
sudo xcode-select --switch /Applications/Xcode_12.3.app/Contents/Developer/
79-
xcodebuild -version
105+
rm -rf ${{ github.workspace }}/target-build \
106+
${{ github.workspace }}/host-build \
107+
${{ github.workspace }}/host-toolchain-sdk \
108+
${{ github.workspace }}/dist-toolchain-sdk
80109
81110
- name: Build ${{ matrix.target }} installable archive
82111
env:
83112
SKIP_XCODE_VERSION_CHECK: 1
84113
run: |
85114
86115
case "${{ matrix.target }}" in
87-
"ubuntu20.04_x86_64" | "ubuntu18.04_x86_64" | "macos_x86_64")
116+
"ubuntu20.04_x86_64" | "ubuntu18.04_x86_64" | "macos_x86_64" | "macos_arm64")
88117
./swift/utils/webassembly/ci.sh
89118
;;
90119
*)
@@ -99,6 +128,23 @@ jobs:
99128
name: ${{ matrix.target }}-installable
100129
path: swift-wasm-${{ env.TOOLCHAIN_CHANNEL }}-SNAPSHOT-${{ matrix.target }}.tar.gz
101130

131+
- name: Add wasmer in PATH for testing
132+
run: echo "$HOME/.wasmer/bin" >> $GITHUB_PATH
133+
134+
- name: Run stdlib tests for wasi-wasm32
135+
if: ${{ matrix.run_stdlib_test }}
136+
run: |
137+
TARGET_STDLIB_BUILD_DIR=${{ github.workspace }}/target-build/swift-stdlib-wasi-wasm32
138+
./swift/utils/run-test --build-dir "$TARGET_STDLIB_BUILD_DIR" --target wasi-wasm32 \
139+
"$TARGET_STDLIB_BUILD_DIR/test-wasi-wasm32/stdlib"
140+
141+
- name: Run all tests for wasi-wasm32
142+
if: ${{ matrix.run_full_test }}
143+
run: |
144+
TARGET_STDLIB_BUILD_DIR=${{ github.workspace }}/target-build/swift-stdlib-wasi-wasm32
145+
# Run all tests but ignore failure temporarily
146+
ninja check-swift-wasi-wasm32 -C "$TARGET_STDLIB_BUILD_DIR" || true
147+
102148
- name: Pack test results
103149
if: ${{ matrix.run_full_test }}
104150
run: |
@@ -143,4 +189,3 @@ jobs:
143189
run: |
144190
swift run # Use TOOLCHAIN env value
145191
working-directory: ${{ github.workspace }}/integration-tests
146-

utils/webassembly/ci.sh

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,10 @@ TARGET_STDLIB_BUILD_DIR=$SOURCE_PATH/target-build/swift-stdlib-wasi-wasm32
2828
$DEPENDENCIES_SCRIPT
2929
$UTILS_PATH/install-build-sdk.sh
3030

31-
export PATH="$HOME/.wasmer/bin:$PATH"
32-
3331
export SCCACHE_CACHE_SIZE="50G"
3432
export SCCACHE_DIR="$SOURCE_PATH/build-cache"
3533

3634
$BUILD_SCRIPT
3735

38-
echo "Build script completed, will attempt to run test suites..."
39-
4036
# workaround: host target test directory is necessary to use run-test
4137
mkdir -p "$TARGET_STDLIB_BUILD_DIR/test-$HOST_SUFFIX"
42-
43-
# Run tests
44-
$RUN_TEST_BIN --build-dir "$TARGET_STDLIB_BUILD_DIR" --target wasi-wasm32 \
45-
"$TARGET_STDLIB_BUILD_DIR/test-wasi-wasm32/stdlib"
46-
$RUN_TEST_BIN --build-dir "$TARGET_STDLIB_BUILD_DIR" --target wasi-wasm32 \
47-
"$TARGET_STDLIB_BUILD_DIR/test-wasi-wasm32/LTO"
48-
49-
if [[ "$(uname)" == "Linux" ]]; then
50-
echo "Skip running all test suites for Linux"
51-
else
52-
# Run all tests but ignore failure temporarily
53-
ninja check-swift-wasi-wasm32 -C "$TARGET_STDLIB_BUILD_DIR" || true
54-
fi
55-
56-
echo "The test suite has finished"

0 commit comments

Comments
 (0)