Skip to content

Commit

Permalink
Clean up opamStateConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
desumn committed Dec 12, 2023
1 parent 6e844a9 commit 88c67ec
Show file tree
Hide file tree
Showing 25 changed files with 1,193 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/state/opamStateConfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module E = struct
| WITHDEVSETUP of bool option
| WITHDOC of bool option
| WITHTEST of bool option
| VERBOSE of string option

open OpamStd.Config.E
let builddoc = value (function BUILDDOC b -> b | _ -> None)
Expand All @@ -49,7 +48,6 @@ module E = struct
let withdevsetup = value (function WITHDEVSETUP b -> b | _ -> None)
let withdoc = value (function WITHDOC b -> b | _ -> None)
let withtest = value (function WITHTEST b -> b | _ -> None)
let verbose = value (function VERBOSE s -> s | _ -> None)
end

type t = {
Expand Down
1 change: 0 additions & 1 deletion src/state/opamStateConfig.mli
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module E : sig
| WITHDEVSETUP of bool option
| WITHDOC of bool option
| WITHTEST of bool option
| VERBOSE of string option
val root: unit -> string option
val switch: unit -> string option
end
Expand Down
40 changes: 40 additions & 0 deletions src_ext/swhid_core/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
ocaml-compiler:
- 4.14.0
include:
- os: ubuntu-latest
ocaml-compiler: 4.03.0
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup-ocaml
uses: avsm/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: setup
run: |
opam pin add . -y --no-action
opam depext -y swhid_core
opam install -y ./*.opam --deps-only --with-test
opam upgrade --fixup
- name: build
run: opam exec -- dune build @install
- name: test
run: opam exec -- dune runtest
36 changes: 36 additions & 0 deletions src_ext/swhid_core/.github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
submodules: recursive
persist-credentials: false
- name: setup-ocaml
uses: avsm/setup-ocaml@v2
with:
ocaml-compiler: 4.12.0
- name: setup-deploy
run: |
opam pin add . -y --no-action
opam depext -y swhid_core
opam install -y ./*.opam --deps-only --with-test --with-doc
opam upgrade --fixup
touch doc/.nojekyll
- name: api
run: |
opam exec -- dune build @doc
mv _build/default/_doc/_html/ doc/api
- name: deploy
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: doc/
CLEAN: true
1 change: 1 addition & 0 deletions src_ext/swhid_core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_build
42 changes: 42 additions & 0 deletions src_ext/swhid_core/.ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version=0.21.0
assignment-operator=end-line
break-cases=fit
break-fun-decl=wrap
break-fun-sig=wrap
break-infix=wrap
break-infix-before-func=false
break-separators=before
break-sequences=true
cases-exp-indent=2
cases-matching-exp-indent=normal
doc-comments=before
doc-comments-padding=2
doc-comments-tag-only=default
dock-collection-brackets=false
exp-grouping=preserve
field-space=loose
if-then-else=compact
indicate-multiline-delimiters=space
indicate-nested-or-patterns=unsafe-no
infix-precedence=indent
leading-nested-match-parens=false
let-and=sparse
let-binding-spacing=compact
let-module=compact
margin=80
max-indent=68
module-item-spacing=sparse
ocp-indent-compat=false
parens-ite=false
parens-tuple=always
parse-docstrings=true
sequence-blank-line=preserve-one
sequence-style=terminator
single-case=compact
space-around-arrays=true
space-around-lists=true
space-around-records=true
space-around-variants=true
type-decl=sparse
wrap-comments=false
wrap-fun-args=true
3 changes: 3 additions & 0 deletions src_ext/swhid_core/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1 - 2022-06-20

- first release
8 changes: 8 additions & 0 deletions src_ext/swhid_core/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The ISC License (ISC)
=====================

Copyright © 2022, OCamlPro <[email protected]>

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
39 changes: 39 additions & 0 deletions src_ext/swhid_core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# swhid_core

[swhid_core] is an [OCaml] library to work with [persistent identifiers] used by [Software Heritage], also known as swhid. This is the core library, for most use cases you should use the [swhid library] instead.

## Installation

`swhid_core` can be installed with [opam]:

```sh
opam install swhid_core
```

If you don't have `opam`, you can install it following the [how to install opam] guide.

If you can't or don't want to use `opam`, consult the [opam file] for build instructions.

## Quickstart

Have a look at the [example] folder or at the [documentation].

## About

- [LICENSE]
- [CHANGELOG]

[CHANGELOG]: ./CHANGES.md
[example]: ./example
[LICENSE]: ./LICENSE.md
[opam file]: ./swhid_core.opam
[test suite]: ./test

[documentation]: https://ocamlpro.github.io/swhid_core/api/swhid_core/
[how to install opam]: https://opam.ocaml.org/doc/Install.html
[OCaml]: https://ocaml.org
[opam]: https://opam.ocaml.org/
[persistent identifiers]: https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html
[Software Heritage]: https://www.softwareheritage.org
[swhid library]: https://github.com/OCamlPro/swhid
[swhid_core]: https://github.com/OCamlPro/swhid_core
3 changes: 3 additions & 0 deletions src_ext/swhid_core/doc/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(documentation
(package swhid_core)
(mld_files index))
Binary file added src_ext/swhid_core/doc/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions src_ext/swhid_core/doc/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>swhid_core</title>
<link rel="stylesheet" href="style.css">
<link rel="icon" type="image/png" sizes="804x804" href="favicon.png">
</head>
<body>
<div class="content">
<div class="header">
<h1>swhid_core</h1>

<p>swhid_core is an <a href="https://ocaml.org">OCaml</a> library to work with <a href="https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html">persistent identifiers</a> found in <a href="https://www.softwareheritage.org">Software Heritage identifiers</a>, also known as swhid.</p>
</div>

<div class="section">
<ul>
<li>
<a href="https://github.com/OCamlPro/swhid_core">Project on Github</a>
</li>

<li>
<a href="api/swhid_core/">API Documentation</a>
</li>

<li>
<a href="coverage">Code coverage report</a>
</li>

<li>
<a href="https://github.com/OCamlPro/swhid_core/issues">Bug reports</a>
</li>
</ul>
</div>
</div>
</body>
</html>
9 changes: 9 additions & 0 deletions src_ext/swhid_core/doc/index.mld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{0 swhid_core}

{{:https://github.com/OCamlPro/swhid_core} swhid_core} is an {{:https://ocaml.org} OCaml} library to work with Software Heritage persistent identifiers (swhids).

{1:api API}

{!modules:
Swhid_core
}
18 changes: 18 additions & 0 deletions src_ext/swhid_core/doc/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
body {
color: #444;
background-color: #EEEEEE;
line-height:1.6;
font-size:18px;
}
.content {
width: 80%;
margin-left: 100px;
margin-top: 100px;
font-family: sans-serif;
}
a:link{
color:#5bf
}
a:visited{
color:#55f
}
41 changes: 41 additions & 0 deletions src_ext/swhid_core/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(lang dune 1.11)

(explicit_js_mode)

(implicit_transitive_deps false)

(name swhid_core)

(license ISC)

(authors
"Léo Andrès <[email protected]>, Dario Pinto <[email protected]>")

(maintainers "Léo Andrès <[email protected]>")

(source
(github ocamlpro/swhid_core))

(generate_opam_files true)

(package
(name swhid_core)
(synopsis "OCaml library to work with swhids.")
(description
"swhid_core is an OCaml library to with with Software Heritage persistent identifiers (swhids). This is the core library, for most use cases you should use the swhid library instead.")
(tags
(swhid_core
swhid
swh
persistent
identifiers
hash
software
heritage
archive))
(depends
(ocaml
(>= 4.03))
(dune
(>= 1.11))
(odoc :with-doc)))
4 changes: 4 additions & 0 deletions src_ext/swhid_core/example/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(executable
(name main)
(modules main)
(libraries swhid_core))
10 changes: 10 additions & 0 deletions src_ext/swhid_core/example/main.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
open Swhid_core

let swhid =
match
Object.of_string "swh:1:cnt:bac494ecb6840e6b66f21aae7feb847b23f0745a"
with
| Error e ->
Format.eprintf "error: %s@." e;
exit 1
| Ok id -> Format.printf "%a is a valid swhid !@." Object.pp id
Loading

0 comments on commit 88c67ec

Please sign in to comment.