Skip to content

Commit

Permalink
Merge pull request #1 from SweetIQ/travis
Browse files Browse the repository at this point in the history
Travis CI
  • Loading branch information
xiamx authored Jun 5, 2017
2 parents 6a160e1 + f9012dc commit 6b15dc0
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 8 deletions.
18 changes: 18 additions & 0 deletions .provision.travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /bin/bash

sudo apt-get -y install curl libsnappy-dev autoconf automake libtool pkg-config

if [ ! -f $HOME/libpostal/bootstrap.sh ]; then
mkdir -p $HOME/libpostal
mkdir -p $HOME/libpostal_data
cd $HOME
git clone https://github.com/openvenues/libpostal
cd $HOME/libpostal
git checkout v1.0.0
./bootstrap.sh
./configure --datadir=$HOME/libpostal_data --prefix=/usr
make
fi

cd $HOME/libpostal
sudo make install
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- libsnappy-dev
- realpath

language: elixir
elixir:
- 1.4.4

install:
- export CC="clang"
- mkdir _deps
- git clone https://github.com/openvenues/libpostal
- cd libpostal
- ./bootstrap.sh
- ./configure --datadir=$(pwd)/data --prefix=$(realpath $(pwd)/../_deps) --bindir=$(realpath $(pwd)/../_deps)
- make install
- cd ..
- export CFLAGS=-I$(pwd)/_deps/include
- export LDFLAGS=-L$(pwd)/_deps/lib
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/_deps/lib
- export LD_RUN_PATH=$LD_RUN_PATH:$(pwd)/_deps/lib
- mix local.hex --force
- mix local.rebar --force
- mix deps.get
- mix compile

script:
- export CC="clang"
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/_deps/lib
- mix test

notifications:
email: false
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
MIX = mix
CFLAGS = -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter
CFLAGS += -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter

ERLANG_PATH = $(shell erl -eval 'io:format("~s", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version), "/include"])])' -s init stop -noshell)
CFLAGS += -I$(ERLANG_PATH)
CFLAGS += -I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib
CFLAGS += -lpostal
CFLAGS += -std=gnu99 -Wno-unused-function

ifeq ($(wildcard deps/libpostal),)
LIBPOSTAL_PATH = ../libpostal
else
LIBPOSTAL_PATH = deps/libpostal
endif

CFLAGS += -I/usr/local/include

ifneq ($(OS),Windows_NT)
CFLAGS += -fPIC

Expand Down
1 change: 0 additions & 1 deletion lib/expand.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ defmodule Expostal.Expand do
## Examples
iex> Expostal.Expand.expand_address("781 Franklin Ave Crown Hts Brooklyn NY")
["781 franklin avenue crown heights brooklyn new york",
"781 franklin avenue crown heights brooklyn ny"]
Expand Down
1 change: 0 additions & 1 deletion lib/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ defmodule Expostal.Parser do
## Examples
iex> Expostal.Parser.parse_address("615 Rene Levesque Ouest, Montreal, QC, Canada")
%{city: "montreal", country: "canada", house_number: "615",
road: "rene levesque ouest", state: "qc"}
Expand Down
3 changes: 0 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
defmodule Mix.Tasks.Compile.Libpostal do
def run(_) do
if Mix.env != :test, do: File.rm_rf("priv")
File.mkdir("priv")
if match? {:win32, _}, :os.type do
# libpostal does not support Windows unfortunately.
IO.warn("Windows is not supported.")
Expand All @@ -12,7 +10,6 @@ defmodule Mix.Tasks.Compile.Libpostal do
{result, _error_code} = System.cmd("make", ["priv/expand.so"], stderr_to_stdout: true)
IO.binwrite result
end
Mix.Project.build_structure
:ok
end
end
Expand Down

0 comments on commit 6b15dc0

Please sign in to comment.