1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: CI
on:
push:
branches:
pull_request:
branches:
jobs:
# ────────────────────────────────────────────────────────────────────────────
# Format — checks that code conforms to rustfmt
# ────────────────────────────────────────────────────────────────────────────
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev pkg-config
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: cargo fmt --check
run: cargo fmt --check
# ────────────────────────────────────────────────────────────────────────────
# Clippy — zero warnings allowed
# ────────────────────────────────────────────────────────────────────────────
clippy:
name: Clippy
runs-on: ubuntu-latest
needs: fmt
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev pkg-config
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target/
key: ${{ runner.os }}-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-clippy-
- name: cargo clippy — default features
run: cargo clippy -- -D warnings
# v0.3.0+ — activate when optional features are declared in Cargo.toml
# - name: cargo clippy — feature async
# run: cargo clippy --features async -- -D warnings
# ────────────────────────────────────────────────────────────────────────────
# Test — unit, integration and doc-test suite
# ────────────────────────────────────────────────────────────────────────────
test:
name: Test
runs-on: ubuntu-latest
needs: fmt
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev pkg-config
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target/
key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-test-
- name: cargo test — default features
run: cargo test
- name: cargo test — doc examples
run: cargo test --doc
# v0.5.0+ — activate when async feature flag is declared in Cargo.toml
# - name: cargo test — feature async
# run: cargo test --features async
# ────────────────────────────────────────────────────────────────────────────
# Doc — generation and deployment to GitHub Pages
# Triggered on push to master only
# ────────────────────────────────────────────────────────────────────────────
doc:
name: Documentation
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
needs:
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev pkg-config
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target/
key: ${{ runner.os }}-doc-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-doc-
- name: cargo doc
run: cargo doc --no-deps --document-private-items
- name: Add root redirect to dynamic_cli/index.html
run: |
echo '<meta http-equiv="refresh" content="0; url=chrom_rs/index.html">' \
> target/doc/index.html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
enable_jekyll: false