diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8192c50..6f4fa76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,52 +18,57 @@ jobs: matrix: os: - ubuntu-latest - ocaml-compiler: - - 5.4.x + ocaml-version: + - "5.4" runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + steps: - name: Checkout code uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - name: Setup OCaml - uses: ocaml/setup-ocaml@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 + - name: Environment setup + run: | + echo "DUNE_WORKSPACE=$PWD/dune-workspace-${{ matrix.ocaml-version }}" >> "$GITHUB_ENV" + + - name: Setup Dune + uses: mbarbin/setup-dune@d38f7c80df59974cbe417c7f2a849219d54b4fdf # v2.0.0+patch-3 with: - ocaml-compiler: ${{ matrix.ocaml-compiler }} - dune-cache: true - opam-repositories: | - default: https://github.com/ocaml/opam-repository.git - mbarbin: https://github.com/mbarbin/opam-repository.git - alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git - # janestreet-bleeding: https://github.com/janestreet/opam-repository.git - # janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages + version: "3.21.0" + workspace: ${{ env.DUNE_WORKSPACE }} + cache-prefix: "main-ci-${{ matrix.ocaml-version }}" + steps: install-dune enable-pkg lazy-update-depexts install-gpatch install-depexts - # Setting `(implicit_transitive_deps VALUE)` conditionally based on the compiler version. + # Setting implicit_transitive_deps based on the compiler version. - name: Edit dune-project - run: opam exec -- ocaml .github/workflows/edit_dune_project_dot_ml "${{ matrix.ocaml-compiler }}" - - - name: Install dependencies - run: opam install . --deps-only --with-doc --with-test --with-dev-setup - - - name: Build - run: opam exec -- dune build @all @lint + run: sed -i 's/(implicit_transitive_deps [^)]*)/(implicit_transitive_deps false)/' dune-project - - name: Run tests + - name: Build and Run tests run: | + rm -rf _build/default/ mkdir $BISECT_DIR - opam exec -- dune runtest --instrument-with bisect_ppx + dune build @all @runtest --force --instrument-with bisect_ppx env: BISECT_DIR: ${{ runner.temp }}/_bisect_ppx_data BISECT_FILE: ${{ runner.temp }}/_bisect_ppx_data/data - name: Send coverage report to Coveralls - run: opam exec -- bisect-ppx-report send-to Coveralls --coverage-path $BISECT_DIR + run: dune exec -- bisect-ppx-report send-to Coveralls --coverage-path $BISECT_DIR env: BISECT_DIR: ${{ runner.temp }}/_bisect_ppx_data COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} PULL_REQUEST_NUMBER: ${{ github.event.number }} + - name: Lint + run: dune build @lint @fmt @unused-libs + + - name: Build Doc + run: dune build @doc + # Before checking for uncommitted changes we need to restore changes # potentially made to the dune-project file. - name: Restore dune-project @@ -71,12 +76,3 @@ jobs: - name: Check for uncommitted changes run: git diff --exit-code - - - name: Lint opam - uses: ocaml/setup-ocaml/lint-opam@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 - - - name: Lint fmt - uses: ocaml/setup-ocaml/lint-fmt@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 - - - name: Lint doc - uses: ocaml/setup-ocaml/lint-doc@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 diff --git a/.github/workflows/deploy-odoc.yml b/.github/workflows/deploy-odoc.yml index 8ca36ea..9ed5b60 100644 --- a/.github/workflows/deploy-odoc.yml +++ b/.github/workflows/deploy-odoc.yml @@ -14,6 +14,8 @@ jobs: build: name: Build OCaml Doc runs-on: ubuntu-latest + env: + OCAML_VERSION: "5.4" defaults: run: shell: bash @@ -23,23 +25,20 @@ jobs: with: fetch-depth: 0 - - name: Setup OCaml - uses: ocaml/setup-ocaml@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 - with: - ocaml-compiler: "5.4.x" - dune-cache: true - opam-repositories: | - default: https://github.com/ocaml/opam-repository.git - mbarbin: https://github.com/mbarbin/opam-repository.git - alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git - # janestreet-bleeding: https://github.com/janestreet/opam-repository.git - # janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages + - name: Environment setup + run: | + echo "DUNE_WORKSPACE=$PWD/dune-workspace-${{ env.OCAML_VERSION }}" >> "$GITHUB_ENV" - - name: Install OCaml Dependencies - run: opam install . --deps-only --with-doc + - name: Setup Dune + uses: mbarbin/setup-dune@d38f7c80df59974cbe417c7f2a849219d54b4fdf # v2.0.0+patch-3 + with: + version: "3.21.0" + workspace: ${{ env.DUNE_WORKSPACE }} + cache-prefix: "deploy-odoc-${{ env.OCAML_VERSION }}" + steps: install-dune enable-pkg lazy-update-depexts install-gpatch install-depexts - name: Build Odoc Pages - run: opam exec -- dune build @doc + run: dune build @doc - name: Upload Build Artifact uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 diff --git a/.github/workflows/dune-pkg-more-ci.yml b/.github/workflows/dune-pkg-more-ci.yml index 638fbb4..9a18a96 100644 --- a/.github/workflows/dune-pkg-more-ci.yml +++ b/.github/workflows/dune-pkg-more-ci.yml @@ -1,5 +1,4 @@ # Additional CI workflow using setup-dune (dune package management). -# This workflow is intended to eventually replace more-ci.yml. # # This tests across multiple operating systems and OCaml versions, but skips # steps not necessary for every combination (linting, coverage, etc.). diff --git a/.github/workflows/dunolint.yml b/.github/workflows/dunolint.yml index 67df05e..9628d1e 100644 --- a/.github/workflows/dunolint.yml +++ b/.github/workflows/dunolint.yml @@ -19,9 +19,10 @@ jobs: uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Install dunolint - uses: mbarbin/dunolint-actions/setup-dunolint@2ba7453b5904f39688a3e656c770a5b9727163d0 # v1.0.0-alpha.3 + uses: mbarbin/dunolint-actions/setup-dunolint@6b1c0591ba857063829211bc162712052889c4e2 # v1.0.0-alpha.4 with: dunolint-version: 0.0.20260103 + dunolint-digest: sha256:2771c39def3ae771735e105bf22f3ab67745354ed13e7263284a866625eacb69 - name: Lint Check - uses: mbarbin/dunolint-actions/lint-check@2ba7453b5904f39688a3e656c770a5b9727163d0 # v1.0.0-alpha.3 + uses: mbarbin/dunolint-actions/lint-check@6b1c0591ba857063829211bc162712052889c4e2 # v1.0.0-alpha.4 diff --git a/.github/workflows/edit_dune_project_dot_ml b/.github/workflows/edit_dune_project_dot_ml deleted file mode 100644 index 9c134e0..0000000 --- a/.github/workflows/edit_dune_project_dot_ml +++ /dev/null @@ -1,73 +0,0 @@ -(* Usage: ocaml .github/workflows/edit_dune_project_dot_ml *) - -let starts_with s prefix = - let len_s = String.length s in - let len_p = String.length prefix in - len_s >= len_p && String.sub s 0 len_p = prefix -;; - -let is_implicit_transitive_deps_line line = - let prefix = "(implicit_transitive_deps" in - starts_with (String.trim line) prefix -;; - -let () = - let usage () = - Printf.eprintf - "Error: OCaml version argument required. Usage: %s \n" - Sys.argv.(0); - exit 1 - in - if Array.length Sys.argv < 2 then usage (); - let version = Sys.argv.(1) in - let dune_project = "dune-project" in - let file_lines = - try - let ic = open_in dune_project in - let rec loop acc = - match input_line ic with - | line -> loop (line :: acc) - | exception End_of_file -> List.rev acc - in - let lines = loop [] in - close_in ic; - lines - with - | Sys_error _ -> - Printf.eprintf "File not found: %s\n" dune_project; - exit 1 - in - let major, minor = - try - match String.split_on_char '.' version with - | major :: minor :: _ -> int_of_string major, int_of_string minor - | _ -> failwith "Invalid version format" - with - | _ -> - Printf.eprintf "Invalid OCaml version: %s\n" version; - exit 1 - in - let should_be_false = major > 5 || (major = 5 && minor >= 2) in - let changed = ref false in - let new_lines = - List.map - (fun line -> - if is_implicit_transitive_deps_line line - then ( - changed := true; - Printf.sprintf - "(implicit_transitive_deps %s)" - (if should_be_false then "false" else "true")) - else line) - file_lines - in - if !changed - then ( - let oc = open_out dune_project in - List.iter - (fun l -> - output_string oc l; - output_char oc '\n') - new_lines; - close_out oc) -;; diff --git a/.github/workflows/more-ci.yml b/.github/workflows/more-ci.yml deleted file mode 100644 index 5bb996a..0000000 --- a/.github/workflows/more-ci.yml +++ /dev/null @@ -1,81 +0,0 @@ -# This workflow file is named 'more-ci' and is used to run additional CI checks -# that complement the main CI workflow. It ensures that our code is tested -# across multiple operating systems and OCaml compiler versions. -# -# Compared to the main 'ci.yml' job, this skips some steps that are not -# necessary to check for every combination of os and ocaml-compiler, such as -# generating coverage report, linting odoc, opam and fmt, etc. -# -# We prefer to keep it separate from the main CI workflow because we find it -# more readable, over having too many conditional steps in the same job. - -name: more-ci - -on: - push: - branches: - - main - pull_request: - branches: - - "**" # This will match pull requests targeting any branch - -permissions: - contents: read - -jobs: - build: - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - ocaml-compiler: - - 5.4.x - - 5.3.x - - 5.2.x - - 4.14.x - exclude: - # We exclude the combination already tested in the 'ci' workflow. - - os: ubuntu-latest - ocaml-compiler: 5.4.x - - runs-on: ${{ matrix.os }} - - defaults: - run: - shell: bash - - steps: - - name: Checkout code - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - - - name: Setup OCaml - uses: ocaml/setup-ocaml@dec6499fef64fc5d7ed43d43a87251b7b1c306f5 # v3.4.8 - with: - ocaml-compiler: ${{ matrix.ocaml-compiler }} - dune-cache: true - opam-repositories: | - default: https://github.com/ocaml/opam-repository.git - mbarbin: https://github.com/mbarbin/opam-repository.git - alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git - # janestreet-bleeding: https://github.com/janestreet/opam-repository.git - # janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages - - - name: Environment setup - run: | - if [ "${{ matrix.ocaml-compiler }}" = "4.14.x" ]; then - echo "PACKAGES=fpath-sexp0" >> "$GITHUB_ENV" - echo "OPAM_PACKAGES=./fpath-sexp0.opam" >> "$GITHUB_ENV" - else - echo "PACKAGES=fpath-sexp0,fpath-base,fpath-base-tests" >> "$GITHUB_ENV" - echo "OPAM_PACKAGES=./fpath-sexp0.opam ./fpath-base.opam ./fpath-base-tests.opam" >> "$GITHUB_ENV" - fi - - # We build and run tests for a subset of packages. More tests are run in - # the development workflow and as part of the main CI job. These are the - # tests that are checked for every combination of os and ocaml-compiler. - - name: Install dependencies - run: opam install ${{ env.OPAM_PACKAGES }} --deps-only --with-test - - - name: Build & Run tests - run: opam exec -- dune build @all @runtest --only-packages=${{ env.PACKAGES }} diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..8724ab6 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @mbarbin diff --git a/dune-workspace b/dune-workspace deleted file mode 100644 index 53d6fbd..0000000 --- a/dune-workspace +++ /dev/null @@ -1,12 +0,0 @@ -(lang dune 3.20) - -(lock_dir - (repositories overlay upstream alpha mbarbin)) - -(repository - (name mbarbin) - (url "git+https://github.com/mbarbin/opam-repository.git")) - -(repository - (name alpha) - (url "git+https://github.com/kit-ty-kate/opam-alpha-repository.git"))