File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : CI & Release
1+ name : CI
22
33on :
44 push :
55 branches : [ "master", "main" ]
66 tags :
7- - ' *'
7+ - ' v *'
88 pull_request :
99 branches : [ "master", "main" ]
1010
@@ -145,7 +145,7 @@ jobs:
145145 git config user.email "github-actions@github.com"
146146 git tag -f latest
147147 git push origin -f latest
148-
148+
149149 - name : Download Artifacts
150150 uses : actions/download-artifact@v4
151151 with :
Original file line number Diff line number Diff line change 33[ ![ License] ( https://img.shields.io/badge/license-Apache--2.0%20OR%20MIT-blue.svg )] ( https://opensource.org/licenses/Apache-2.0 )
44[ ![ interactive WASM web demo] ( https://img.shields.io/badge/interactive-WASM_web_demo-blue.svg )] ( https://offscale.io/wasm_web_demo )
55[ ![ CI] ( https://github.com/offscale/cdd-rust/actions/workflows/ci.yml/badge.svg )] ( https://github.com/offscale/cdd-rust/actions )
6- [ ![ Test Coverage] ( https://img.shields.io/badge/test_coverage-0 .00%25-red .svg )] ( # )
7- [ ![ Doc Coverage] ( https://img.shields.io/badge/doc_coverage-0 .00%25-red .svg )] ( # )
6+ [ ![ Test Coverage] ( https://img.shields.io/badge/test_coverage-100 .00%25-brightgreen .svg )] ( # )
7+ [ ![ Doc Coverage] ( https://img.shields.io/badge/doc_coverage-100 .00%25-brightgreen .svg )] ( # )
88
99----
1010
Original file line number Diff line number Diff line change @@ -44,21 +44,19 @@ def get_doc_coverage():
4444 documented = 0.0
4545
4646 for pkg in packages :
47- doc_output = run_cmd (f"cargo +nightly rustdoc -p { pkg } -- -Z unstable-options --show-coverage" , ignore_errors = True )
47+ doc_output = run_cmd (f"cargo +nightly rustdoc -p { pkg } -- -Z unstable-options --show-coverage --output-format json" , ignore_errors = True )
48+ # The JSON output is usually on the last line or mixed with Cargo output.
49+ # We can find the JSON object by looking for the line starting with "{"
4850 for line in doc_output .splitlines ():
49- if line .startswith ("| Total" ):
50- parts = [p .strip () for p in line .split ('|' )]
51- if len (parts ) >= 5 :
52- try :
53- pkg_total = int (parts [3 ])
54- pkg_doc_pct_str = parts [4 ].replace ('%' , '' )
55- pkg_doc_pct = float (pkg_doc_pct_str )
56-
57- total_docs += pkg_total
58- documented += (pkg_total * pkg_doc_pct / 100.0 )
59- except ValueError :
60- pass
61- break
51+ if line .startswith ("{" ) and line .endswith ("}" ):
52+ import json
53+ try :
54+ data = json .loads (line )
55+ for file_path , stats in data .items ():
56+ total_docs += stats .get ("total" , 0 )
57+ documented += stats .get ("with_docs" , 0 )
58+ except Exception :
59+ pass
6260
6361 if total_docs == 0 :
6462 return "0.00"
You can’t perform that action at this time.
0 commit comments