Skip to content

Commit

Permalink
port build system to dune
Browse files Browse the repository at this point in the history
  • Loading branch information
avsm committed Mar 18, 2020
1 parent ca4ba1f commit b35a395
Show file tree
Hide file tree
Showing 221 changed files with 1,975 additions and 3,105 deletions.
180 changes: 0 additions & 180 deletions .depend

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Ctypes
on: [push, pull_request]
jobs:
tests:
name: Tests
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
ocaml-version: [ '4.08.1', '4.10.0' ]
operating-system: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@master
- uses: avsm/setup-ocaml@master
with:
ocaml-version: ${{ matrix.ocaml-version }}
- name: Deps
run: |
opam pin add -n ctypes.dev .
opam pin add -n ctypes-foreign.dev .
opam depext -ty ctypes ctypes-foreign
opam install -t --deps-only .
- name: Build
run: opam exec -- dune build
- name: Test
run: opam exec -- dune runtest
31 changes: 3 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
.*.swp
_build
_opam
libffi.config
asneeded.config
discover
gen_c_primitives
gen_c_primitives.log
gen_libffi_abi
gen_libffi_abi.log
src/ctypes/ctypes_primitives.ml
src/ctypes_config.h
src/ctypes_config.ml
src/ctypes-foreign-base/dl_stubs.c
src/ctypes-foreign-base/dl.ml
src/discover/commands.cm*
src/discover/discover.cm*
src/configure/extract_from_c.cm*
src/configure/gen_c_primitives.cm*
src/configure/gen_libffi_abi.cm*
*~
generated_stubs.c
generated_bindings.ml
generated_struct_bindings.ml
ncurses_generated.ml
ncurses_stubs.c
date_generated.ml
date_stubs.c
fts_generated.ml
fts_stubs.c
libffi_abi.ml
*.install
.merlin
9 changes: 0 additions & 9 deletions .travis-ci-arm.sh

This file was deleted.

44 changes: 23 additions & 21 deletions .travis-ci.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
echo travis_fold:start:prepare
ANDROID_REPOSITORY=git://github.com/whitequark/opam-cross-android
export OCAMLFINDFLAGS

Expand All @@ -12,15 +13,12 @@ install_on_linux () {
sudo apt-get update -qq
if test $use_opam; then
sudo apt-get install -qq opam
opam init
opam update
opam switch create -q $OCAML_VERSION
opam init --compiler=$OCAML_COMPILER
else
sudo apt-get install -qq ocaml ocaml-native-compilers camlp4-extra opam
sudo apt-get install -qq ocaml ocaml-native-compilers opam
opam init
opam update
fi
eval `opam config env`
eval `opam env`
}

install_on_osx () {
Expand All @@ -30,9 +28,8 @@ install_on_osx () {
brew update
brew reinstall ocaml
brew install libffi opam
opam init
opam switch install ocaml-base-compiler.$OCAML_VERSION
eval `opam config env`
opam init --compiler=$OCAML_COMPILER
eval `opam env`
}

install_android_toolchain () {
Expand All @@ -51,8 +48,9 @@ install_android_toolchain () {
}

export OPAMYES=1
export OPAMVERBOSE=1

echo travis_fold:end:prepare
echo travis_fold:start:install
echo $TRAVIS_OS_NAME
case $ANDROID in
true) install_android_toolchain ;;
Expand All @@ -61,34 +59,38 @@ case $ANDROID in
linux) install_on_linux ;;
esac
esac
echo travis_fold:end:install

echo OCaml version
ocaml -version
echo OPAM versions
opam --version
opam --git-version

echo travis_fold:start:install-coverage
# Optional dependencies for coverage testing
if test $COVERAGE -a $TRAVIS_OS_NAME != osx ; then
opam install bisect_ppx ocveralls
fi
echo travis_fold:end:install-coverage

# Optional dependencies for Xen build
opam install mirage-xen || echo "Mirage not installable, so not testing Xen build."

opam pin add -n ctypes $(pwd)
export OPAMVERBOSE=1
echo travis_fold:start:build
opam pin add -n .
opam upgrade
if test $ANDROID; then
opam install --yes ctypes
else
opam install --build-test --yes ctypes
fi
echo travis_fold:end:build

# Check that the inverted stubs package builds with this release
opam pin add -n ctypes-inverted-stubs-example https://github.com/yallop/ocaml-ctypes-inverted-stubs-example.git
if test ! $ANDROID && test ! $COVERAGE && opam install --show-actions ctypes-inverted-stubs-example; then
opam install --build-test --yes ctypes-inverted-stubs-example
else
echo "Pinning the inverted stubs example failed, probably due to OCaml version incompatibility"
fi

# TODO Check that the inverted stubs package builds with this release
#opam pin add -n ctypes-inverted-stubs-example https://github.com/yallop/ocaml-ctypes-inverted-stubs-example.git
#if test ! $ANDROID && test ! $COVERAGE && opam install --show-actions ctypes-inverted-stubs-example; then
# opam install --build-test --yes ctypes-inverted-stubs-example
#else
# echo "Pinning the inverted stubs example failed, probably due to OCaml version incompatibility"
#fi

58 changes: 14 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,20 @@ sudo: required
services:
- docker
script:
- if [ "${ARM}z" = "truez" ]; then
docker run -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static -v $(pwd):/travis yallop/ocaml-ctypes-qemu-arm-base /travis/.travis-ci-arm.sh;
else
bash -ex .travis-ci.sh;
fi
os:
- linux
- osx
bash -ex .travis-ci.sh
dist:
- bionic
arch:
- amd64
- arm64
- ppc64le
env:
- OCAML_VERSION=4.02.3 COVERAGE=true
- OCAML_VERSION=4.02.3 ARM=true
- OCAML_VERSION=4.02.3
- OCAML_VERSION=4.03.0
- OCAML_VERSION=4.04.0+flambda
- OCAML_VERSION=4.04.0+32bit ANDROID=true
- OCAML_VERSION=4.04.2
- OCAML_VERSION=4.05.0
- OCAML_VERSION=4.06.0
- OCAML_VERSION=4.07.0
- OCAML_VERSION=4.08.0
- OCAML_VERSION=4.09.0
matrix:
allow_failures:
- env: OCAML_VERSION=4.04.0+32bit ANDROID=true
exclude:
- os: osx
env: OCAML_VERSION=4.02.3 ARM=true
- os: osx
env: OCAML_VERSION=4.02.3 COVERAGE=true
- os: osx
env: OCAML_VERSION=4.04.0+flambda
- os: osx
env: OCAML_VERSION=4.04.0+32bit ANDROID=true
- os: osx
env: OCAML_VERSION=4.05.0
- os: osx
env: OCAML_VERSION=4.06.0
- os: osx
env: OCAML_VERSION=4.03.0
- os: osx
env: OCAML_VERSION=4.08.0
- os: osx
env: OCAML_VERSION=4.09.0
before_install:
- if [ "${ARM}z" = "truez" ]; then
sudo apt-get update && sudo apt-get install --yes qemu-user-static;
docker pull yallop/ocaml-ctypes-qemu-arm-base;
fi

- OCAML_VERSION=4.06.1
- OCAML_VERSION=4.07.1
- OCAML_VERSION=4.08.1
- OCAML_VERSION=4.09.1
- OCAML_VERSION=4.10.0
72 changes: 0 additions & 72 deletions META

This file was deleted.

0 comments on commit b35a395

Please sign in to comment.