-
-
Notifications
You must be signed in to change notification settings - Fork 200
208 lines (194 loc) · 5.58 KB
/
ci.yml
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Continuous Integration
on:
pull_request:
push:
branches:
- main
- staging # for bors
- trying # for bors
schedule:
- cron: "0 0 * * 0"
permissions:
pull-requests: write
jobs:
check:
name: Check
runs-on: ubuntu-22.04
steps:
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
- name: Checkout
uses: actions/checkout@v4
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
args: --locked --verbose
- name: Check without default features
uses: actions-rs/cargo@v1
with:
command: check
args: --locked --no-default-features --verbose
typos:
name: Typos
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check typos
uses: crate-ci/typos@master
test:
name: Test suite
runs-on: ubuntu-22.04
steps:
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Checkout
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup cargo-tarpaulin
uses: taiki-e/install-action@cargo-tarpaulin
- name: Run tests
run: |
cargo test --no-default-features \
-- --skip "repo::test::git_upstream_remote"
- name: Run tests
run: |
cargo tarpaulin --out xml --verbose --all-features \
-- --skip "repo::test::git_upstream_remote"
- name: Upload reports to codecov
uses: codecov/codecov-action@v4
with:
name: code-coverage-report
file: cobertura.xml
flags: unit-tests
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
clippy:
name: Lints
runs-on: ubuntu-22.04
steps:
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: Checkout
uses: actions/checkout@v4
- name: Check the lints
uses: actions-rs/cargo@v1
with:
command: clippy
args: --tests --verbose -- -D warnings
- name: Check the pedantic lints
uses: actions-rs/cargo@v1
with:
command: clippy
args: --tests --verbose -- -W clippy::pedantic
rustfmt:
name: Formatting
runs-on: ubuntu-22.04
steps:
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Checkout
uses: actions/checkout@v4
- name: Check the formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check --verbose
lychee:
name: Links
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check the links
uses: lycheeverse/lychee-action@v1
with:
args: -v --max-concurrency 1 *.md website/docs/* website/blog/*
fail: true
token: ${{ secrets.GITHUB_TOKEN }}
msrv:
name: Check Rust version
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install cargo-msrv
run: cargo binstall -y cargo-msrv
- name: Run cargo-msrv
shell: bash
run: |
for package in "git-cliff" "git-cliff-core"; do
printf "Checking MSRV for $package..."
cargo msrv --output-format json --path "$package" verify | tail -n 1 | jq --exit-status '.success'
done
tarball:
name: Check NodeJS tarball
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
- name: Validate the files in the tarball
shell: bash
working-directory: npm/git-cliff
run: |
yarn install
yarn build
cp ../../README.md .
cp ../../CHANGELOG.md .
files_expected_in_tarball=(
"CHANGELOG.md"
"README.md"
"lib/cjs/index.cjs"
"lib/cjs/index.cjs.map"
"lib/cjs/index.d.cts"
"lib/cli/cli.js"
"lib/esm/index.d.ts"
"lib/esm/index.js"
"lib/esm/index.js.map"
"package.json"
)
tarball_output=$(yarn pack --dry-run)
for file in "${files_expected_in_tarball[@]}"; do
if [[ ! "$tarball_output" == *"$file"* ]]; then
echo "Error: Expected file '$file' not found in tarball."
exit 1
fi
done
profiler:
name: Run profiler
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run profiler
run: cargo run --profile bench --features profiler -- --no-exec
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: git-cliff.${{ github.run_id }}-profiler-report
path: git-cliff.**.flamegraph.svg