Skip to content

Commit d91af60

Browse files
jonasfjtakumma
andauthored
Dartdoc test -- full diff (#249)
* Initial dartdoc_test packages with some hacks * Update CI configuration * update dartdoc_test (#239) * add more examples and fix extracting * code splitting and print code samples and it's location. * set overlay of sample code and update dart sdk * [dartdoc_test] add extractor tests and wrap code with imports (#241) * add test * fix * add import * fix indent * move to getter * fix for ci * fix sdk version * fix * [dartdoc_test] add documentation samples analyzer (#242) * implement analyze and output samples to .dartdoc_test directory * add CRLF/LF line breaks tests * add license headers to all files * add documentation and some modified * fix extractor test and add TestContext * update to make analyzer work * translate original span from sample file span * make DartDocTestContext to singleton no longer * add example dart project * add write options to write sample code to file (for debug) * updated README. minor fixes * add new analyzer test * update example README * update README, add .gitignore for .dartdoc_test, and create add subcommand to generate test file * fix * rename DartDoc -> Dartdoc * fix extractor and add tests * fix span translation and add test * add CommandRunner and make some commands to subCommand * fix * fix analyzer and ignore warning * fix print of analyze results * create integration test * [dartdoc_test] implement good logging! (#245) * move some codes to src/ * set analyze to default command, and print usage when -h flag is set * remove extract command and fix integration_test * add logger and varbose option * add test for verbose * fix log * move log to Command * [dartdoc_test] implement Reporter (#247) * create logger class * add summary log * move command * create reporter * fix * add ansi and fix extractor to allow code blocks with no specified language * add output directory option * add extractor test * import and print relative path * fix format * apply review suggestions and update Reporter * update reporter * use stdout reporter * allow analyze command options in default command * add integration test for runDartdocTest() * update report to print relative path * fix to work test reporter in example directory * fix * [dartdoc_test] add some ways to ignore analysis (#248) * implement code sample ignoring * add comments * fix ignoring and test * update documentations * add exclude option * fix summary and make ReporterForTest use verbose flag * move models to model.dart * only run integration test on ./example * do not wrap code samples with main() when code sample includes main() * fix * rename code sample output directory * add doc comments * update ignoring to use code block tagging (dart#no-test) * add public member documentations * fix * switch default output directory to * update CHANGELOG * fix to make some class to final * remove Reporter constructor, add some comments, and some fixes * add missing doc comment * fix output code * fix for ci * fix readme --------- Co-authored-by: takumma <[email protected]>
1 parent 716e3eb commit d91af60

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2571
-65
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Issue with dartdoc_test
3+
about: Bug, feature request or question regarding 'package:dartdoc_test'
4+
title: ''
5+
labels: pkg:dartdoc_test, pending-triage
6+
assignees:
7+
---
8+
* Explain the issue,
9+
* Using bullet points!
10+
11+
```dart
12+
// Write example code here
13+
```

.github/workflows/dart.yml

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Created with package:mono_repo v6.5.5
1+
# Created with package:mono_repo v6.6.1
22
name: Dart CI
33
on:
44
push:
@@ -36,20 +36,20 @@ jobs:
3636
name: Checkout repository
3737
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
3838
- name: mono_repo self validate
39-
run: dart pub global activate mono_repo 6.5.5
39+
run: dart pub global activate mono_repo 6.6.1
4040
- name: mono_repo self validate
4141
run: dart pub global run mono_repo generate --validate
4242
job_002:
43-
name: "analyze; PKGS: acyclic_steps, canonical_json, chunked_stream, http_methods, neat_cache, neat_periodic_task, pem, retry, safe_url_check, sanitize_html, slugid, vendor; `dart analyze`"
43+
name: "analyze; PKGS: acyclic_steps, canonical_json, chunked_stream, dartdoc_test, http_methods, neat_cache, neat_periodic_task, pem, retry, safe_url_check, sanitize_html, slugid, vendor; `dart analyze`"
4444
runs-on: ubuntu-latest
4545
steps:
4646
- name: Cache Pub hosted dependencies
4747
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
4848
with:
4949
path: "~/.pub-cache/hosted"
50-
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:acyclic_steps-canonical_json-chunked_stream-http_methods-neat_cache-neat_periodic_task-pem-retry-safe_url_check-sanitize_html-slugid-vendor;commands:analyze"
50+
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:acyclic_steps-canonical_json-chunked_stream-dartdoc_test-http_methods-neat_cache-neat_periodic_task-pem-retry-safe_url_check-sanitize_html-slugid-vendor;commands:analyze"
5151
restore-keys: |
52-
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:acyclic_steps-canonical_json-chunked_stream-http_methods-neat_cache-neat_periodic_task-pem-retry-safe_url_check-sanitize_html-slugid-vendor
52+
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:acyclic_steps-canonical_json-chunked_stream-dartdoc_test-http_methods-neat_cache-neat_periodic_task-pem-retry-safe_url_check-sanitize_html-slugid-vendor
5353
os:ubuntu-latest;pub-cache-hosted;sdk:stable
5454
os:ubuntu-latest;pub-cache-hosted
5555
os:ubuntu-latest
@@ -87,6 +87,15 @@ jobs:
8787
run: dart analyze
8888
if: "always() && steps.chunked_stream_pub_upgrade.conclusion == 'success'"
8989
working-directory: chunked_stream
90+
- id: dartdoc_test_pub_upgrade
91+
name: dartdoc_test; dart pub upgrade
92+
run: dart pub upgrade
93+
if: "always() && steps.checkout.conclusion == 'success'"
94+
working-directory: dartdoc_test
95+
- name: dartdoc_test; dart analyze
96+
run: dart analyze
97+
if: "always() && steps.dartdoc_test_pub_upgrade.conclusion == 'success'"
98+
working-directory: dartdoc_test
9099
- id: http_methods_pub_upgrade
91100
name: http_methods; dart pub upgrade
92101
run: dart pub upgrade
@@ -169,16 +178,16 @@ jobs:
169178
if: "always() && steps.vendor_pub_upgrade.conclusion == 'success'"
170179
working-directory: vendor
171180
job_003:
172-
name: "analyze; PKGS: acyclic_steps, canonical_json, chunked_stream, http_methods, neat_cache, neat_periodic_task, pem, retry, safe_url_check, sanitize_html, slugid, vendor; `dart format --output=none --set-exit-if-changed .`"
181+
name: "analyze; PKGS: acyclic_steps, canonical_json, chunked_stream, dartdoc_test, http_methods, neat_cache, neat_periodic_task, pem, retry, safe_url_check, sanitize_html, slugid, vendor; `dart format --output=none --set-exit-if-changed .`"
173182
runs-on: ubuntu-latest
174183
steps:
175184
- name: Cache Pub hosted dependencies
176185
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
177186
with:
178187
path: "~/.pub-cache/hosted"
179-
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:acyclic_steps-canonical_json-chunked_stream-http_methods-neat_cache-neat_periodic_task-pem-retry-safe_url_check-sanitize_html-slugid-vendor;commands:format"
188+
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:acyclic_steps-canonical_json-chunked_stream-dartdoc_test-http_methods-neat_cache-neat_periodic_task-pem-retry-safe_url_check-sanitize_html-slugid-vendor;commands:format"
180189
restore-keys: |
181-
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:acyclic_steps-canonical_json-chunked_stream-http_methods-neat_cache-neat_periodic_task-pem-retry-safe_url_check-sanitize_html-slugid-vendor
190+
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:acyclic_steps-canonical_json-chunked_stream-dartdoc_test-http_methods-neat_cache-neat_periodic_task-pem-retry-safe_url_check-sanitize_html-slugid-vendor
182191
os:ubuntu-latest;pub-cache-hosted;sdk:stable
183192
os:ubuntu-latest;pub-cache-hosted
184193
os:ubuntu-latest
@@ -216,6 +225,15 @@ jobs:
216225
run: "dart format --output=none --set-exit-if-changed ."
217226
if: "always() && steps.chunked_stream_pub_upgrade.conclusion == 'success'"
218227
working-directory: chunked_stream
228+
- id: dartdoc_test_pub_upgrade
229+
name: dartdoc_test; dart pub upgrade
230+
run: dart pub upgrade
231+
if: "always() && steps.checkout.conclusion == 'success'"
232+
working-directory: dartdoc_test
233+
- name: "dartdoc_test; dart format --output=none --set-exit-if-changed ."
234+
run: "dart format --output=none --set-exit-if-changed ."
235+
if: "always() && steps.dartdoc_test_pub_upgrade.conclusion == 'success'"
236+
working-directory: dartdoc_test
219237
- id: http_methods_pub_upgrade
220238
name: http_methods; dart pub upgrade
221239
run: dart pub upgrade
@@ -400,6 +418,40 @@ jobs:
400418
- job_002
401419
- job_003
402420
job_007:
421+
name: "tests; PKG: dartdoc_test; `dart test`"
422+
runs-on: ubuntu-latest
423+
steps:
424+
- name: Cache Pub hosted dependencies
425+
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
426+
with:
427+
path: "~/.pub-cache/hosted"
428+
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dartdoc_test;commands:test_0"
429+
restore-keys: |
430+
os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dartdoc_test
431+
os:ubuntu-latest;pub-cache-hosted;sdk:stable
432+
os:ubuntu-latest;pub-cache-hosted
433+
os:ubuntu-latest
434+
- name: Setup Dart SDK
435+
uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
436+
with:
437+
sdk: stable
438+
- id: checkout
439+
name: Checkout repository
440+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
441+
- id: dartdoc_test_pub_upgrade
442+
name: dartdoc_test; dart pub upgrade
443+
run: dart pub upgrade
444+
if: "always() && steps.checkout.conclusion == 'success'"
445+
working-directory: dartdoc_test
446+
- name: dartdoc_test; dart test
447+
run: dart test
448+
if: "always() && steps.dartdoc_test_pub_upgrade.conclusion == 'success'"
449+
working-directory: dartdoc_test
450+
needs:
451+
- job_001
452+
- job_002
453+
- job_003
454+
job_008:
403455
name: "tests; PKG: http_methods; `dart test`"
404456
runs-on: ubuntu-latest
405457
steps:
@@ -433,7 +485,7 @@ jobs:
433485
- job_001
434486
- job_002
435487
- job_003
436-
job_008:
488+
job_009:
437489
name: "tests; PKG: neat_periodic_task; `dart test`"
438490
runs-on: ubuntu-latest
439491
steps:
@@ -467,7 +519,7 @@ jobs:
467519
- job_001
468520
- job_002
469521
- job_003
470-
job_009:
522+
job_010:
471523
name: "tests; PKG: pem; `dart test`"
472524
runs-on: ubuntu-latest
473525
steps:
@@ -501,7 +553,7 @@ jobs:
501553
- job_001
502554
- job_002
503555
- job_003
504-
job_010:
556+
job_011:
505557
name: "tests; PKG: retry; `dart test`"
506558
runs-on: ubuntu-latest
507559
steps:
@@ -535,7 +587,7 @@ jobs:
535587
- job_001
536588
- job_002
537589
- job_003
538-
job_011:
590+
job_012:
539591
name: "tests; PKG: safe_url_check; `dart test`"
540592
runs-on: ubuntu-latest
541593
steps:
@@ -569,7 +621,7 @@ jobs:
569621
- job_001
570622
- job_002
571623
- job_003
572-
job_012:
624+
job_013:
573625
name: "tests; PKG: sanitize_html; `dart test`"
574626
runs-on: ubuntu-latest
575627
steps:
@@ -603,7 +655,7 @@ jobs:
603655
- job_001
604656
- job_002
605657
- job_003
606-
job_013:
658+
job_014:
607659
name: "tests; PKG: slugid; `dart test`"
608660
runs-on: ubuntu-latest
609661
steps:
@@ -637,7 +689,7 @@ jobs:
637689
- job_001
638690
- job_002
639691
- job_003
640-
job_014:
692+
job_015:
641693
name: "tests; PKG: vendor; `dart test`"
642694
runs-on: ubuntu-latest
643695
steps:
@@ -671,7 +723,7 @@ jobs:
671723
- job_001
672724
- job_002
673725
- job_003
674-
job_015:
726+
job_016:
675727
name: "tests; PKG: neat_cache; `dart test -x redis`"
676728
runs-on: ubuntu-latest
677729
steps:

dartdoc_test/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## v0.1.0
2+
* Initial release, with code sample extraction, analysis, and some options to write or ignore analysis.

0 commit comments

Comments
 (0)