Skip to content

Commit bd3eb35

Browse files
authored
Merge pull request #5 from EasyPost/new_hound2
Pull forward custom hound fork
2 parents 6480072 + 9ae612e commit bd3eb35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+17246
-10192
lines changed

.dockerignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/.vagrant
2+
/node_modules
3+
.DS_Store
4+
*.exe
5+
/db
6+
/data
7+
/.idea
8+
dist/
9+
config.json

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ui/bindata.go linguist-generated=true

.github/PULL_REQUEST_TEMPLATE.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
Please make sure to read the Contributing Guidelines:
3+
https://github.com/hound-search/hound/blob/main/CONTRIBUTING.md
4+
-->
5+
6+
<!-- PULL REQUEST TEMPLATE -->
7+
<!-- (Update "[ ]" to "[x]" to check a box) -->
8+
9+
**What kind of change does this PR introduce?** (check at least one)
10+
11+
- [ ] Bugfix
12+
- [ ] Feature
13+
- [ ] Code style update
14+
- [ ] Refactor
15+
- [ ] Build-related changes
16+
- [ ] Other, please describe:
17+
18+
**The PR fulfills these requirements:**
19+
- [ ] All tests are passing?
20+
- [ ] New/updated tests are included?
21+
- [ ] If any static assets have been updated, has ui/bindata.go been regenerated?
22+
- [ ] Are there doc blocks for functions that I updated/created?
23+
24+
If adding a **new feature**, the PR's description includes:
25+
- [ ] 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)
26+
27+
**Other information:**

.github/workflows/go.yaml

