Skip to content

Commit 84fb6e2

Browse files
committed
Make doc ci reports & fail if there's an error
1 parent 9e5ab51 commit 84fb6e2

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/docs.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,32 @@ jobs:
2222
uses: ./.github/workflows/actions/toolchain-and-cache
2323
with:
2424
cache-version: ${{ secrets.CACHE_VERSION }}
25+
cargo-tools: clippy-sarif sarif-fmt
2526

2627
- name: Generate cargo doc
27-
run: cargo doc --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-client
28+
run: |
29+
cargo doc --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator \
30+
-p mithril-signer -p mithril-client --message-format=json \
31+
| clippy-sarif | tee rust-cargo-doc-results.sarif | sarif-fmt
32+
33+
# Update tool sarif metadata from "clippy" to "cargo-doc" (since it's set this way by clippy-sarif)
34+
contents=$(cat rust-cargo-doc-results.sarif \
35+
| jq '.runs[].tool.driver.name = "cargo-doc"' \
36+
| jq '.runs[].tool.driver.informationUri = "https://doc.rust-lang.org/cargo/commands/cargo-doc.html"' \
37+
)
38+
echo -E "${contents}" > rust-cargo-doc-results.sarif
39+
40+
# Make this step fail if any warning has been found
41+
if [[ $(cat rust-cargo-doc-results.sarif | jq '.runs[0].results') != "[]" ]]; then
42+
false
43+
fi
44+
45+
- name: Upload cargo-doc results to GitHub
46+
if: success() || failure()
47+
uses: github/codeql-action/upload-sarif@v2
48+
with:
49+
sarif_file: rust-cargo-doc-results.sarif
50+
wait-for-processing: true
2851

2952
- name: Publish Mithril-rust-doc
3053
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)