Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
122 changes: 10 additions & 112 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,75 +11,20 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [
macos-13, # x64
macos-14, # ARM
ubuntu-latest,
windows-latest,
]
target: [rescript]
# syntax explanation:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations
include:
- os: macos-13
ocaml-compiler: 4.14.x
build: opam exec -- npm run build406
test: npm test
artifact-folder: darwin
- os: macos-14
ocaml-compiler: 4.14.x
build: opam exec -- npm run build406
test: npm test
artifact-folder: darwinarm64
- os: ubuntu-latest
ocaml-compiler: 4.14.x
build: opam exec -- npm run build406
test: npm test
artifact-folder: linux
- os: windows-latest
ocaml-compiler: 4.14.x
build: opam exec -- npm run build406
artifact-folder: win32
- os: ubuntu-latest
target: ocaml.4.08
ocaml-compiler: 4.08.x
build: opam exec -- dune build
- os: ubuntu-latest
target: ocaml.4.14
ocaml-compiler: 4.14.x
build: opam exec -- dune build
- os: ubuntu-latest
target: ocaml.5.0
ocaml-compiler: 5.0.x
build: opam exec -- dune build
- os: ubuntu-latest
target: ocaml.5.1
ocaml-compiler: 5.1.x
build: opam exec -- dune build
- os: ubuntu-latest
target: ocaml.5.2
ocaml-compiler: 5.2.x
build: opam exec -- dune build
ocaml-compiler:
- 4.14.x
- 5.0.x
- 5.1.x
- 5.2.x
- 5.3.x

runs-on: ${{matrix.os}}
runs-on: ubuntu-latest

steps:
# needed for Windows testing
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- uses: actions/checkout@v4

- name: Cache OCaml's opam
uses: actions/cache@v4
with:
path: ~/.opam
key: ${{matrix.os}}-reanalyze-v2

- name: Use OCaml
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{matrix.ocaml-compiler}}

Expand All @@ -88,57 +33,10 @@ jobs:
with:
node-version: 18

- run: npm ci

- run: opam install dune cppo

- name: Build
run: ${{matrix.build}}
run: opam exec -- dune build

- name: Test
if: matrix.target == 'rescript'
run: ${{matrix.test}}

# Also avoids artifacts upload permission loss:
# https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss
- name: Compress files
if: matrix.target == 'rescript'
run: |
mkdir ${{matrix.artifact-folder}}
cp _build/default/src/Reanalyze.exe reanalyze.exe
tar -cvf binary.tar reanalyze.exe

- uses: actions/upload-artifact@v4
if: matrix.target == 'rescript'
with:
name: ${{matrix.os}}
path: binary.tar

npm_pack:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: download binaries
uses: actions/download-artifact@v4
- name: Pack reanalyze
run: |
# Put the built artifacts in the appropriate package folder
tar xf macos-13/binary.tar -C dist/vendor-darwin
tar xf macos-14/binary.tar -C dist/vendor-darwinarm64
tar xf ubuntu-latest/binary.tar -C dist/vendor-linux
tar xf windows-latest/binary.tar -C dist/vendor-win32

# Add the correct package.json / README / etc to dist
node scripts/prepare_release.js

# Pack everything up
cd dist
npm pack
cd ..
mv dist/reanalyze-*.tgz reanalyze-npm.tgz
- name: upload reanalyze-npm.tgz
uses: actions/upload-artifact@v4
with:
name: reanalyze-npm.tgz
path: reanalyze-npm.tgz
run: opam exec -- npm test
17 changes: 0 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@ npm install
npm run build
```

To build targeting 4.06 compiler libs (needed for ReScript projects) whatever the compiler version used:

```
npm run build406
```


## Test reanalyze

Make sure to always run the tests before submitting any changes (CI usually takes
longer to give you feedback).

```
npm run build406
npm test
```

## Releases (for Maintainers)

The project is compatible with the [`npm
Expand Down
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,6 @@ npm add --save-dev reanalyze

## Build From Sources


### Build for ReScript

```sh
opam install dune
npm run build406
# _build/default/src/Reanalyze.exe
```

### Build for OCaml native projects using dune

```sh
Expand All @@ -210,5 +201,5 @@ Make sure that `dune` builds both `.cmt` and `.cmti` files by enabling bytecode
This project is itself written in OCaml and can be analyzed as follows.
```sh
dune build
./_build/default/src/Reanalyze.exe -suppress src/compiler-libs-406 -dce-cmt _build
./_build/default/src/Reanalyze.exe -dce-cmt _build
```
65 changes: 0 additions & 65 deletions dead-code-ppx/DeadCodePPX.ml

This file was deleted.

9 changes: 0 additions & 9 deletions dead-code-ppx/dune

This file was deleted.

1 change: 1 addition & 0 deletions examples/deadcode/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# production
/build
/_build

# misc
.DS_Store
Expand Down
36 changes: 0 additions & 36 deletions examples/deadcode/bsconfig.json

This file was deleted.

1 change: 1 addition & 0 deletions examples/deadcode/dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 2.0)
Loading
Loading