Skip to content

Commit

Permalink
[build] [doc] [ci] Document and test global opam dev install
Browse files Browse the repository at this point in the history
Fixes #682 , cc: #479 #488
  • Loading branch information
ejgallego committed Apr 25, 2024
1 parent 184dd63 commit 71a7571
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,32 @@ jobs:
- name: 🐛 Test fcc
run: opam exec -- make test-compiler

build-opam:
name: Opam dev install
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: 🔭 Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: 🐫 Setup OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.14.x
dune-cache: true

- name: Install Coq and SerAPI into OPAM switch
run: opam install vendor/coq/{coq-core,coq-stdlib,coqide-server,coq}.opam vendor/coq-serapi/coq-serapi.opam

- name: Install `coq-lsp` into OPAM switch
run: opam install .

- name: Test
run: fcc examples/Demo.v

build-nix:
name: Nix
strategy:
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
`--max_errors=0` to imitate `coqc` behavior (@ejgallego, #680)
- Fix `fcc` exit status when checking terminates with fatal errors
(@ejgallego, @Alizter, #680)
- Fix (@ejgallego, #683, fixes #682, cc #479 #488, thanks to
@Hazardouspeach for the report)

# coq-lsp 0.1.8.1: Spring fix
-----------------------------
Expand Down
42 changes: 41 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,27 @@ generate it from the relevant entries in `CHANGES.md` at release time.

### Compilation

#### Opam/Dune
The server project uses a standard OCaml development setup based on
Opam and Dune. This also works on Windows using the [Coq Platform
Source
Install](https://github.com/coq/platform/blob/main/doc/README_Windows.md#installation-by-compiling-from-sources-using-opam-on-cygwin)

The default development environment for `coq-lsp` is a "composed"
build that includes git submodules for `coq` and `coq-serapi` in the
`vendor/` directory. This allows us to easily work with PRs using
experimental Coq branches, and some other advantages like a better CI
build cache and easier bisects.

This will however install a local Coq version which may not be
convenient for all use cases; we thus detail below an alternative
install method for those that would like to install a `coq-lsp`
development branch into an OPAM switch.

#### Default development setup, local Coq / `coq-lsp`

This setup will build Coq and `coq-lsp` locally; it is the recommended
way to develop `coq-lsp` itself.

1. Install the dependencies (the complete updated list of dependencies can be found in `coq-lsp.opam`).

```sh
Expand All @@ -85,6 +100,31 @@ Install](https://github.com/coq/platform/blob/main/doc/README_Windows.md#install

Alternatively, you can also use the regular `dune build @check` etc... targets.

Now, binaries for Coq and `coq-lsp` can be found under
`_build/install/default` and used via `dune exec -- fcc` or `dune exec
-- $your_editor`.

#### Global OPAM install

This setup will build Coq and `coq-lsp` and install them to the
current OPAM switch. This is a good setup for people looking to try
out `coq-lsp` development versions with other OPAM packages.

1. Install vendored Coq and SerAPI:

```sh
opam install vendor/coq/coq{-core,-stdlib,}.opam
opam install vendor/coq-serapi
```

2. Install `coq-lsp`:
```sh
opam install .
```

Then, you should get a working OPAM switch with Coq and `coq-lsp` from
your chosen `coq-lsp` branch.

#### Nix

We have a Nix flake that you can use.
Expand Down
5 changes: 4 additions & 1 deletion coq-lsp.opam
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ depends: [
"ppx_hash" { >= "v0.13.0" & < "v0.17" }
]

build: [ [ "dune" "build" "-p" name "-j" jobs ] ]
build: [
[ "rm" "-rf" "vendor" ]
[ "dune" "build" "-p" name "-j" jobs ]
]
run-test: [ [ "dune" "runtest" "-p" name "-j" jobs ] ]

0 comments on commit 71a7571

Please sign in to comment.