Skip to content

Commit 4e4aef4

Browse files
authored
Merge pull request #2865 from lzutao/ci
Reduce CI build time
2 parents bb5fc39 + 868cdfa commit 4e4aef4

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@ branches:
33
only:
44
- master
55

6+
cache:
7+
directories:
8+
- ~/.cargo
9+
- target
10+
before_cache:
11+
- cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache
12+
- cargo cache
13+
install:
14+
- export CARGO_TARGET_DIR=$TRAVIS_BUILD_DIR/target
15+
- cargo install mdbook
616
script:
7-
- (cargo install mdbook --vers '^0.2.0' --force || true)
817
- ./generate-book.sh
918

1019
env:

generate-book.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
set -e
44

55
if [ ! -d src ]; then
66
mkdir src
77
fi
88

9-
echo "[Introduction](introduction.md)\n" > src/SUMMARY.md
9+
printf '[Introduction](introduction.md)\n\n' > src/SUMMARY.md
1010

11-
for f in $(ls text/* | sort)
11+
find ./text ! -type d -print0 | xargs -0 -I {} ln -frs {} -t src/
12+
13+
find ./text ! -type d -name '*.md' -print0 \
14+
| sort -z \
15+
| while read -r -d '' file;
1216
do
13-
echo "- [$(basename $f ".md")]($(basename $f))" >> src/SUMMARY.md
14-
cp $f src
15-
done
17+
printf -- '- [%s](%s)\n' "$(basename "$file" ".md")" "$(basename "$file")"
18+
done >> src/SUMMARY.md
1619

17-
cp README.md src/introduction.md
20+
ln -frs README.md src/introduction.md
1821

1922
mdbook build

0 commit comments

Comments
 (0)