Skip to content

Commit 8cfaaef

Browse files
Add M1 build agent to build-toolchain.yml (#3463)
* Add M1 build agent to `build-toolchain.yml` * Install cmake * Install homebrew * List homebrew * Modify PATH * Don't attempt to select Xcode on M1 * Set Xcode path via `DEVELOPER_DIR` * Avoid setting `brew` path * install cmake * Update build-toolchain.yml * Clean build directory to avoid module and compiler version mismatch * Control whether to run tests or not on ci script Co-authored-by: Yuta Saito <[email protected]>
1 parent dd12fec commit 8cfaaef

File tree

2 files changed

+53
-25
lines changed

2 files changed

+53
-25
lines changed

.github/workflows/build-toolchain.yml

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,52 @@ jobs:
1717
build_toolchain:
1818
env:
1919
TOOLCHAIN_CHANNEL: DEVELOPMENT
20+
DEVELOPER_DIR: /Applications/Xcode_12.5.app/Contents/Developer/
2021
strategy:
2122
matrix:
2223
include:
2324
- build_os: ubuntu-18.04
25+
agent_query: ubuntu-18.04
2426
target: ubuntu18.04_x86_64
27+
run_stdlib_test: false
2528
run_full_test: false
2629
run_e2e_test: true
2730
build_hello_wasm: true
31+
clean_build_dir: false
2832

2933
- build_os: ubuntu-20.04
34+
agent_query: ubuntu-20.04
3035
target: ubuntu20.04_x86_64
36+
run_stdlib_test: false
3137
run_full_test: false
3238
run_e2e_test: true
3339
build_hello_wasm: true
40+
clean_build_dir: false
3441

35-
- build_os: macos-10.15
42+
- build_os: macos-11
43+
agent_query: macos-11
3644
target: macos_x86_64
45+
run_stdlib_test: true
3746
run_full_test: true
3847
run_e2e_test: true
3948
build_hello_wasm: true
49+
clean_build_dir: false
50+
51+
- build_os: macos-11
52+
agent_query: [self-hosted, macOS, ARM64]
53+
target: macos_arm64
54+
# FIXME: Enable stdlib test after wasmer fixes singlepass bug on arm64,
55+
# fixes cranelift bug on x64, or wasmtime supports arm64
56+
# Currently it's hard to run tests on both x64 and arm64.
57+
run_stdlib_test: false
58+
run_full_test: false
59+
run_e2e_test: false
60+
build_hello_wasm: true
61+
clean_build_dir: true
4062

4163
name: Target ${{ matrix.target }}
4264
timeout-minutes: 0
43-
runs-on: ${{ matrix.build_os }}
65+
runs-on: ${{ matrix.agent_query }}
4466
steps:
4567
# TODO(katei): Remove this step after https://bugs.swift.org/browse/SR-15135 will be resolved
4668
- name: (Workaround) Uninstall pre-installed Swift toolchain on Linux
@@ -75,26 +97,33 @@ jobs:
7597
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
7698
message("::set-output name=timestamp::${current_date}")
7799
100+
- name: Check Xcode version
101+
if: ${{ startsWith(matrix.build_os, 'macos-') }}
102+
run: |
103+
xcodebuild -version
104+
78105
- uses: actions/cache@v1
79106
with:
80107
path: build-cache
81108
key: ${{ matrix.target }}-sccache-v11-${{ steps.cache_timestamp.outputs.timestamp }}
82109
restore-keys: |
83110
${{ matrix.target }}-sccache-v11-
84111
85-
- name: Select Xcode version
86-
if: ${{ matrix.build_os == 'macos-10.15' }}
112+
- name: Clean stdlib build directory
113+
if: ${{ matrix.clean_build_dir }}
87114
run: |
88-
sudo xcode-select --switch /Applications/Xcode_12.3.app/Contents/Developer/
89-
xcodebuild -version
115+
rm -rf ${{ github.workspace }}/target-build \
116+
${{ github.workspace }}/host-build \
117+
${{ github.workspace }}/host-toolchain-sdk \
118+
${{ github.workspace }}/dist-toolchain-sdk
90119
91120
- name: Build ${{ matrix.target }} installable archive
92121
env:
93122
SKIP_XCODE_VERSION_CHECK: 1
94123
run: |
95124
96125
case "${{ matrix.target }}" in
97-
"ubuntu20.04_x86_64" | "ubuntu18.04_x86_64" | "macos_x86_64")
126+
"ubuntu20.04_x86_64" | "ubuntu18.04_x86_64" | "macos_x86_64" | "macos_arm64")
98127
./swift/utils/webassembly/ci.sh
99128
;;
100129
*)
@@ -112,6 +141,23 @@ jobs:
112141
name: ${{ matrix.target }}-installable
113142
path: swift-wasm-${{ env.TOOLCHAIN_CHANNEL }}-SNAPSHOT-${{ matrix.target }}.tar.gz
114143

144+
- name: Add wasmer in PATH for testing
145+
run: echo "$HOME/.wasmer/bin" >> $GITHUB_PATH
146+
147+
- name: Run stdlib tests for wasi-wasm32
148+
if: ${{ matrix.run_stdlib_test }}
149+
run: |
150+
TARGET_STDLIB_BUILD_DIR=${{ github.workspace }}/target-build/swift-stdlib-wasi-wasm32
151+
./swift/utils/run-test --build-dir "$TARGET_STDLIB_BUILD_DIR" --target wasi-wasm32 \
152+
"$TARGET_STDLIB_BUILD_DIR/test-wasi-wasm32/stdlib"
153+
154+
- name: Run all tests for wasi-wasm32
155+
if: ${{ matrix.run_full_test }}
156+
run: |
157+
TARGET_STDLIB_BUILD_DIR=${{ github.workspace }}/target-build/swift-stdlib-wasi-wasm32
158+
# Run all tests but ignore failure temporarily
159+
ninja check-swift-wasi-wasm32 -C "$TARGET_STDLIB_BUILD_DIR" || true
160+
115161
- name: Pack test results
116162
if: ${{ matrix.run_full_test }}
117163
run: |
@@ -156,4 +202,3 @@ jobs:
156202
run: |
157203
$TOOLCHAIN/usr/bin/swift run # Use TOOLCHAIN env value
158204
working-directory: ${{ github.workspace }}/integration-tests
159-

utils/webassembly/ci.sh

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +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-
47-
if [[ "$(uname)" == "Linux" ]]; then
48-
echo "Skip running all test suites for Linux"
49-
else
50-
# Run all tests but ignore failure temporarily
51-
ninja check-swift-wasi-wasm32 -C "$TARGET_STDLIB_BUILD_DIR" || true
52-
fi
53-
54-
echo "The test suite has finished"

0 commit comments

Comments
 (0)