Skip to content

Commit f5756c0

Browse files
Merge pull request swiftlang#232 from swiftwasm/katei/reduce-ci-time
Reduce CI time
2 parents 5923bea + e900e8c commit f5756c0

File tree

5 files changed

+57
-31
lines changed

5 files changed

+57
-31
lines changed

Diff for: .github/workflows/main.yml

+17-9
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@ jobs:
1717
- uses: actions/checkout@v1
1818
with:
1919
path: swift
20+
- uses: actions/cache@v1
21+
with:
22+
path: ../build-cache
23+
key: ${{ runner.os }}-sccache-v1
2024
- name: Build Linux installable archive
21-
run: ./utils/webassembly/ci-linux.sh
25+
run: ./utils/webassembly/ci.sh
2226
- name: Upload Linux installable archive
2327
uses: actions/upload-artifact@v1
2428
with:
2529
name: linux-installable
2630
path: ../swiftwasm-linux.tar.gz
27-
- name: Pack test results
28-
run: tar cJf swift-test-results.tar.gz ../build/*/swift-linux-x86_64/swift-test-results
29-
- name: Upload test results
30-
uses: actions/upload-artifact@v1
31-
with:
32-
name: linux-test-results
33-
path: ./swift-test-results.tar.gz
31+
# - name: Pack test results
32+
# run: tar cJf swift-test-results.tar.gz ../build/*/swift-linux-x86_64/swift-test-results
33+
# - name: Upload test results
34+
# uses: actions/upload-artifact@v1
35+
# with:
36+
# name: linux-test-results
37+
# path: ./swift-test-results.tar.gz
3438

3539
macos_build:
3640
timeout-minutes: 0
@@ -40,8 +44,12 @@ jobs:
4044
- uses: actions/checkout@v1
4145
with:
4246
path: swift
47+
- uses: actions/cache@v1
48+
with:
49+
path: ../build-cache
50+
key: ${{ runner.os }}-sccache-v1
4351
- name: Build macOS installable archive
44-
run: ./utils/webassembly/ci-mac.sh
52+
run: ./utils/webassembly/ci.sh
4553
- name: Upload macOS installable archive
4654
uses: actions/upload-artifact@v1
4755
with:

Diff for: utils/webassembly/ci-linux.sh

-15
This file was deleted.

Diff for: utils/webassembly/ci.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#/bin/bash
2+
3+
set -ex
4+
5+
SOURCE_PATH="$( cd "$(dirname $0)/../../.." && pwd )"
6+
SWIFT_PATH=$SOURCE_PATH/swift
7+
UTILS_PATH=$SWIFT_PATH/utils/webassembly
8+
if [[ "$(uname)" == "Linux" ]]; then
9+
BUILD_SCRIPT=$UTILS_PATH/build-linux.sh
10+
DEPENDENCIES_SCRIPT=$UTILS_PATH/linux/install-dependencies.sh
11+
else
12+
BUILD_SCRIPT=$UTILS_PATH/build-mac.sh
13+
DEPENDENCIES_SCRIPT=$UTILS_PATH/macos/install-dependencies.sh
14+
fi
15+
16+
$DEPENDENCIES_SCRIPT
17+
18+
export SCCACHE_CACHE_SIZE="50G"
19+
export SCCACHE_DIR="$SOURCE_PATH/build-cache"
20+
21+
CACHE_FLAGS="--cmake-c-launcher $(which sccache) --cmake-cxx-launcher $(which sccache)"
22+
FLAGS="--release --debug-swift-stdlib $CACHE_FLAGS --verbose"
23+
24+
$BUILD_SCRIPT $FLAGS
25+
26+
if [[ "$(uname)" == "Linux" ]]; then
27+
echo "Skip running test suites for Linux"
28+
else
29+
# Run test but ignore failure temporarily
30+
$BUILD_SCRIPT $FLAGS -t || true
31+
fi

Diff for: utils/webassembly/linux/install-dependencies.sh

+7
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,10 @@ ln -s wasm32-wasi wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi-unknown
4646

4747
wget -O icu.tar.xz "https://github.com/swiftwasm/icu4c-wasi/releases/download/0.3.0/icu4c-wasi.tar.xz"
4848
tar xf icu.tar.xz
49+
50+
# Install sccache
51+
52+
sudo mkdir /opt/sccache && cd /opt/sccache
53+
wget -O - "https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz" | \
54+
sudo tar xz --strip-components 1
55+
sudo ln -sf /opt/sccache/sccache /usr/local/bin

Diff for: utils/webassembly/ci-mac.sh renamed to utils/webassembly/macos/install-dependencies.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
set -ex
44

55
brew uninstall python@2 || true
6-
brew install cmake ninja llvm
6+
brew install cmake ninja llvm sccache
77

8-
SOURCE_PATH="$( cd "$(dirname $0)/../../.." && pwd )"
8+
SOURCE_PATH="$( cd "$(dirname $0)/../../../../" && pwd )"
99
SWIFT_PATH=$SOURCE_PATH/swift
10-
BUILD_SCRIPT=$SWIFT_PATH/utils/webassembly/build-mac.sh
1110
cd $SWIFT_PATH
1211

1312
./utils/update-checkout --clone --scheme wasm --skip-repository swift
@@ -38,7 +37,3 @@ ln -s wasm32-wasi wasi-sdk/share/wasi-sysroot/lib/wasm32-wasi-unknown
3837

3938
wget -O icu.tar.xz "https://github.com/swiftwasm/icu4c-wasi/releases/download/0.3.0/icu4c-wasi.tar.xz"
4039
tar xf icu.tar.xz
41-
42-
$BUILD_SCRIPT --release --debug-swift-stdlib --verbose
43-
# Run test but ignore failure temporarily
44-
$BUILD_SCRIPT --release --debug-swift-stdlib --verbose -t || true

0 commit comments

Comments
 (0)