Skip to content

Commit

Permalink
build: add install steps for libpostal and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Dec 18, 2024
1 parent 8af5585 commit 104583a
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install deps
run: make install

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
with:
fetch-depth: 0

- name: Install deps
run: make install

- name: Fuzz
run: |
go test ./pkg/usaddress/... -fuzz Fuzz -fuzztime 10m
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
go-version: stable
id: go

- name: Install deps
run: make install

- name: Run Tests (Linux)
if: runner.os == 'Linux'
run: make check
Expand Down Expand Up @@ -53,6 +56,9 @@ jobs:
run: |
choco install -y make mingw
- name: Install deps
run: make install

- name: Run Short Tests (Non-Linux)
run: |
go test ./... -short
Expand Down Expand Up @@ -85,6 +91,9 @@ jobs:
sudo systemctl stop mono-xsp4.service || true
sudo killall mono || true
- name: Install deps
run: make install

- name: Build Frontend
run: make build

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/openshift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Install deps
run: make install

- name: Docker Build
if: runner.os == 'Linux'
run: make docker-openshift
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Install deps
run: make install

- name: Short Tests
if: runner.os == 'Linux'
env:
Expand Down Expand Up @@ -74,6 +77,9 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Install deps
run: make install

- name: Load Release URL File from release job
uses: actions/download-artifact@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ openapi-generator*jar

*.db

/libpostal/

webui/build/
webui/node_modules/

Expand Down
50 changes: 49 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,54 @@ endif
run:
CGO_ENABLED=0 go run github.com/moov-io/watchman/cmd/server

# Detect OS
ifeq ($(OS),Windows_NT)
detected_OS := Windows
else
detected_OS := $(shell uname -s)
endif

# Installation target
install:
ifeq ($(detected_OS),Windows)
@$(MAKE) install-windows
else ifeq ($(detected_OS),Linux)
@$(MAKE) install-linux
else ifeq ($(detected_OS),Darwin)
@$(MAKE) install-macos
else
@echo "Unsupported operating system: $(detected_OS)"
@exit 1
endif

install-linux:
sudo apt-get install -y curl autoconf automake libtool pkg-config
@$(MAKE) install-libpostal

install-macos:
brew install curl autoconf automake libtool pkg-config
@$(MAKE) install-libpostal

install-windows:
pacman -Syu
pacman -S autoconf automake curl git make libtool gcc mingw-w64-x86_64-gcc
@$(MAKE) install-libpostal

install-libpostal:
@echo "Cloning libpostal repository and building..."
git clone https://github.com/openvenues/libpostal || true
cd libpostal && \
./bootstrap.sh && \
./configure --datadir=/tmp/libpostal-data && \
make -j$(shell nproc || echo 4) && \
if [ "$(detected_OS)" = "Windows" ]; then \
make install; \
else \
sudo make install; \
fi

.PHONY: install install-linux install-macos install-windows install-libpostal

build: build-server build-batchsearch build-watchmantest
ifeq ($(OS),Windows_NT)
@echo "Skipping webui build on Windows."
Expand All @@ -38,7 +86,7 @@ build-watchmantest:
.PHONY: check
check:
ifeq ($(OS),Windows_NT)
@echo "Skipping checks on Windows, currently unsupported."
go test ./... -short
else
@wget -O lint-project.sh https://raw.githubusercontent.com/moov-io/infra/master/go/lint-project.sh
@chmod +x ./lint-project.sh
Expand Down

0 comments on commit 104583a

Please sign in to comment.