Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ocaml-compiler: ["4.14.x", "5.3.x"]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up OCaml
uses: avsm/setup-ocaml@v1
uses: ocaml/setup-ocaml@v3
with:
# Version of the OCaml compiler to initialise
ocaml-version: 4.11.1
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: install dependencies
- name: Install dependencies
run: opam install . --deps-only --with-doc --with-test

- name: build
run: |
opam exec -- dune build @install @JS @main
- name: Build
run: opam exec -- dune build @install @JS @main

- name: runtest
- name: Test
run: opam exec -- dune runtest

39 changes: 21 additions & 18 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,32 @@ on:
branches: [ master ]

jobs:
build:
format:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Set up OCaml
uses: avsm/setup-ocaml@v1
uses: ocaml/setup-ocaml@v3
with:
# Version of the OCaml compiler to initialise
ocaml-version: 4.11.1

- name: install dependencies
run: opam install ocamlformat.0.16.0 dune
ocaml-compiler: 4.14.x

- name: Install formatter
run: opam install ocamlformat.0.26.2 dune

- name: format
- name: Check formatting
run: |
opam exec -- dune build @fmt --auto-promote || true

- name: commit
uses: stefanzweifel/git-auto-commit-action@v4.11.0
with:
commit_message: Apply formatting changes
branch: ${{ github.head_ref }}
mapfile -t files < <(git diff --name-only --diff-filter=ACMRT \
"origin/${{ github.base_ref }}...HEAD" -- '*.ml' '*.mli')
status=0
for file in "${files[@]}"; do
formatted="$(mktemp)"
opam exec -- ocamlformat "$file" > "$formatted"
if ! diff --unified "$file" "$formatted"; then
status=1
fi
rm "$formatted"
done
exit "$status"
1 change: 1 addition & 0 deletions js/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
(modes js)
(preprocess
(pps js_of_ocaml-ppx))
(flags :standard -open Mldoc__)
(js_of_ocaml (flags --target-env browser))
(libraries angstrom js_of_ocaml mldoc))

Expand Down
2 changes: 1 addition & 1 deletion lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
uri
str
xmlm)
(wrapped false))
(wrapped true))
2 changes: 2 additions & 0 deletions lib/mldoc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
module Document = Document
module Block = Type_parser.Block
module Inline = Inline
module Nested_link = Nested_link
module Pos = Pos
module Exporters = Exporter.Exporters
module Conf = Conf
module Exporter = Exporter
Expand Down
2 changes: 1 addition & 1 deletion mldoc.opam
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ build: [
]
pin-depends: [
[ "angstrom.dev" "git+https://github.com/logseq/angstrom#fork" ]
[ "xmlm.dev" "git+https://github.com/logseq/xmlm#fork" ]
[ "xmlm.dev" "git+https://github.com/logseq/xmlm#eb469d536e98c98f2754c0ff8813c92b3a17fe9f" ]
]
4 changes: 4 additions & 0 deletions test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@
(run %{zip})
(run %{export-md})
(run %{export-opml}))))
(env
(_
(flags
(:standard -open Mldoc__))))
20 changes: 12 additions & 8 deletions test/gen_md_files.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let page_names n =
let pagename i =
let+ pagename_l =
list_size (1 -- 10)
@@ frequency
@@ oneof_weighted
[ (1, string_size ~gen:(oneofl char_table) (0 -- 5))
; (1, oneofl unicode_table)
]
Expand All @@ -44,7 +44,7 @@ let plain_inline_g =
string_size ~gen:(char_range 'A' 'Z') (1 -- 100) >|= fun s -> Inline.Plain s

let inline_g pagenames =
frequency [ (10, plain_inline_g); (1, page_ref_g pagenames) ]
oneof_weighted [ (10, plain_inline_g); (1, page_ref_g pagenames) ]

let inlines_g pagenames = list_size (1 -- 10) (inline_g pagenames)

Expand All @@ -54,15 +54,19 @@ let level_candidates max =

let heading ?(init = false) pagenames state =
let marker_g =
frequencyl
[ (1, Some "TODO"); (1, Some "DOING"); (1, Some "DONE"); (7, None) ]
oneof_weighted
[ (1, return (Some "TODO"))
; (1, return (Some "DOING"))
; (1, return (Some "DONE"))
; (7, return None)
]
in
let level_g =
oneofl
(if init then
[ 1 ]
else
level_candidates (state.last_level + 4))
[ 1 ]
else
level_candidates (state.last_level + 4))
in
inlines_g pagenames >>= fun inlines ->
marker_g >>= fun marker ->
Expand Down Expand Up @@ -90,7 +94,7 @@ let blocks_g pagenames : Type.blocks t =
let* init_heading = heading ~init:true pagenames state in
let init_heading_with_pos = (init_heading, dummy_pos) in
let block_with_pos_g =
frequency [ (3, paragragh pagenames); (1, heading pagenames state) ]
oneof_weighted [ (3, paragragh pagenames); (1, heading pagenames state) ]
>|= fun b -> (b, dummy_pos)
in
let* blocks' = list_size (10 -- 500) block_with_pos_g in
Expand Down
2 changes: 1 addition & 1 deletion test/test_zip.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let g =
match n with
| 0 -> map leaf nat
| n ->
frequency
oneof_weighted
[ ( 5
, branch
<$> ( 0 -- (n / 2) >>= fun n' ->
Expand Down
Loading