+67-17
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,97 @@
1-
on: [push]
1+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
2+
on:
3+
# Run CI when pushing to main
4+
push:
5+
branches: [ main ]
6+
# Run CI for PRs to main and staging
7+
pull_request:
8+
branches: [ main ]
9+
workflow_dispatch:
210
jobs:
3-
go-build:
11+
build:
412
runs-on: ubuntu-latest
513
strategy:
614
matrix:
7-
go: ["1.14", "1.13", "1.12"]
15+
go: ["1.18", "1.17", "1.16"]
816
steps:
917
- uses: actions/[email protected]
10-
- uses: actions/setup-go@v2
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: current
21+
- uses: actions/setup-go@v3
1122
with:
1223
go-version: ${{ matrix.go }}
13-
- run: go build -x -work ./cmds/...
14-
node-build:
24+
- run: make
25+
docker-build:
26+
name: Create docker image
1527
runs-on: ubuntu-latest
1628
steps:
1729
- uses: actions/[email protected]
18-
- uses: actions/setup-node@v1
30+
- name: Prepare
31+
id: prep
32+
run: |
33+
DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/hound
34+
VERSION=latest
35+
if [[ $GITHUB_REF == refs/tags/* ]]; then
36+
VERSION=${GITHUB_REF#refs/tags/v}
37+
fi
38+
TAGS="${DOCKER_IMAGE}:${VERSION}"
39+
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
40+
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
41+
fi
42+
echo ::set-output name=tags::${TAGS}
43+
- name: Set up QEMU
44+
uses: docker/setup-qemu-action@v1
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v1
47+
- name: Login to GitHub Packages Docker Registry
48+
uses: docker/login-action@v1
49+
with:
50+
registry: ghcr.io
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
53+
- name: Push to GitHub Packages
54+
uses: docker/build-push-action@v2
1955
with:
20-
node-version: "10.x"
21-
- run: npm install
56+
context: .
57+
platforms: linux/amd64,linux/arm64
58+
file: ./Dockerfile
59+
push: true
60+
tags: ${{ steps.prep.outputs.tags }}
2261
golangci:
2362
name: lint
2463
strategy:
2564
matrix:
26-
go: ["1.14"]
65+
go: ["1.18"]
2766
os: [ubuntu-latest]
2867
runs-on: ${{ matrix.os }}
2968
steps:
30-
- uses: actions/[email protected]
69+
- uses: actions/checkout@v3
70+
- uses: actions/setup-node@v3
71+
with:
72+
node-version: current
73+
- run: make ui
74+
- uses: actions/setup-go@v3
75+
with:
76+
go-version: ${{ matrix.go }}
3177
- name: golangci-lint
32-
uses: golangci/golangci-lint-action@v2.3.0
78+
uses: golangci/golangci-lint-action@v3
3379
with:
34-
# the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
35-
version: v1.35.2
36-
go-test:
80+
version: v1.46.2
81+
82+
test:
3783
strategy:
3884
matrix:
39-
go: ["1.14", "1.13", "1.12"]
85+
go: ["1.18", "1.17", "1.16"]
4086
os: [windows-latest, ubuntu-latest]
4187
runs-on: ${{ matrix.os }}
4288
steps:
4389
- uses: actions/[email protected]
44-
- uses: actions/setup-go@v2
90+
- uses: actions/setup-node@v3
91+
with:
92+
node-version: current
93+
- run: make ui
94+
- uses: actions/setup-go@v3
4595
with:
4696
go-version: ${{ matrix.go }}
4797
- run: go test -race ./...

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
/db
77
/data
88
/.idea
9+
dist/
10+
config.json
11+
/ui/.build

.prettierignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
ui/assets/js/JSXTransformer-0.12.2.js
2-
ui/assets/js/jquery-2.1.3.min.js
32
ui/assets/js/react-0.12.2.min.js

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ your changes (you can read more about pull requests on GitHub [here](http://help
1111

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

1717
## More
1818
Hound is a volunteer effort. We do our best to try and review contributions in a timely manner. Any code or feedback

Dockerfile

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
FROM alpine:3.11.7
1+
FROM alpine:3.16
22

33
ENV GOPATH /go
44

5-
COPY . /go/src/github.com/hound-search/hound
5+
COPY . /src
66

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

1616
VOLUME ["/data"]
1717

1818
EXPOSE 6080
1919

20-
ENTRYPOINT ["/sbin/tini", "--", "/go/bin/houndd", "-conf", "/data/config.json"]
20+
ENTRYPOINT ["/sbin/tini", "--", "/bin/houndd", "-conf", "/data/config.json"]

Makefile

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
CMDS := $(GOPATH)/bin/houndd $(GOPATH)/bin/hound
1+
CMDS := .build/bin/houndd .build/bin/hound
22

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

5-
WEBPACK_ARGS := -p
6+
WEBPACK_ARGS := --mode production
67
ifdef DEBUG
7-
WEBPACK_ARGS := -d
8+
WEBPACK_ARGS := --mode development
89
endif
910

1011
ALL: $(CMDS)
1112

12-
ui: ui/bindata.go
13+
ui: ui/.build/ui
1314

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

17-
$(GOPATH)/bin/houndd: ui/bindata.go $(SRCS)
18-
go install github.com/hound-search/hound/cmds/houndd
21+
.build/bin/houndd: ui/.build/ui $(SRCS)
22+
go build -o $@ github.com/hound-search/hound/cmds/houndd
1923

20-
$(GOPATH)/bin/hound: ui/bindata.go $(SRCS)
21-
go install github.com/hound-search/hound/cmds/hound
24+
.build/bin/hound: $(SRCS)
25+
go build -o $@ github.com/hound-search/hound/cmds/hound
2226

23-
.build/bin/go-bindata:
24-
GOPATH=`pwd`/.build go install github.com/go-bindata/go-bindata/...
25-
26-
ui/bindata.go: .build/bin/go-bindata node_modules $(wildcard ui/assets/**/*)
27-
rsync -r ui/assets/* .build/ui
27+
ui/.build/ui: node_modules/build $(UI)
28+
mkdir -p ui/.build/ui
29+
cp -r ui/assets/* ui/.build/ui
2830
npx webpack $(WEBPACK_ARGS)
29-
$< -o $@ -pkg ui -prefix .build/ui -nomemcopy .build/ui/...
3031

31-
dev: ALL
32-
npm install
32+
dev: node_modules/build
3333

3434
test:
3535
go test github.com/hound-search/hound/...
3636
npm test
3737

3838
lint:
3939
export GO111MODULE=on
40-
go install github.com/golangci/golangci-lint/cmd/golangci-lint
40+
go get github.com/golangci/golangci-lint/cmd/golangci-lint
4141
export GOPATH=/tmp/gopath
4242
export PATH=$GOPATH/bin:$PATH
4343
golangci-lint run ./...
4444

4545
clean:
46-
rm -rf .build node_modules
46+
rm -rf .build ui/.build node_modules

0 commit comments

Comments
 (0)