Browse Source

new build manifest, format

master
zapashcanon 1 year ago
parent
commit
034f132973
Signed by: zapashcanon GPG Key ID: 8981C3C62D1D28F1
6 changed files with 58 additions and 23 deletions
  1. +39
    -2
      .build.yml
  2. +1
    -1
      dune-project
  3. +5
    -9
      examples/print_code.ml
  4. +2
    -0
      src/dune
  5. +5
    -6
      src/exit.ml
  6. +6
    -5
      test/test.ml

+ 39
- 2
.build.yml View File

@ -4,13 +4,50 @@ packages:
- ocaml
sources:
- https://git.zapashcanon.fr/zapashcanon/exit
environment:
name: exit
deploy: fs@zapashcanon.fr
sshopts: "-o StrictHostKeyChecking=no -q"
coverage_dst: /var/www/coverage.zapashcanon.fr
doc_dst: /var/www/doc.zapashcanon.fr
archive_dst: /var/www/fs.zapashcanon.fr/archive
secrets:
- ec1f49cd-38dc-41d9-89f4-c3b6ecd7bcad # ssh deploy key
tasks:
- setup: |
opam init -y
opam update -y
opam install -y dune
opam install -y dune bisect_ppx odoc ocamlformat
- lint-format: |
cd $name
eval "$(opam env)"
ocamlformat -p ocamlformat --enable-outside-detected-project --check $(find . -name '*.ml')
- build: |
cd $name
eval "$(opam env)"
cd exit
dune build @all
- test: |
cd $name
eval "$(opam env)"
dune runtest
- deploy-doc: |
cd $name
eval "$(opam env)"
dune build @doc
ssh $sshopts $deploy "mkdir -p $doc_dst/$name/"
scp $sshopts -r _build/default/_doc/_html/* $deploy:$doc_dst/$name/
- deploy-coverage: |
cd $name
eval "$(opam env)"
dune clean
BISECT_ENABLE=YES dune runtest --no-buffer --force > /dev/null
bisect-ppx-report -html _coverage/ "$(find . -name 'bisect*.out')"
ssh $sshopts $deploy "mkdir -p $coverage_dst/$name/"
scp $sshopts -r _coverage/* $deploy:$coverage_dst/$name/
- archive: |
cd $name
eval "$(opam env)"
dune clean
git archive -o ${name}-dev.tar.xz HEAD
ssh $sshopts $deploy "mkdir -p $archive_dst/$name/"
scp $sshopts ${name}-dev.tar.xz $deploy:$archive_dst/$name/

+ 1
- 1
dune-project View File

@ -5,7 +5,7 @@
(maintainers "Léo Andrès <l@ndrs.fr>")
(source (uri git://git.zapashcanon.fr/zapashcanon/exit.git))
(bug_reports https://git.zapashcanon.fr/zapashcanon/exit/issues)
(homepage https://git.zapashcanon.fr/zapashcanon/exit/issues)
(homepage https://git.zapashcanon.fr/zapashcanon/exit)
(generate_opam_files true)
(explicit_js_mode)


+ 5
- 9
examples/print_code.ml View File

@ -1,11 +1,7 @@
let _ =
Format.printf "succes code is %d@." Exit.success_code;
Format.printf "failure code is %d@." Exit.failure_code;
if Exit.success_code <> 0 || Exit.failure_code <> 1 then begin
Format.printf "not POSIX !@.";
Exit.failure ()
end;
Format.printf "succes code is %d@." Exit.success_code ;
Format.printf "failure code is %d@." Exit.failure_code ;
if Exit.success_code <> 0 || Exit.failure_code <> 1 then (
Format.printf "not POSIX !@." ;
Exit.failure () ) ;
Exit.success ()

+ 2
- 0
src/dune View File

@ -1,4 +1,6 @@
(library
(public_name exit)
(wrapped false)
(preprocess
(pps bisect_ppx -conditional))
(c_names exit_stubs))

+ 5
- 6
src/exit.ml View File

@ -1,14 +1,13 @@
external success_code : unit -> int = "get_success_code"
external failure_code : unit -> int = "get_failure_code"
let success_code = success_code ()
let failure_code = failure_code ()
let success () =
exit success_code
let success () = exit success_code
let failure () =
exit failure_code
let failure () = exit failure_code
let is_posix =
success_code = 0 && failure_code = 1
let is_posix = success_code = 0 && failure_code = 1

+ 6
- 5
test/test.ml View File

@ -1,5 +1,6 @@
assert (Exit.success_code >= 0);
assert (Exit.failure_code >= 0);
assert (Exit.success_code <= 255);
assert (Exit.failure_code <= 255);
assert (Exit.success_code <> Exit.failure_code);
;;
assert (Exit.success_code >= 0) ;
assert (Exit.failure_code >= 0) ;
assert (Exit.success_code <= 255) ;
assert (Exit.failure_code <= 255) ;
assert (Exit.success_code <> Exit.failure_code)

Loading…
Cancel
Save