Skip to content

Commit

Permalink
Update deps, modernise (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
dim authored May 25, 2021
1 parent 45741bb commit b650f54
Show file tree
Hide file tree
Showing 14 changed files with 709 additions and 331 deletions.
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
root = true

[*]
indent_style = space
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{go,proto}]
indent_style = tab
[*.{yml,yaml,md}]
indent_style = space
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: release
on:
push:
branches:
- "release/**"
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist --skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
unit:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.15.x, 1.16.x]
services:
postgres:
image: postgres
ports:
- 5432/tcp
env:
POSTGRES_PASSWORD: s3cret
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Fetch staticcheck
uses: engineerd/[email protected]
with:
name: staticcheck
fromGitHubReleases: true
repo: dominikh/go-tools
version: latest
urlTemplate: "https://github.com/dominikh/go-tools/releases/download/2020.2.3/staticcheck_linux_amd64.tar.gz"
pathInArchive: staticcheck/staticcheck
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Run tests
run: make test
env:
DATABASE_DSN: postgresql://postgres:s3cret@localhost:${{ job.services.postgres.ports[5432] }}/postgres?sslmode=disable
- name: Run staticcheck
run: make staticcheck
88 changes: 62 additions & 26 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,67 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# you may remove this if you don't use vgo
- go mod download
# you may remove this if you don't need go generate
# - go generate ./...
project_name: accord
builds:
- id: "server"
binary: "accord-server"
main: "./cmd/accord-server/main.go"
goos:
- darwin
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
- binary: accord-server
dir: cmd/accord-server
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
goarch:
- 386
- amd64
- arm
- arm64
flags:
- -trimpath
ldflags:
- -s -w
archives:
- name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
checksum:
name_template: 'checksums.txt'
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
replacements:
386: i386
amd64: x86_64
dockers:
- goarch: amd64
image_templates:
- blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64
use_buildx: true
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--platform=linux/amd64"
- goarch: arm64
image_templates:
- blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm64
use_buildx: true
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--platform=linux/arm64"
docker_manifests:
- name_template: "blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}.{{ .Patch }}"
image_templates:
- "blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64"
- "blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm64"
- name_template: "blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}"
image_templates:
- "blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64"
- "blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm64"
- name_template: "blacksquaremedia/accord:latest"
image_templates:
- "blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-amd64"
- "blacksquaremedia/accord:{{ .Major }}.{{ .Minor }}.{{ .Patch }}-arm64"
snapshot:
name_template: "{{ .Tag }}-next"
checksum:
name_template: "checksums.txt"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
skip: true
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM gcr.io/distroless/base-debian10:nonroot
COPY accord-server /usr/local/bin/
ENTRYPOINT ["accord-server"]
EXPOSE 7475
Loading

0 comments on commit b650f54

Please sign in to comment.