Skip to content

Commit

Permalink
Use setup-ocaml github action (#1341)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrus- authored Aug 17, 2024
2 parents e9750bf + 8ca1c2c commit feb2c5f
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 225 deletions.
7 changes: 6 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
# More information: https://github.com/github-linguist/linguist/blob/master/docs/overrides.md#generated-code
src/haz3lweb/Init.ml linguist-generated
src/haz3lweb/exercises/**/*.ml linguist-generated

hazel.opam linguist-generated
hazel.opam.locked linguist-generated

*.md linguist-documentation
docs/** linguist-documentation
docs/** linguist-documentation

32 changes: 19 additions & 13 deletions .github/workflows/deploy_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,33 @@ jobs:
path: source
- name: Add the name of the current branch to the environment as BRANCH_NAME
uses: nelonoel/[email protected]
- name: Retrieve the build environment if cached
id: opam-cache
uses: actions/cache@v2
with:
path: '/home/runner/.opam/'
key: ${{ runner.os }}-modules-${{ hashFiles('./source/opam.export') }}
- name: Set-up OCaml
run: |
sudo apt --assume-yes install curl m4 opam
export OPAMYES=1
opam init --compiler=ocaml-base-compiler.5.2.0
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 5.2.0
dune-cache: true
- name: Retrieve the switch environment if cached
id: opam-cache-switch
uses: actions/cache@v4
with:
path: '_opam'
key: ${{ runner.os }}-modules-${{ hashFiles('./source/hazel.opam.locked') }}
- name: Install dependencies
run: |
eval $(opam env)
export OPAMYES=1
make deps
export DUNE_CACHE=enabled
opam install . --deps-only --with-test --locked
working-directory: ./source
- name: Build Release
- name: Clean opam switch
run: |
eval $(opam env)
make release
export OPAMYES=1
opam clean --all-switches --download-cache --logs --repo-cache --unused-repositories
- name: Build Release
run: |
export DUNE_CACHE=enabled
opam exec -- dune build @src/fmt --auto-promote src --profile release
working-directory: ./source
- name: Checkout the website build artifacts repo
uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ setup.log

# unit tests
*.xml

# Backup of opam lock file
hazel.opam.locked.old
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ all: dev

deps:
opam update
opam switch import opam.export
opam install ./hazel.opam.locked --deps-only --with-test --with-doc

change-deps:
opam switch export opam.export
sed -i '' '/host-/d' opam.export # remove host- lines which are arch-specific
opam update
dune build hazel.opam
opam install ./hazel.opam --deps-only --with-test --with-doc
opam lock .
sed -i'.old' '/host-/d' hazel.opam.locked # remove host- lines which are arch-specific. Not using -i '' because of portability issues https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux

setup-instructor:
cp src/haz3lweb/ExerciseSettings_instructor.re src/haz3lweb/ExerciseSettings.re
Expand Down
12 changes: 12 additions & 0 deletions docs/Change-OCaml-Dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Instructions for Changing Ocaml Dependencies

## How to update dependencies

- Update the dune-project file to reflect the new dependency constraints
- `make change-deps`
- This should generate the hazel.opam file from dune.
- Depending on your installed dependencies you may need to make a new clean switch
- Interrogate the `hazel.opam.locked` file to see what dependencies have changed
- `make release`
- Test in Firefox and Chrome.
- Commit changed files and push
42 changes: 42 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
(lang dune 3.16)
(using menhir 2.0)

(name hazel)

(generate_opam_files true)

(source
(github hazelgrove/hazel))

(authors "Hazel Development Team")
(maintainers "Hazel Development Team")

(license MIT)

(package
(name hazel)
(allow_empty)
(synopsis "Hazel, a live functional programming environment with typed holes")
; (description "A longer description")
; (tags
; (topics "to describe" your project))
(depends
(ocaml
(>= 5.2.0))
(menhir
(>= 2.0))
yojson
reason
ppx_yojson_conv_lib
ppx_yojson_conv
incr_dom
(omd (>= 2.0.0~alpha4))
ezjs_idb
virtual_dom
ppx_deriving
ptmap
uuidm
unionFind
ocamlformat
(junit_alcotest :with-test)
ocaml-lsp-server)) ; After upgrading to opam 2.2 use with-dev https://opam.ocaml.org/blog/opam-2-2-0/

; See the complete stanza docs at https://dune.readthedocs.io/en/stable/reference/dune-project/index.html
44 changes: 44 additions & 0 deletions hazel.opam

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

201 changes: 201 additions & 0 deletions hazel.opam.locked

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit feb2c5f

Please sign in to comment.