Skip to content

Commit

Permalink
Merge pull request #5 from EasyPost/new_hound2
Browse files Browse the repository at this point in the history
Pull forward custom hound fork
  • Loading branch information
sroomberg-ep authored Jan 15, 2025
2 parents 6480072 + 9ae612e commit bd3eb35
Show file tree
Hide file tree
Showing 54 changed files with 17,246 additions and 10,192 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.vagrant
/node_modules
.DS_Store
*.exe
/db
/data
/.idea
dist/
config.json
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ui/bindata.go linguist-generated=true
27 changes: 27 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Please make sure to read the Contributing Guidelines:
https://github.com/hound-search/hound/blob/main/CONTRIBUTING.md
-->

<!-- PULL REQUEST TEMPLATE -->
<!-- (Update "[ ]" to "[x]" to check a box) -->

**What kind of change does this PR introduce?** (check at least one)

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update
- [ ] Refactor
- [ ] Build-related changes
- [ ] Other, please describe:

**The PR fulfills these requirements:**
- [ ] All tests are passing?
- [ ] New/updated tests are included?
- [ ] If any static assets have been updated, has ui/bindata.go been regenerated?
- [ ] Are there doc blocks for functions that I updated/created?

If adding a **new feature**, the PR's description includes:
- [ ] A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

**Other information:**
84 changes: 67 additions & 17 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,97 @@
on: [push]
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
on:
# Run CI when pushing to main
push:
branches: [ main ]
# Run CI for PRs to main and staging
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
go-build:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.14", "1.13", "1.12"]
go: ["1.18", "1.17", "1.16"]
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-go@v2
- uses: actions/setup-node@v3
with:
node-version: current
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- run: go build -x -work ./cmds/...
node-build:
- run: make
docker-build:
name: Create docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-node@v1
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/hound
VERSION=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=tags::${TAGS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Packages
uses: docker/build-push-action@v2
with:
node-version: "10.x"
- run: npm install
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.prep.outputs.tags }}
golangci:
name: lint
strategy:
matrix:
go: ["1.14"]
go: ["1.18"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: current
- run: make ui
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v2.3.0
uses: golangci/golangci-lint-action@v3
with:
# the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.35.2
go-test:
version: v1.46.2

test:
strategy:
matrix:
go: ["1.14", "1.13", "1.12"]
go: ["1.18", "1.17", "1.16"]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-go@v2
- uses: actions/setup-node@v3
with:
node-version: current
- run: make ui
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- run: go test -race ./...
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
/db
/data
/.idea
dist/
config.json
/ui/.build
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
ui/assets/js/JSXTransformer-0.12.2.js
ui/assets/js/jquery-2.1.3.min.js
ui/assets/js/react-0.12.2.min.js
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ your changes (you can read more about pull requests on GitHub [here](http://help

When you send a pull request, please be sure to include:
- unit tests that validate that your changes work as expected (both for Go and for JavaScript changes)
- consice code comments (it can help to imagine that you're explaining your code to a total stranger)
- an examples, if necessary.
- concise code comments (it can help to imagine that you're explaining your code to a total stranger)
- one or more examples, if necessary.

## More
Hound is a volunteer effort. We do our best to try and review contributions in a timely manner. Any code or feedback
Expand Down
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
FROM alpine:3.11.7
FROM alpine:3.16

ENV GOPATH /go

COPY . /go/src/github.com/hound-search/hound
COPY . /src

RUN apk update \
&& apk add go git subversion libc-dev mercurial bzr openssh tini \
&& cd /go/src/github.com/hound-search/hound \
&& go mod download \
&& go install github.com/hound-search/hound/cmds/houndd \
&& apk del go \
&& rm -f /var/cache/apk/* \
&& rm -rf /go/src /go/pkg
&& apk add go git subversion libc-dev mercurial breezy openssh tini build-base npm rsync \
&& cd /src \
&& make \
&& cp .build/bin/houndd /bin \
&& rm -r .build \
&& apk del go build-base rsync npm \
&& rm -f /var/cache/apk/*

VOLUME ["/data"]

EXPOSE 6080

ENTRYPOINT ["/sbin/tini", "--", "/go/bin/houndd", "-conf", "/data/config.json"]
ENTRYPOINT ["/sbin/tini", "--", "/bin/houndd", "-conf", "/data/config.json"]
38 changes: 19 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
CMDS := $(GOPATH)/bin/houndd $(GOPATH)/bin/hound
CMDS := .build/bin/houndd .build/bin/hound

SRCS := $(shell find . -type f -name '*.go')
UI := $(shell find ui/assets -type f)

WEBPACK_ARGS := -p
WEBPACK_ARGS := --mode production
ifdef DEBUG
WEBPACK_ARGS := -d
WEBPACK_ARGS := --mode development
endif

ALL: $(CMDS)

ui: ui/bindata.go
ui: ui/.build/ui

node_modules:
# the mtime is updated on a directory when its files change so it's better
# to rely on a single file to represent the presence of node_modules.
node_modules/build:
npm install
date -u >> $@

$(GOPATH)/bin/houndd: ui/bindata.go $(SRCS)
go install github.com/hound-search/hound/cmds/houndd
.build/bin/houndd: ui/.build/ui $(SRCS)
go build -o $@ github.com/hound-search/hound/cmds/houndd

$(GOPATH)/bin/hound: ui/bindata.go $(SRCS)
go install github.com/hound-search/hound/cmds/hound
.build/bin/hound: $(SRCS)
go build -o $@ github.com/hound-search/hound/cmds/hound

.build/bin/go-bindata:
GOPATH=`pwd`/.build go install github.com/go-bindata/go-bindata/...

ui/bindata.go: .build/bin/go-bindata node_modules $(wildcard ui/assets/**/*)
rsync -r ui/assets/* .build/ui
ui/.build/ui: node_modules/build $(UI)
mkdir -p ui/.build/ui
cp -r ui/assets/* ui/.build/ui
npx webpack $(WEBPACK_ARGS)
$< -o $@ -pkg ui -prefix .build/ui -nomemcopy .build/ui/...

dev: ALL
npm install
dev: node_modules/build

test:
go test github.com/hound-search/hound/...
npm test

lint:
export GO111MODULE=on
go install github.com/golangci/golangci-lint/cmd/golangci-lint
go get github.com/golangci/golangci-lint/cmd/golangci-lint
export GOPATH=/tmp/gopath
export PATH=$GOPATH/bin:$PATH
golangci-lint run ./...

clean:
rm -rf .build node_modules
rm -rf .build ui/.build node_modules
Loading

0 comments on commit bd3eb35

Please sign in to comment.