diff --git a/.github/workflows/matrix-check.yml b/.github/workflows/matrix-check.yml new file mode 100644 index 0000000..3ad967c --- /dev/null +++ b/.github/workflows/matrix-check.yml @@ -0,0 +1,58 @@ +# name: Matrix-Check + +# on: +# push: +# branches: [main] +# pull_request: +# types: [opened, synchronize, reopened, ready_for_review] + +# jobs: +# matrix-check: +# strategy: +# fail-fast: false +# matrix: +# os: +# - ubuntu-latest +# ocaml-version: +# - 4.08.1 +# - 4.13.1 +# - 4.14.0 +# - 5.0.0 +# node-version: +# # - lts/fermium # v14 Maintenance LTS +# - lts/gallium # v16 Active LTS +# # - lts/hydrogen # v18 Active LTS + +# if: github.event.pull_request.draft == false +# runs-on: ${{ matrix.os }} + +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# with: +# submodules: recursive +# fetch-depth: 2 + +# - name: Use OCaml ${{ matrix.ocaml-version }} +# uses: ocaml/setup-ocaml@v2 +# with: +# ocaml-compiler: ${{ matrix.ocaml-version }} + +# - name: Cache OPAM switch +# id: cache-switch +# uses: actions/cache@v3 +# with: +# path: _opam +# key: v1-${{ runner.os }}-${{ matrix.ocaml-version }}-opam-switch + +# - name: Check OCaml version and workspace info +# run: ./scripts/ci_print_env.sh + +# - name: Install dependencies +# run: opam install -y . --deps-only --with-test + +# - name: Perform dune build +# run: opam exec -- dune build + +# - name: Perform dune runtest +# run: opam exec -- dune runtest diff --git a/.github/workflows/quick-check.yml b/.github/workflows/quick-check.yml new file mode 100644 index 0000000..eb6a8c1 --- /dev/null +++ b/.github/workflows/quick-check.yml @@ -0,0 +1,43 @@ +name: Quick-Check + +on: + push: + branches: [main] + pull_request: + types: [opened, synchronize, reopened] + +jobs: + quick-check: + strategy: + fail-fast: false + matrix: + ocaml-version: + - 4.13.1 + runs-on: ubuntu-latest + container: + image: ghcr.io/kxcteam/ocaml-general:${{ matrix.ocaml-version }} + timeout-minutes: 25 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + # https://github.blog/2022-04-12-git-security-vulnerability-announced/ + - name: Set safe directory + run: git config --global --add safe.directory $GITHUB_WORKSPACE + + - name: Initialize submodules + run: git submodule update --init + + - name: Check OCaml version and workspace info + run: ./scripts/ci_print_env.sh + + - name: Install OPAM dependencies + run: | + opam install -y . --deps-only --with-test || (opam update && opam install -y . --deps-only --with-test) + + - name: Perform dune build + run: opam exec -- dune build + + - name: Perform dune runtest + run: opam exec -- dune runtest diff --git a/dune-project b/dune-project index b984117..a7525f8 100644 --- a/dune-project +++ b/dune-project @@ -16,6 +16,10 @@ (synopsis "KXC maintained common utilities") (description "Common OCaml utilities maintained by Kotoi-Xie Consultancy") (depends + (ppx_optcomp :build) + (ppx_deriving :build) + (alcotest :with-test) (qtest :with-test) + (ocaml (>= 4.11.0)))) diff --git a/jsoo/unit_test/dune b/jsoo/unit_test/dune index ed9887c..e2e94b7 100644 --- a/jsoo/unit_test/dune +++ b/jsoo/unit_test/dune @@ -1,5 +1,6 @@ (executables (names jsoo_unit_tests) + (optional) (libraries alcotest qcheck kxclib kxclib_jsoo diff --git a/kxclib.opam b/kxclib.opam index 49e7cca..12304eb 100644 --- a/kxclib.opam +++ b/kxclib.opam @@ -10,6 +10,8 @@ homepage: "https://github.com/kxcteam/kxclib-ocaml" bug-reports: "https://github.com/kxcteam/kxclib-ocaml/issues" depends: [ "dune" {>= "3.0"} + "ppx_optcomp" {build} + "ppx_deriving" {build} "alcotest" {with-test} "qtest" {with-test} "ocaml" {>= "4.11.0"} diff --git a/scripts/ci_print_env.sh b/scripts/ci_print_env.sh new file mode 100755 index 0000000..7d852ab --- /dev/null +++ b/scripts/ci_print_env.sh @@ -0,0 +1,12 @@ +#!/bin/bash +echo ">>> uname -a" +uname -a + +echo && echo ">>> OCaml --version" +opam exec -- ocamlc --version + +echo && echo ">>> git status" +git show HEAD^..HEAD --stat || git show HEAD --stat + +echo && echo ">>> git ls-files" +git ls-files