Skip to content

Commit 64c3ee2

Browse files
committed
Have Travis CI upload rustdoc-generated documentation to GitHub Pages.
1 parent 49613fd commit 64c3ee2

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
*-test
1010
Makefile
1111
/target
12+
/doc

.travis.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,18 @@ install:
88
- sudo ./cargo-nightly/install.sh
99

1010
script:
11-
- cargo build --verbose
12-
- cargo test --verbose
11+
- cargo build
12+
- cargo test
13+
- rustdoc lib.rs -L target/deps
14+
15+
after_success: |
16+
[ $TRAVIS_BRANCH = master ] &&
17+
[ $TRAVIS_PULL_REQUEST = false ] &&
18+
echo '<meta http-equiv=refresh content=0;url=cssparser/index.html>' > doc/index.html &&
19+
sudo pip install ghp-import &&
20+
ghp-import -n doc &&
21+
git push -fq https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
22+
23+
env:
24+
- secure: TDTC2q5Trv22R1pXcMyi2mWToc201aJpCJgLlnwNzkT2bjpQj+0KQvBpI1gIoeQvSL9ud85187C0tdmR7zQmZjBt6mnNCs7EM7QDIPcUcrH0vz8v/RQ+VNxhRAeCwUP4uLEHtnvbi9Q0KXCI1cQivZuMspxVMwvajx/ylcPwb4k=
25+

Makefile.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ AR ?= ar
77
RUSTC ?= rustc
88
RUSTFLAGS ?=
99
EXT_DEPS ?=
10+
RUSTDOC ?= rustdoc
11+
RUSTDOC_FLAGS ?=
12+
RUSTDOC_TARGET ?= doc
1013

1114
RUST_SRC=$(shell find $(VPATH)/. -type f -name '*.rs')
1215

@@ -28,6 +31,12 @@ check: cssparser-test
2831
check-debug: cssparser-tests
2932
echo -e "start\n break upcall_fail\n continue\n where\n continue" | gdb -q ./cssparser-tests
3033

34+
.PHONY: doc
35+
doc: $(RUSTDOC_TARGET)/cssparser/index.html
36+
37+
$(RUSTDOC_TARGET)/cssparser/index.html: lib.rs $(RUST_SRC) $(EXT_DEPS)
38+
$(RUSTDOC) $(RUSTDOC_FLAGS) $< -o $(RUSTDOC_TARGET)
39+
3140
.PHONY: clean
3241
clean:
3342
rm -f *.o *.a *.so *.dylib *.rlib *.dll *.dummy *-test

0 commit comments

Comments
 (0)