Skip to content

Commit 745675b

Browse files
committed
simplify and improve doc generation with xtask
also scrapes examples and removes pre-content
1 parent 2bd351c commit 745675b

File tree

6 files changed

+146
-171
lines changed

6 files changed

+146
-171
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,7 @@ jobs:
4646
with:
4747
toolchain: ${{ matrix.rust }}
4848
override: true
49-
- name: Ready cache
50-
if: matrix.os == 'ubuntu-latest'
51-
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
52-
- name: Cache cargo
53-
uses: actions/cache@v1
54-
id: cache
55-
with:
56-
path: |
57-
~/.cargo/registry/index
58-
~/.cargo/registry/cache
59-
~/.cargo/git
60-
target
61-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
49+
- uses: Swatinem/rust-cache@v2
6250
- name: Test twitch_oauth2
6351
uses: actions-rs/cargo@v1
6452
with:
@@ -91,16 +79,7 @@ jobs:
9179
toolchain: nightly
9280
override: true
9381
components: clippy
94-
- name: Cache cargo
95-
uses: actions/cache@v1
96-
id: cache
97-
with:
98-
path: |
99-
~/.cargo/registry/index
100-
~/.cargo/registry/cache
101-
~/.cargo/git
102-
target
103-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
82+
- uses: Swatinem/rust-cache@v2
10483
- name: Run clippy
10584
uses: actions-rs/cargo@v1
10685
with:
@@ -121,16 +100,7 @@ jobs:
121100
profile: minimal
122101
toolchain: nightly
123102
override: true
124-
- name: Cache cargo
125-
uses: actions/cache@v1
126-
id: cache
127-
with:
128-
path: |
129-
~/.cargo/registry/index
130-
~/.cargo/registry/cache
131-
~/.cargo/git
132-
target
133-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
103+
- uses: Swatinem/rust-cache@v2
134104
# We do the following to make sure docs.rs can document properly without anything broken, and that docs are working.
135105
- name: Run doc tests
136106
uses: actions-rs/cargo@v1

.github/workflows/gh-pages.yml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: github pages
22
env:
33
CI_TWITCH_OAUTH2_FEATURES: "all mock_api"
4-
RUSTDOCFLAGS: "-Z unstable-options --html-in-header=docs/pre-content.html --cfg nightly"
5-
RUSTFLAGS: "--cfg nightly"
64
on:
75
push:
86
branches:
@@ -17,29 +15,13 @@ jobs:
1715
profile: minimal
1816
toolchain: nightly
1917
override: true
20-
- name: Cache cargo
21-
uses: actions/cache@v1
22-
id: cache
23-
with:
24-
path:
25-
~/.cargo/registry/index
26-
~/.cargo/registry/cache
27-
~/.cargo/git
28-
target
29-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
30-
- name: mention 40 character commit rev in doc
31-
run: sed -i "s/{{commit}}/$(git rev-parse HEAD)/g" docs/pre-content.html
32-
- name: mention short commit rev in doc
33-
run: sed -i "s/{{commit_short}}/$(git rev-parse --short HEAD)/g" docs/pre-content.html
18+
- uses: Swatinem/rust-cache@v2
3419
- name: build twitch_oauth2 docs
35-
uses: actions-rs/cargo@v1
36-
with:
37-
command: doc
38-
args: --no-deps --features "${{ env.CI_TWITCH_OAUTH2_FEATURES }}"
20+
run: cargo xtask doc
3921
- name: move index.html
40-
run: cp ./docs/index.html ./target/doc/index.html
22+
run: cp ./docs/index.html ./target/extra/doc/index.html
4123
- name: Deploy
4224
uses: peaceiris/actions-gh-pages@v3
4325
with:
4426
github_token: ${{ secrets.GITHUB_TOKEN }}
45-
publish_dir: ./target/doc
27+
publish_dir: ./target/extra/doc

0 commit comments

Comments
 (0)