From 5e2895f7bebd898ed22a84817b70d8f476ad2a04 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Sun, 27 Oct 2024 16:40:57 +0100 Subject: [PATCH 1/3] Dedup CI jobs on PRs (+ fmt) --- .github/workflows/ci.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48c10a8..9119e90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,12 @@ name: ci on: - - pull_request - - push + push: + branches: + - main + pull_request: + branches: + - "**" # This will match pull requests targeting any branch jobs: build: @@ -27,8 +31,8 @@ jobs: opam-repositories: | default: https://github.com/ocaml/opam-repository.git mbarbin: https://github.com/mbarbin/opam-repository.git -# janestreet-bleeding: https://github.com/janestreet/opam-repository.git -# janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages + # janestreet-bleeding: https://github.com/janestreet/opam-repository.git + # janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages - name: Install dependencies run: opam install . --deps-only --with-doc --with-test --with-dev-setup @@ -38,8 +42,8 @@ jobs: - name: Run tests run: | - mkdir $BISECT_DIR - opam exec -- dune runtest --instrument-with bisect_ppx + mkdir $BISECT_DIR + opam exec -- dune runtest --instrument-with bisect_ppx env: BISECT_DIR: ${{ runner.temp }}/_bisect_ppx_data BISECT_FILE: ${{ runner.temp }}/_bisect_ppx_data/data From 4a284d031a0b720ef774f70698b80875014e2de1 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Sun, 3 Nov 2024 20:48:05 +0100 Subject: [PATCH 2/3] Enable 4.14 --- dune-project | 28 ++++++++++++++-------------- loc-tests.opam | 24 ++++++++++++------------ loc.opam | 4 ++-- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/dune-project b/dune-project index 9651ab0..bfe2c1d 100644 --- a/dune-project +++ b/dune-project @@ -20,12 +20,12 @@ (synopsis "Representing ranges of lexing positions from parsed files") (depends (ocaml - (>= 5.2)) + (>= 4.14)) (fpath (>= 0.7.3)) (sexplib0 (and - (>= v0.17) + (>= v0.16) (< v0.18))) (stdune (>= 3.16)))) @@ -35,14 +35,14 @@ (synopsis "Tests for loc") (depends (ocaml - (>= 5.2)) + (>= 4.14)) (ocamlformat (and :with-dev-setup (= 0.26.2))) (base (and - (>= v0.17) + (>= v0.16) (< v0.18))) (bisect_ppx (and @@ -50,7 +50,7 @@ (>= 2.8.3))) (expect_test_helpers_core (and - (>= v0.17) + (>= v0.16) (< v0.18))) (fpath (>= 0.7.3)) @@ -58,40 +58,40 @@ (= :version)) (ppx_compare (and - (>= v0.17) + (>= v0.16) (< v0.18))) (ppx_enumerate (and - (>= v0.17) + (>= v0.16) (< v0.18))) (ppx_expect (and - (>= v0.17) + (>= v0.16) (< v0.18))) (ppx_hash (and - (>= v0.17) + (>= v0.16) (< v0.18))) (ppx_here (and - (>= v0.17) + (>= v0.16) (< v0.18))) (ppx_js_style (and :with-dev-setup - (>= v0.17) + (>= v0.16) (< v0.18))) (ppx_let (and - (>= v0.17) + (>= v0.16) (< v0.18))) (ppx_sexp_conv (and - (>= v0.17) + (>= v0.16) (< v0.18))) (ppx_sexp_value (and - (>= v0.17) + (>= v0.16) (< v0.18))) (ppxlib (>= 0.33)) diff --git a/loc-tests.opam b/loc-tests.opam index c08c03b..03c9921 100644 --- a/loc-tests.opam +++ b/loc-tests.opam @@ -9,22 +9,22 @@ doc: "https://mbarbin.github.io/loc/" bug-reports: "https://github.com/mbarbin/loc/issues" depends: [ "dune" {>= "3.16"} - "ocaml" {>= "5.2"} + "ocaml" {>= "4.14"} "ocamlformat" {with-dev-setup & = "0.26.2"} - "base" {>= "v0.17" & < "v0.18"} + "base" {>= "v0.16" & < "v0.18"} "bisect_ppx" {with-dev-setup & >= "2.8.3"} - "expect_test_helpers_core" {>= "v0.17" & < "v0.18"} + "expect_test_helpers_core" {>= "v0.16" & < "v0.18"} "fpath" {>= "0.7.3"} "loc" {= version} - "ppx_compare" {>= "v0.17" & < "v0.18"} - "ppx_enumerate" {>= "v0.17" & < "v0.18"} - "ppx_expect" {>= "v0.17" & < "v0.18"} - "ppx_hash" {>= "v0.17" & < "v0.18"} - "ppx_here" {>= "v0.17" & < "v0.18"} - "ppx_js_style" {with-dev-setup & >= "v0.17" & < "v0.18"} - "ppx_let" {>= "v0.17" & < "v0.18"} - "ppx_sexp_conv" {>= "v0.17" & < "v0.18"} - "ppx_sexp_value" {>= "v0.17" & < "v0.18"} + "ppx_compare" {>= "v0.16" & < "v0.18"} + "ppx_enumerate" {>= "v0.16" & < "v0.18"} + "ppx_expect" {>= "v0.16" & < "v0.18"} + "ppx_hash" {>= "v0.16" & < "v0.18"} + "ppx_here" {>= "v0.16" & < "v0.18"} + "ppx_js_style" {with-dev-setup & >= "v0.16" & < "v0.18"} + "ppx_let" {>= "v0.16" & < "v0.18"} + "ppx_sexp_conv" {>= "v0.16" & < "v0.18"} + "ppx_sexp_value" {>= "v0.16" & < "v0.18"} "ppxlib" {>= "0.33"} "stdune" {>= "3.16"} "odoc" {with-doc} diff --git a/loc.opam b/loc.opam index cd2349c..e8c65c2 100644 --- a/loc.opam +++ b/loc.opam @@ -9,9 +9,9 @@ doc: "https://mbarbin.github.io/loc/" bug-reports: "https://github.com/mbarbin/loc/issues" depends: [ "dune" {>= "3.16"} - "ocaml" {>= "5.2"} + "ocaml" {>= "4.14"} "fpath" {>= "0.7.3"} - "sexplib0" {>= "v0.17" & < "v0.18"} + "sexplib0" {>= "v0.16" & < "v0.18"} "stdune" {>= "3.16"} "odoc" {with-doc} ] From 5310ce11570f7ae74262c76c5272d7c46d48e188 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Sun, 3 Nov 2024 20:49:38 +0100 Subject: [PATCH 3/3] Enable additional workflows in CI --- .github/workflows/more-ci.yml | 65 +++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/more-ci.yml diff --git a/.github/workflows/more-ci.yml b/.github/workflows/more-ci.yml new file mode 100644 index 0000000..8064643 --- /dev/null +++ b/.github/workflows/more-ci.yml @@ -0,0 +1,65 @@ +# 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 + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest + ocaml-compiler: + - 5.2.x + - 4.14.x + exclude: + # We exclude the combination already tested in the 'ci' workflow. + - os: ubuntu-latest + ocaml-compiler: 5.2.x + # We exclude windows-4.14 - this fails when building core. + - os: windows-latest + ocaml-compiler: 4.14.x + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup OCaml + uses: ocaml/setup-ocaml@v3 + with: + ocaml-compiler: ${{ matrix.ocaml-compiler }} + opam-repositories: | + default: https://github.com/ocaml/opam-repository.git + mbarbin: https://github.com/mbarbin/opam-repository.git + # janestreet-bleeding: https://github.com/janestreet/opam-repository.git + # janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages + + # 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 ./loc.opam ./loc-tests.opam --deps-only --with-test + + - name: Build & Run tests + run: opam exec -- dune build @all @runtest -p loc,loc-tests