Skip to content

Refactors into single binary and adds releaser automation. #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: Bug
assignees: 'ackleymi'

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior.
Or even better, a unit test or reproducer.

**Expected behavior**
A clear and concise description of what you expected to happen.

**system information:**
- OS: [e.g. Linux]
- Go version [e.g. Go 1.16.5]
- QF/Go Version [e.g. v0.6.0]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discussions
url: https://github.com/quickfixgo/quickfix/discussions
about: Please ask usage related questions here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: Feature
assignees: 'ackleymi'

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
File renamed without changes.
65 changes: 65 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: goreleaser

on:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Set up Environment
run: |
echo "GOVERSION=$(go version|awk '{print $3}')" >> $GITHUB_ENV
- name: Set up Snapcraft
# HACK: the mkdirs are a hack for https://bugs.launchpad.net/snapcraft/+bug/1889741
run: |
sudo snap install --classic snapcraft
mkdir -p $HOME/.cache/snapcraft/download
mkdir -p $HOME/.cache/snapcraft/stage-packages
- name: Cache Go modules
uses: actions/cache@v2.1.4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Snapcraft Login
if: success() && startsWith(github.ref, 'refs/tags/')
env:
SNAPCRAFT_TOKEN: ${{ secrets.SNAP_LOGIN_KEY }}
run: |
snapcraft login --with <(echo "$SNAPCRAFT_TOKEN")
- name: Docker Login
if: success()
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASS }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
install-only: true
- name: Run GoReleaser
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
run: |
if [[ $GITHUB_REF == refs/tags/* ]]
then
goreleaser release --rm-dist
else
goreleaser release --rm-dist --snapshot
fi
- name: Clear
if: always()
run: rm -f ${HOME}/.docker/config.json
21 changes: 21 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Mark stale issues and pull requests

on:
schedule:
- cron: "0 0 * * *"

jobs:
stale:

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is being marked as stale due to a long period of inactivity'
stale-pr-message: 'This PR is being marked as stale due to a long period of inactivity'
stale-issue-label: 'Stale'
stale-pr-label: 'Stale'
exempt-issue-label: 'Stale'
exempt-pr-label: 'Stale'
109 changes: 77 additions & 32 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,16 @@ builds:
goarch: 386
- goos: windows
goarch: 386
id: "executor"
main: ./cmd/executor
binary: executor
- goos:
- linux
- darwin
- windows
ignore:
- goos: linux
goarch: 386
- goos: darwin
goarch: 386
- goos: windows
goarch: 386
id: "tradeclient"
main: ./cmd/tradeclient
binary: tradeclient
- goos:
- linux
- darwin
- windows
ignore:
- goos: linux
goarch: 386
- goos: darwin
goarch: 386
- goos: windows
goarch: 386
id: "ordermatch"
main: ./cmd/ordermatch
binary: ordermatch
id: "qf"
binary: qf
env:
- CGO_ENABLED=0
ldflags:
- -s -X github.com/quickfixgo/examples/version.Version={{.Version}}

archives:
- replacements:
- name_template: "qf_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
replacements:
darwin: Darwin
linux: Linux
windows: Windows
Expand All @@ -61,3 +37,72 @@ changelog:
exclude:
- '^docs:'
- '^test:'

brews:
- name: qf
tap:
owner: quickfixgo
name: homebrew-qf
homepage: "https://github.com/quickfixgo/examples"
description: "Example QuickFIX/Go Applications."
install: |
bin.install "qf"
caveats: "Thanks for installing the Quickfix/Go examples"
plist: |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{var}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/qtrn.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/qtrn.log</string>
</dict>
</plist>

dockers:
- goos: linux
goarch: amd64
image_templates:
- "quickfixgo/qf:latest"
- "quickfixgo/qf:{{ .Tag }}"
dockerfile: release.Dockerfile
extra_files:
- config
build_flag_templates:
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name=qf"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"

snapcrafts:
- name_template: "qf_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
name: quickfixgo-qf
publish: true
summary: Example QuickFIX/Go Applications.
description: Example QuickFIX/Go Applications.
grade: stable
confinement: strict
layout:
/etc/qf:
bind: $SNAP_DATA/etc
scoop:
name: qf
bucket:
owner: quickfixgo
name: scoop-qf
commit_msg_template: "Scoop manifest update for {{ .ProjectName }} version {{ .Tag }}"
homepage: https://github.com/quickfixgo/examples
description: Example QuickFIX/Go Applications.
post_install: ["Write-Host 'Thanks for installing the Quickfix/Go examples'"]
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM golang:alpine
ADD config config
ADD bin/qf /qf
ENTRYPOINT ["/qf"]
13 changes: 4 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,17 @@ vet:
go vet ./...

build: clean
go build -v -o ./bin/executor ./cmd/executor
go build -v -o ./bin/ordermatch ./cmd/ordermatch
go build -v -o ./bin/tradeclient ./cmd/tradeclient
go build -v -o ./bin/qf

clean:
rm -rf ./bin
rm -rf ./tmp
rm -rf ./dist

# Commands for docker images.
# ----------------------------
build-linux:
GOOS=linux GOARCH=amd64 go build -v -o ./bin/executor ./cmd/executor
GOOS=linux GOARCH=amd64 go build -v -o ./bin/ordermatch ./cmd/ordermatch
GOOS=linux GOARCH=amd64 go build -v -o ./bin/tradeclient ./cmd/tradeclient
GOOS=linux GOARCH=amd64 go build -v -o ./bin/qf .

build-docker: clean build-linux
docker build -t quickfixgo/executor:latest -f ./cmd/executor/Dockerfile .
docker build -t quickfixgo/ordermatch:latest -f ./cmd/ordermatch/Dockerfile .
docker build -t quickfixgo/tradeclient:latest -f ./cmd/tradeclient/Dockerfile .
docker build -t quickfixgo/qf:latest .
Loading