Skip to content

Commit 9df5f29

Browse files
committed
Refactors into single binary and adds releaser automation.
1 parent 76e9c70 commit 9df5f29

30 files changed

+1067
-129
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: Bug
6+
assignees: 'ackleymi'
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior.
15+
Or even better, a unit test or reproducer.
16+
17+
**Expected behavior**
18+
A clear and concise description of what you expected to happen.
19+
20+
**system information:**
21+
- OS: [e.g. Linux]
22+
- Go version [e.g. Go 1.16.5]
23+
- QF/Go Version [e.g. v0.6.0]
24+
25+
**Additional context**
26+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Discussions
4+
url: https://github.com/quickfixgo/quickfix/discussions
5+
about: Please ask usage related questions here.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: Feature
6+
assignees: 'ackleymi'
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.
File renamed without changes.

.github/workflows/goreleaser.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.16
20+
- name: Set up Environment
21+
run: |
22+
echo "GOVERSION=$(go version|awk '{print $3}')" >> $GITHUB_ENV
23+
- name: Set up Snapcraft
24+
# HACK: the mkdirs are a hack for https://bugs.launchpad.net/snapcraft/+bug/1889741
25+
run: |
26+
sudo snap install --classic snapcraft
27+
mkdir -p $HOME/.cache/snapcraft/download
28+
mkdir -p $HOME/.cache/snapcraft/stage-packages
29+
- name: Cache Go modules
30+
uses: actions/[email protected]
31+
with:
32+
path: ~/go/pkg/mod
33+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
34+
restore-keys: |
35+
${{ runner.os }}-go-
36+
- name: Snapcraft Login
37+
if: success() && startsWith(github.ref, 'refs/tags/')
38+
env:
39+
SNAPCRAFT_TOKEN: ${{ secrets.SNAP_LOGIN_KEY }}
40+
run: |
41+
snapcraft login --with <(echo "$SNAPCRAFT_TOKEN")
42+
- name: Docker Login
43+
if: success()
44+
env:
45+
DOCKER_USERNAME: ${{ secrets.DOCKER_USER }}
46+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASS }}
47+
run: |
48+
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
49+
- name: Install GoReleaser
50+
uses: goreleaser/goreleaser-action@v2
51+
with:
52+
install-only: true
53+
- name: Run GoReleaser
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
56+
run: |
57+
if [[ $GITHUB_REF == refs/tags/* ]]
58+
then
59+
goreleaser release --rm-dist
60+
else
61+
goreleaser release --rm-dist --snapshot
62+
fi
63+
- name: Clear
64+
if: always()
65+
run: rm -f ${HOME}/.docker/config.json

.github/workflows/stale.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Mark stale issues and pull requests
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
7+
jobs:
8+
stale:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/stale@v1
14+
with:
15+
repo-token: ${{ secrets.GITHUB_TOKEN }}
16+
stale-issue-message: 'This issue is being marked as stale due to a long period of inactivity'
17+
stale-pr-message: 'This PR is being marked as stale due to a long period of inactivity'
18+
stale-issue-label: 'Stale'
19+
stale-pr-label: 'Stale'
20+
exempt-issue-label: 'Stale'
21+
exempt-pr-label: 'Stale'

.goreleaser.yml

+77-32
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,16 @@ builds:
1313
goarch: 386
1414
- goos: windows
1515
goarch: 386
16-
id: "executor"
17-
main: ./cmd/executor
18-
binary: executor
19-
- goos:
20-
- linux
21-
- darwin
22-
- windows
23-
ignore:
24-
- goos: linux
25-
goarch: 386
26-
- goos: darwin
27-
goarch: 386
28-
- goos: windows
29-
goarch: 386
30-
id: "tradeclient"
31-
main: ./cmd/tradeclient
32-
binary: tradeclient
33-
- goos:
34-
- linux
35-
- darwin
36-
- windows
37-
ignore:
38-
- goos: linux
39-
goarch: 386
40-
- goos: darwin
41-
goarch: 386
42-
- goos: windows
43-
goarch: 386
44-
id: "ordermatch"
45-
main: ./cmd/ordermatch
46-
binary: ordermatch
16+
id: "qf"
17+
binary: qf
18+
env:
19+
- CGO_ENABLED=0
20+
ldflags:
21+
- -s -X github.com/quickfixgo/examples/version.Version={{.Version}}
4722

4823
archives:
49-
- replacements:
24+
- name_template: "qf_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
25+
replacements:
5026
darwin: Darwin
5127
linux: Linux
5228
windows: Windows
@@ -61,3 +37,72 @@ changelog:
6137
exclude:
6238
- '^docs:'
6339
- '^test:'
40+
41+
brews:
42+
- name: qf
43+
tap:
44+
owner: quickfixgo
45+
name: homebrew-qf
46+
homepage: "https://github.com/quickfixgo/examples"
47+
description: "Example QuickFIX/Go Applications."
48+
install: |
49+
bin.install "qf"
50+
caveats: "Thanks for installing the Quickfix/Go examples"
51+
plist: |
52+
<?xml version="1.0" encoding="UTF-8"?>
53+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
54+
<plist version="1.0">
55+
<dict>
56+
<key>KeepAlive</key>
57+
<dict>
58+
<key>SuccessfulExit</key>
59+
<false/>
60+
</dict>
61+
<key>Label</key>
62+
<string>#{plist_name}</string>
63+
<key>RunAtLoad</key>
64+
<true/>
65+
<key>WorkingDirectory</key>
66+
<string>#{var}</string>
67+
<key>StandardErrorPath</key>
68+
<string>#{var}/log/qtrn.log</string>
69+
<key>StandardOutPath</key>
70+
<string>#{var}/log/qtrn.log</string>
71+
</dict>
72+
</plist>
73+
74+
dockers:
75+
- goos: linux
76+
goarch: amd64
77+
image_templates:
78+
- "quickfixgo/qf:latest"
79+
- "quickfixgo/qf:{{ .Tag }}"
80+
dockerfile: release.Dockerfile
81+
extra_files:
82+
- config
83+
build_flag_templates:
84+
- "--label=org.opencontainers.image.created={{.Date}}"
85+
- "--label=org.opencontainers.image.name=qf"
86+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
87+
- "--label=org.opencontainers.image.version={{.Version}}"
88+
89+
snapcrafts:
90+
- name_template: "qf_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
91+
name: quickfixgo-qf
92+
publish: true
93+
summary: Example QuickFIX/Go Applications.
94+
description: Example QuickFIX/Go Applications.
95+
grade: stable
96+
confinement: strict
97+
layout:
98+
/etc/qf:
99+
bind: $SNAP_DATA/etc
100+
scoop:
101+
name: qf
102+
bucket:
103+
owner: quickfixgo
104+
name: scoop-qf
105+
commit_msg_template: "Scoop manifest update for {{ .ProjectName }} version {{ .Tag }}"
106+
homepage: https://github.com/quickfixgo/examples
107+
description: Example QuickFIX/Go Applications.
108+
post_install: ["Write-Host 'Thanks for installing the Quickfix/Go examples'"]

Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM golang:alpine
2+
ADD config config
3+
ADD bin/qf /qf
4+
ENTRYPOINT ["/qf"]

Makefile

+4-9
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,17 @@ vet:
99
go vet ./...
1010

1111
build: clean
12-
go build -v -o ./bin/executor ./cmd/executor
13-
go build -v -o ./bin/ordermatch ./cmd/ordermatch
14-
go build -v -o ./bin/tradeclient ./cmd/tradeclient
12+
go build -v -o ./bin/qf
1513

1614
clean:
1715
rm -rf ./bin
1816
rm -rf ./tmp
17+
rm -rf ./dist
1918

2019
# Commands for docker images.
2120
# ----------------------------
2221
build-linux:
23-
GOOS=linux GOARCH=amd64 go build -v -o ./bin/executor ./cmd/executor
24-
GOOS=linux GOARCH=amd64 go build -v -o ./bin/ordermatch ./cmd/ordermatch
25-
GOOS=linux GOARCH=amd64 go build -v -o ./bin/tradeclient ./cmd/tradeclient
22+
GOOS=linux GOARCH=amd64 go build -v -o ./bin/qf .
2623

2724
build-docker: clean build-linux
28-
docker build -t quickfixgo/executor:latest -f ./cmd/executor/Dockerfile .
29-
docker build -t quickfixgo/ordermatch:latest -f ./cmd/ordermatch/Dockerfile .
30-
docker build -t quickfixgo/tradeclient:latest -f ./cmd/tradeclient/Dockerfile .
25+
docker build -t quickfixgo/qf:latest .

0 commit comments

Comments
 (0)