From aaeb90eee68094f70720d9a4df04e0ff649f6049 Mon Sep 17 00:00:00 2001 From: Fabrice Le Fessant Date: Fri, 9 Jul 2021 14:11:51 +0200 Subject: [PATCH] fixes --- .../skeletons/projects/mini_lib/drom.toml | 2 +- .../skeletons/projects/mini_prg/drom.toml | 2 +- .../dot_github/workflows/doc-deploy.yml | 3 +- .../virtual/dot_github/workflows/workflow.yml | 14 ++++----- src/drom_lib/subst.ml | 31 ++++++++++++++----- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/share/drom/skeletons/projects/mini_lib/drom.toml b/share/drom/skeletons/projects/mini_lib/drom.toml index 2f09efa2..0695d7c9 100644 --- a/share/drom/skeletons/projects/mini_lib/drom.toml +++ b/share/drom/skeletons/projects/mini_lib/drom.toml @@ -44,7 +44,7 @@ for-test = true [project] pack-modules = true skip-dirs = [] -skip = "test sphinx github docs ocamlformat ocp-indent" +skip = "@test @sphinx @docs @ocamlformat @ocp-indent" [[package]] skeleton = "library" diff --git a/share/drom/skeletons/projects/mini_prg/drom.toml b/share/drom/skeletons/projects/mini_prg/drom.toml index 7d9d6722..54b98a1a 100644 --- a/share/drom/skeletons/projects/mini_prg/drom.toml +++ b/share/drom/skeletons/projects/mini_prg/drom.toml @@ -44,7 +44,7 @@ for-test = true [project] pack-modules = true skip-dirs = [] -skip = "test sphinx github docs ocamlformat ocp-indent" +skip = "@test @sphinx @docs @ocamlformat @ocp-indent" [[package]] skeleton = "program" diff --git a/share/drom/skeletons/projects/virtual/dot_github/workflows/doc-deploy.yml b/share/drom/skeletons/projects/virtual/dot_github/workflows/doc-deploy.yml index ac2b32bd..74a20435 100644 --- a/share/drom/skeletons/projects/virtual/dot_github/workflows/doc-deploy.yml +++ b/share/drom/skeletons/projects/virtual/dot_github/workflows/doc-deploy.yml @@ -6,7 +6,7 @@ on: jobs: doc-deploy: runs-on: !{ci-first-system} - +!(github-worlflow-env) steps: - name: checkout uses: actions/checkout@v2 @@ -39,6 +39,7 @@ jobs: if: steps.cache-opam.outputs.cache-hit != 'true' - run: opam upgrade --fixup if: steps.cache-opam.outputs.cache-hit == 'true' +!(github-workflow-before-doc) - name: build-doc run: | make doc diff --git a/share/drom/skeletons/projects/virtual/dot_github/workflows/workflow.yml b/share/drom/skeletons/projects/virtual/dot_github/workflows/workflow.yml index 21d3c7ed..0ab0cb2d 100644 --- a/share/drom/skeletons/projects/virtual/dot_github/workflows/workflow.yml +++ b/share/drom/skeletons/projects/virtual/dot_github/workflows/workflow.yml @@ -27,7 +27,7 @@ jobs: ![fi] runs-on: ${{ matrix.os }} - +!(github-worlflow-env) steps: - name: Checkout code uses: actions/checkout@v2 @@ -58,19 +58,19 @@ jobs: - run: opam pin add . -y --no-action - run: opam depext -y !{packages} - if: steps.cache-opam.outputs.cache-hit != 'true' +# if: steps.cache-opam.outputs.cache-hit != 'true' - run: opam install -y ./*.opam --deps-only --with-test - if: steps.cache-opam.outputs.cache-hit != 'true' +# if: steps.cache-opam.outputs.cache-hit != 'true' - - run: opam upgrade --fixup - if: steps.cache-opam.outputs.cache-hit == 'true' +# - run: opam upgrade --fixup +# if: steps.cache-opam.outputs.cache-hit == 'true' - run: dos2unix scripts/*.sh if: matrix.os == 'windows-latest' - +!(github-workflow-before-build) - run: make build - +!(github-workflow-after-build) - name: run test suite run: | ./scripts/before.sh test diff --git a/src/drom_lib/subst.ml b/src/drom_lib/subst.ml index 691c369e..2a823a81 100644 --- a/src/drom_lib/subst.ml +++ b/src/drom_lib/subst.ml @@ -30,6 +30,11 @@ let maybe_string = function | None -> "" | Some s -> s +let with_buffer f = + let b = Buffer.create 100 in + f b ; + Buffer.contents b + let project_brace (_, p) v = match v with | "name" -> p.package.name @@ -144,14 +149,24 @@ let project_brace (_, p) v = github_organization p.package.name ) | "sphinx-target" -> Misc.sphinx_target p | "odoc-target" -> Misc.odoc_target p - | "badge-ci" -> ( - match p.github_organization with - | None -> "" - | Some github_organization -> - Printf.sprintf - "[![Actions \ - Status](https://github.com/%s/%s/workflows/Main%%20Workflow/badge.svg)](https://github.com/%s/%s/actions)" - github_organization p.package.name github_organization p.package.name ) + | "badge-ci" -> + begin + match p.github_organization with + | None -> "" + | Some github_organization -> + with_buffer (fun b -> + List.iter (fun workflow -> + Printf.bprintf b + "[![Actions \ + Status](https://github.com/%s/%s/workflows/%s/badge.svg)](https://github.com/%s/%s/actions)" + github_organization p.package.name + workflow + github_organization p.package.name ) + [ "Main%20Workflow"; + "doc-deploy" + ] + ) + end | "badge-release" -> ( match p.github_organization with | None -> ""