diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5295d3733c..292275ed2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -275,6 +275,13 @@ jobs: if: matrix.build_playground run: opam exec -- make playground + # Runs after the playground build, whose browser-profile tree it + # analyzes together with the native one. reanalyze is a test + # dependency, installed with the switch. + - name: Check for dead code + if: matrix.build_playground + run: opam exec -- make dead-code + - name: Test playground compiler if: matrix.build_playground run: yarn workspace playground test diff --git a/changes/dead-code-ci.internal.md b/changes/dead-code-ci.internal.md new file mode 100644 index 0000000000..5fcb549ce3 --- /dev/null +++ b/changes/dead-code-ci.internal.md @@ -0,0 +1 @@ +- Check in CI that reanalyze reports no dead code in the OCaml sources. diff --git a/dune-project b/dune-project index 7ae75344d2..2930333848 100644 --- a/dune-project +++ b/dune-project @@ -61,7 +61,13 @@ (and (<> :os "win32") :with-test - (= 6.5.0))))) + (= 6.5.0))) + ; make dead-code + (reanalyze + (and + (<> :os "win32") + :with-test + (= 2.27.0))))) (package (name analysis) diff --git a/rescript.opam b/rescript.opam index 9edebe7a03..132e77e1b3 100644 --- a/rescript.opam +++ b/rescript.opam @@ -27,6 +27,7 @@ depends: [ "ocaml-lsp-server" {with-dev-setup & >= "1.23.0"} "js_of_ocaml" {os != "win32" & with-test & = "6.5.0"} "wasm_of_ocaml-compiler" {os != "win32" & with-test & = "6.5.0"} + "reanalyze" {os != "win32" & with-test & = "2.27.0"} ] build: [ ["dune" "subst"] {dev} diff --git a/scripts/dead_code.sh b/scripts/dead_code.sh index a89fecdd15..d9e072812d 100755 --- a/scripts/dead_code.sh +++ b/scripts/dead_code.sh @@ -4,8 +4,8 @@ # anything. # # Usage: REANALYZE=/path/to/reanalyze.exe ./scripts/dead_code.sh -# (defaults to reanalyze.exe on PATH; needs a reanalyze that analyzes several -# build trees together, rescript-lang/reanalyze#224) +# (defaults to reanalyze.exe on PATH. reanalyze is a test dependency in +# rescript.opam, installed by opam install . --deps-only --with-test.) set -euo pipefail cd "$(dirname "$0")/.."