Skip to content

Commit

Permalink
Merge pull request #177 from akabe/feature/migrate-to-github-actions
Browse files Browse the repository at this point in the history
Migrate CI from Travis to GitHub Actions
  • Loading branch information
akabe authored Jan 9, 2022
2 parents 4787d88 + 66da5c3 commit e12c3fb
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 7 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/ocaml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: OCaml

on:
push:
branches:
- 'feature/*'
- 'bugfix/*'
- 'hotfix/*'
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
env:
OCAML_JUPYTER_LOG: debug
strategy:
fail-fast: false
matrix:
ocaml-compiler:
- 4.11.0
- 4.12.0
- 4.13.0

steps:
- uses: actions/checkout@v2

- name: Setup OCaml
uses: ocaml/setup-ocaml@master
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Install Jupyter
run: pip install jupyter

- name: Install dependencies
run: |
opam install . -y --deps-only --with-test
opam install 'merlin>3.0.0' -y
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.opam
~/.local
key: ${{ runner.os }}-opam-${{ matrix.ocaml-compiler }}-${{ hashFiles('*.opam') }}
restore-keys: ${{ runner.os }}-opam-${{ matrix.ocaml-compiler }}-

- name: Lint for opam files
run: opam lint *.opam
- name: Lint for source files
run: ./git/pre-commit
- name: Build
run: opam exec -- dune build
- name: Unit tests
run: opam exec -- dune runtest

# =====
# Integration tests
# =====

- name: Install ocaml-jupyter kernel
run: opam pin add jupyter . -y
- name: Install jupyter-archimedes
run: opam pin add jupyter-archimedes . -y
- name: Install kernelspec
run: |
./config/ocaml-jupyter-opam-genspec
jupyter kernelspec install --user --name ocaml-jupyter "$(opam config var share)/jupyter"
echo '#use "topfind";;' >> ~/.ocamlinit
- name: Build integration tests
run: opam exec -- dune build test/integration/runtest.exe
- name: An integration test for jupyter-notebook
run: opam exec -- ./_build/default/test/integration/runtest.exe test/integration/suite/jupyter-notebook.ml
- name: An integration test for ppx
run: opam exec -- ./_build/default/test/integration/runtest.exe test/integration/suite/ppx.ml
- name: An integration test for jupyter-archimedes
run: opam exec -- ./_build/default/test/integration/runtest.exe test/integration/suite/jupyter-archimedes.ml
4 changes: 0 additions & 4 deletions git/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

eval $(opam env)

if ! which ocp-indent 2>&1 >/dev/null; then
opam install -y 'ocp-indent>=1.7.0'
fi

exit_code=0

for fname in $(find jupyter jupyter-archimedes test -name '*.ml' -or -name '*.mli'); do
Expand Down
2 changes: 2 additions & 0 deletions jupyter.opam
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ depends: [
"ppx_deriving_yojson" {>= "3.0"}
"cryptokit" {>= "1.12"}
"dune" {build & >= "1.0.0"}
"ounit2" {with-test & >= "2.0.0"}
"ocp-indent" {with-test & >= "1.7.0"}
]
depopts: [
"merlin"
Expand Down
2 changes: 1 addition & 1 deletion test/completor/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(preprocess (pps lwt_ppx ppx_deriving.show ppx_deriving_yojson))
(libraries jupyter
jupyter_completor
oUnit
ounit2
ppx_deriving.runtime)
(flags ((:include %{workspace_root}/config/ocaml_flags.sexp)
(:include %{workspace_root}/config/ocaml_test_flags.sexp))))
Expand Down
2 changes: 1 addition & 1 deletion test/kernel/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
(preprocess (pps lwt_ppx ppx_deriving.show ppx_deriving_yojson))
(libraries jupyter
jupyter_kernel
oUnit
ounit2
ppx_deriving.runtime)
(flags ((:include %{workspace_root}/config/ocaml_flags.sexp)
(:include %{workspace_root}/config/ocaml_test_flags.sexp))))
Expand Down
2 changes: 1 addition & 1 deletion test/repl/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(preprocess (pps lwt_ppx ppx_deriving.show ppx_deriving_yojson))
(libraries jupyter
jupyter_repl
oUnit
ounit2
ppx_deriving.runtime)
(flags ((:include %{workspace_root}/config/ocaml_flags.sexp)
(:include %{workspace_root}/config/ocaml_test_flags.sexp))))
Expand Down

0 comments on commit e12c3fb

Please sign in to comment.