Skip to content

Commit 9b1024f

Browse files
pparshinPavel Parshin
authored andcommitted
integrate with goreleaser (#17)
1 parent 0eddddb commit 9b1024f

File tree

9 files changed

+128
-4
lines changed

9 files changed

+128
-4
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
jobs:
1414
golangci:
1515
name: lint
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-20.04
1717
steps:
1818
- uses: actions/checkout@v2
1919
- name: golangci-lint

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
-
13+
name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
-
18+
name: Set up Go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: 1.14
22+
-
23+
name: Run GoReleaser
24+
uses: goreleaser/goreleaser-action@v2
25+
with:
26+
version: latest
27+
args: release --rm-dist
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.so
66
*.dylib
77
bin/
8+
dist/
89

910
# Test binary, built with `go test -c`
1011
*.test

.goreleaser.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
5+
project_name: mysql-tarantool-replicator
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
main: ./cmd/replicator/main.go
11+
ldflags:
12+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildDate={{.Date}}
13+
goarch:
14+
- amd64
15+
16+
archives:
17+
- files:
18+
- LICENSE
19+
- README.md
20+
- config/*
21+
22+
checksum:
23+
name_template: 'checksums.txt'
24+
# Algorithm to be used.
25+
# Accepted options are sha256, sha512, sha1, crc32, md5, sha224 and sha384.
26+
# Default is sha256.
27+
algorithm: sha256
28+
29+
snapshot:
30+
name_template: "{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}"
31+
32+
changelog:
33+
skip: true
34+
35+
nfpms:
36+
- id: default
37+
package_name: mysql-tarantool-replicator
38+
39+
maintainer: Pavel Parshin <parshin.pn@gmail.com>
40+
homepage: https://github.com/pparshin/go-mysql-tarantool
41+
description: MySQL - Tarantool replicator
42+
license: MIT
43+
44+
formats:
45+
- deb
46+
- rpm
47+
48+
dependencies: ~
49+
recommends:
50+
- mysql-client
51+
suggests: ~
52+
conflicts: ~
53+
54+
bindir: /usr/local/bin
55+
56+
epoch: 1
57+
release: 1
58+
59+
scripts:
60+
postinstall: "scripts/postinstall.sh"
61+
preremove: "scripts/preremove.sh"
62+
63+
files:
64+
"scripts/etc/systemd/**": "/etc/systemd/system"
65+
66+
config_files:
67+
"config/replicator.conf.yml": "/etc/mysql-tarantool/conf.yml"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ lint:
1616

1717
.PHONY: run
1818
run: build
19-
bin/${BINARY} -config=configs/dev.yml
19+
bin/${BINARY} -config=config/replicator.conf.yml
2020

2121
.PHONY: run_short_tests
2222
run_short_tests:

configs/example.yml renamed to config/replicator.conf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
app:
22
listen_addr: ':8080'
3-
data_file: '/etc/mysql-tarantool-replicator/state.info'
3+
data_file: '/etc/mysql-tarantool/state.info'
44
logging:
55
level: 'debug'
66
syslog_enabled: false
77
file_enabled: true
8-
file_name: '/tmp/mysql-tarantool-repl.log'
8+
file_name: '/var/log/mysql-tarantool-replicator.log'
99
file_max_size: 256
1010
file_max_backups: 3
1111
file_max_age: 5
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=mysql-tarantool-replicator: MySQL binlog replication to Tarantool.
3+
Documentation=https://github.com/pparshin/go-mysql-tarantool
4+
After=syslog.target network.target
5+
6+
[Service]
7+
Type=simple
8+
WorkingDirectory=/usr/local/bin
9+
ExecStart=/usr/local/bin/mysql-tarantool-replicator -config /etc/mysql-tarantool/conf.yml
10+
TimeoutSec=30
11+
12+
[Install]
13+
WantedBy=multi-user.target

scripts/postinstall.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
systemctl --system daemon-reload >/dev/null || true
4+
systemctl enable mysql-tarantool-replicator.service >/dev/null || true
5+
6+
deb_systemctl=$(command -v deb-systemd-invoke || echo systemctl)
7+
${deb_systemctl} restart mysql-tarantool-replicator.service >/dev/null || true

scripts/preremove.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
deb_systemctl=$(command -v deb-systemd-invoke || echo systemctl)
4+
${deb_systemctl} stop mysql-tarantool-replicator.service >/dev/null || true
5+
6+
systemctl disable mysql-tarantool-replicator.service >/dev/null || true
7+
systemctl --system daemon-reload >/dev/null || true

0 commit comments

Comments
 (0)