Skip to content

Commit

Permalink
Setup CircleCI + Esy (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro authored Jul 9, 2019
1 parent 231b87a commit c3de9ba
Show file tree
Hide file tree
Showing 120 changed files with 7,397 additions and 32 deletions.
162 changes: 162 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
version: 2

common_cache_key: &common_cache_key
key: dependency-cache-{{ checksum "../ocaml-version" }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "websocketaf.opam" }}-{{ checksum "websocketaf-async.opam" }}-{{ checksum "websocketaf-lwt.opam" }}-{{ checksum "websocketaf-lwt.opam" }}

esy_cache_key: &esy_cache_key
key: esy-cache-{{ checksum "esy.json" }}-{{ checksum "../esy-checksum" }}-{{ checksum ".circleci/config.yml" }}

esy_post_build_cache_key: &esy_post_build_cache_key
key: esy-post-build-cache-{{ checksum "esy.json" }}-{{ checksum "../esy-checksum" }}-{{ checksum ".circleci/config.yml" }}

opam-steps: &opam-steps
steps:
- checkout
- run:
name: "Pull Submodules"
command: git submodule update --init --recursive
- run:
name: "Note OCAML_VERSION for cache"
command: echo $OCAML_VERSION > ../ocaml-version
- restore_cache:
<<: *common_cache_key
- run:
name: "Initialize opam"
command: |
sudo apt-get install -y m4
opam init --auto-setup --dot-profile=~/.bash_profile
opam remote add ocamlorg https://opam.ocaml.org || true
opam remote remove default || true
- run:
name: "Install deps"
command: |
sudo apt-get install -y pkg-config libgmp-dev autotools-dev autoconf lsof libssl-dev
opam update
opam install -y dune
opam pin add httpaf git+https://github.com/anmonteiro/httpaf#fork
opam pin add httpaf-lwt git+https://github.com/anmonteiro/httpaf#fork
opam pin add httpaf-lwt-unix git+https://github.com/anmonteiro/httpaf#fork
opam pin add httpaf-async git+https://github.com/anmonteiro/httpaf#fork
opam install -t --deps-only .
- run:
name: 'Clean'
command: rm -rf ./_build
- save_cache:
<<: *common_cache_key
paths:
- ~/.opam
- run:
name: 'Test'
command: |
eval `opam config env`
dune build @all
dune runtest --no-buffer
- run:
name: 'Check git is clean'
command: git diff --exit-code

jobs:
4.04.2:
docker:
- image: ocaml/opam2:debian-9-ocaml-4.04
environment:
- TERM: dumb
- OCAML_VERSION: "4.04.2"
- OPAMSOLVERTIMEOUT: "360"
<<: *opam-steps
4.05.0:
docker:
- image: ocaml/opam2:debian-9-ocaml-4.05
environment:
- TERM: dumb
- OCAML_VERSION: "4.05.0"
<<: *opam-steps
4.06.1:
docker:
- image: ocaml/opam2:debian-9-ocaml-4.06
environment:
- TERM: dumb
- OCAML_VERSION: "4.06.1"
<<: *opam-steps
4.07.1:
docker:
- image: ocaml/opam2:debian-9-ocaml-4.07
environment:
- TERM: dumb
- OCAML_VERSION: "4.07.1"
<<: *opam-steps
esy:
docker:
- image: circleci/node:11.9
environment:
- TERM: dumb
- NPM_CONFIG_PREFIX: "~/.npm-global"
steps:
- checkout
- run:
name: "Pull Submodules"
command: git submodule update --init --recursive
- run:
name: 'Note esy.lock checksum for cache'
command: find esy.lock -type f -exec md5sum {} \; | sort -k 2 | md5sum > ../esy-checksum
- restore_cache:
<<: *esy_cache_key
- restore_cache:
<<: *esy_post_build_cache_key
- run:
name: "Install esy + system deps"
command: |
sudo apt-get install texinfo autotools-dev autoconf
npm install -g esy
- run:
name: 'esy install'
command: ~/.npm-global/bin/esy install
- save_cache:
<<: *esy_cache_key
paths:
- ~/.npm-global
- ~/.esy
- run:
name: 'esy build'
command: ~/.npm-global/bin/esy b dune build @all
- run:
name: 'esy test'
command: ~/.npm-global/bin/esy b dune runtest --no-buffer
# Use both pre and post build caches so that we're more likely
# to have dependencies cached. `esy build` is more likely to fail,
# so this will make the push that fixes the build faster
- save_cache:
<<: *esy_post_build_cache_key
paths:
- ~/.esy
- node_modules

workflows:
version: 2
build-deploy:
jobs:
- 4.04.2:
filters:
branches:
ignore:
- gh-pages
- 4.05.0:
filters:
branches:
ignore:
- gh-pages
- 4.06.1:
filters:
branches:
ignore:
- gh-pages
- 4.07.1:
filters:
branches:
ignore:
- gh-pages
- esy:
filters:
branches:
ignore:
- gh-pages
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ lib_test/tests_
*.docdir
.merlin
*.install
node_modules
_esy
8 changes: 4 additions & 4 deletions async/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(library
(name websocketaf_async)
(name websocketaf_async)
(public_name websocketaf-async)
(libraries
async core angstrom-async faraday-async websocketaf digestif.ocaml base64)
(flags (:standard -safe-string)))
(libraries async core faraday-async websocketaf digestif.ocaml base64)
(flags
(:standard -safe-string)))
1 change: 0 additions & 1 deletion async/websocketaf_async.mli
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
open! Core
open Async

module Client : sig
Expand Down
35 changes: 35 additions & 0 deletions esy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "websocketaf",
"version": "0.1.0",
"license": "BSD-3-clause",
"repository": "git+https://github.com/anmonteiro/websocketaf",
"dependencies": {
"ocaml": "4.8.0",
"@opam/dune": "*",
"@opam/lwt": "*",
"@opam/bigstringaf": "*",
"@opam/angstrom": "*",
"@opam/faraday": "*",
"@opam/faraday-async": "*",
"@opam/faraday-lwt-unix": "*",
"@opam/async": "*",
"@opam/httpaf": "*",
"@opam/httpaf-lwt": "*",
"@opam/httpaf-lwt-unix": "*",
"@opam/httpaf-async": "*",
"@opam/base64": "*",
"@opam/digestif": "*"
},
"devDependencies": {
"@opam/alcotest": "*",
"@opam/merlin": "*",
"@opam/odoc": "*"
},
"resolutions": {
"@opam/conf-openssl": "esy-packages/esy-openssl#dafe9ad",
"@opam/httpaf": "anmonteiro/httpaf:httpaf.opam#372c376",
"@opam/httpaf-lwt": "anmonteiro/httpaf:httpaf-lwt.opam#372c376",
"@opam/httpaf-lwt-unix": "anmonteiro/httpaf:httpaf-lwt-unix.opam#372c376",
"@opam/httpaf-async": "anmonteiro/httpaf:httpaf-async.opam#372c376"
}
}
3 changes: 3 additions & 0 deletions esy.lock/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Set eol to LF so files aren't converted to CRLF-eol on Windows.
* text eol=lf
3 changes: 3 additions & 0 deletions esy.lock/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Reset any possible .gitignore, we want all esy.lock to be un-ignored.
!*
Loading

0 comments on commit c3de9ba

Please sign in to comment.