-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* testing * testing * testing * updated deps * updated deps * updated deps * updated deps * release * release * release * release
- Loading branch information
1 parent
7abb694
commit 7bed03c
Showing
9 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
build: | ||
needs: [unit-test] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Publish | ||
uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: 5 | ||
|
||
- run: opam update && opam install opam-publish | ||
|
||
- run: opam publish | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: testing | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
|
||
unit-test: | ||
permissions: | ||
attestations: write | ||
contents: read | ||
id-token: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
ocaml-compiler: | ||
- 5 | ||
- 4 | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout tree | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set-up OCaml | ||
uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: ${{ matrix.ocaml-compiler }} | ||
|
||
- run: opam install . --deps-only --with-test | ||
|
||
- run: opam exec -- dune build | ||
|
||
- run: opam exec -- dune runtest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(executable | ||
(name test_sid) | ||
(libraries nats-client alcotest) | ||
(preprocess | ||
(pps lwt_ppx))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
open Nats_client | ||
open Alcotest | ||
|
||
let test_create () = | ||
let sids = List.init 1000 (fun _ -> Sid.create 10) in | ||
let unique_sids = List.sort_uniq String.compare sids in | ||
|
||
check int "same length" (List.length unique_sids) (List.length sids) | ||
|
||
let test_length () = | ||
for i = 0 to 10 do | ||
let sid = Sid.create i in | ||
check int "same length" (String.length sid) i | ||
done | ||
|
||
let () = | ||
let open Alcotest in | ||
run "Sid tests" | ||
[ | ||
( "create", | ||
[ | ||
test_case "test_uniqness" `Quick test_create; | ||
test_case "test_length" `Quick test_length; | ||
] ); | ||
] |