-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a dockerfile for building and testing everything
- Loading branch information
Showing
7 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Translated manually from .gitignore. | ||
# | ||
|
||
bin | ||
**/tmp | ||
**/_build | ||
**/.merlin | ||
**/*.install | ||
_opam | ||
node_modules | ||
package-lock.json | ||
tree-sitter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# | ||
# Reference workflow for building and testing ocaml-tree-sitter. | ||
# | ||
# Run with: | ||
# | ||
# docker build -t ocaml-tree-sitter . | ||
# | ||
# Enter the resulting container with: | ||
# | ||
# docker run -it ocaml-tree-sitter | ||
# | ||
|
||
FROM ocaml/opam2:debian-stable | ||
|
||
COPY --chown=opam:opam scripts /home/opam/ocaml-tree-sitter/scripts | ||
COPY --chown=opam:opam Makefile /home/opam/ocaml-tree-sitter/Makefile | ||
WORKDIR /home/opam/ocaml-tree-sitter | ||
RUN sudo chown opam:opam . | ||
|
||
# Slow steps that mostly download and build external stuff. | ||
RUN ./scripts/setup-node | ||
RUN ./scripts/setup-opam | ||
COPY --chown=opam:opam tree-sitter.opam /home/opam/ocaml-tree-sitter/tree-sitter.opam | ||
RUN opam exec -- make setup | ||
|
||
# Copy the rest, which changes often. | ||
COPY --chown=opam:opam . /home/opam/ocaml-tree-sitter | ||
|
||
# 'opam exec -- CMD' sets environment variables (PATH etc.) and runs | ||
# command CMD in this environment. | ||
# This is equivalent to 'eval $(opam env)' which normally goes into | ||
# ~/.bashrc or similar. | ||
# | ||
RUN opam exec -- make | ||
RUN opam exec -- make install | ||
|
||
# FIXME Why does ld not search /usr/local/lib despite it being listed | ||
# in /etc/ld.so.conf.d/libc.conf ? | ||
RUN LD_LIBRARY_PATH=/usr/local/lib opam exec -- make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#! /usr/bin/env bash | ||
# | ||
# Install Node.js so that we can install the tree-sitter command-line | ||
# interface. Intended for Debian/Ubuntu only. | ||
# | ||
|
||
cat > ~/.npmrc <<EOF | ||
prefix = ~/.node | ||
EOF | ||
|
||
cat >> ~/.bashrc <<EOF | ||
export PATH="$HOME/.node/bin:$PATH" | ||
export NODE_PATH="$HOME/.node/lib/node_modules:$NODE_PATH" | ||
export MANPATH="$HOME/.node/share/man:$MANPATH" | ||
EOF | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y nodejs npm | ||
|
||
npm install npm -g | ||
|
||
# Local install into node_modules/ | ||
npm install node-gyp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#! /usr/bin/env bash | ||
# | ||
# Complete the opam setup already in place in the docker image | ||
# ocaml/opam2:debian-stable. | ||
# | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y m4 | ||
|
||
opam switch 4.09 | ||
|
||
if ! (opam repo list | grep -q http); then | ||
opam repo add --all -k git github \ | ||
https://github.com/ocaml/opam-repository.git | ||
fi | ||
|
||
opam update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ depends: [ | |
"ocaml" | ||
"ppx_deriving" | ||
"ppx_sexp_conv" | ||
"sexplib" | ||
"tsort" {>= "2.0"} | ||
] | ||
|
||
|