Skip to content

Commit

Permalink
Merge branch 'master' into fix-461-arc-fee-quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-4chain authored Jan 12, 2024
2 parents 3644e3b + 85cbe7a commit b5f0a56
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 161 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ node_modules/
vendor/

# Binaries for programs and plugins
dist/
gin-bin
*.exe
*.exe~
Expand Down
45 changes: 17 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
# From: https://goreleaser.com/ci/actions/#usage
name: release
name: Release
permissions:
contents: write
packages: write

env:
GO111MODULE: on

on:
push:
tags:
- '*'

permissions:
contents: write
- 'v*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5.0.0
with:
distribution: goreleaser
version: latest
args: release --rm-dist --debug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Syndicate to GoDocs
run: make godocs
release_default:
uses: bactions/workflows/.github/workflows/release-go-server.yml@main
with:
version: ${{ github.ref_name }}
os: linux
go_main_file: cmd/server/main.go
cgo_enabled: true
release_binaries: false
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
78 changes: 0 additions & 78 deletions .goreleaser.yml

This file was deleted.

12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,6 @@ This repository was created using [MrZ's `go-template`](https://github.com/mrz18

Releases are automatically created when you create a new [git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging)!

If you want to manually make releases, please install GoReleaser:

[goreleaser](https://github.com/goreleaser/goreleaser) for easy binary or library deployment to GitHub and can be installed:

- **using make:** `make install-releaser`
- **using brew:** `brew install goreleaser`

The [.goreleaser.yml](.goreleaser.yml) file is used to configure [goreleaser](https://github.com/goreleaser/goreleaser).

<br/>

### Automatic Releases on Tag Creation (recommended)

Automatic releases via [GitHub Actions](.github/workflows/release.yml) from creating a new tag:
Expand Down Expand Up @@ -326,6 +315,7 @@ There are two way of running this script:
-b, --background Whether the bux-server should be run in background - true/false
-x, --xpub Define admin xPub
-l, --load Load .env.config file and run bux-server with its settings
-rb --rebuild Rebuild docker images before running
```

```bash
Expand Down
19 changes: 9 additions & 10 deletions actions/base/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ type Action struct {

// RegisterRoutes register all the package specific routes
func RegisterRoutes(router *apirouter.Router, appConfig *config.AppConfig, services *config.AppServices) {

// Load the actions and set the services
action := &Action{actions.Action{AppConfig: appConfig, Services: services}}

Expand All @@ -32,15 +31,15 @@ func RegisterRoutes(router *apirouter.Router, appConfig *config.AppConfig, servi

// Debugging (shows all the Go profiler information)
if action.AppConfig.DebugProfiling {
router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/", pprof.Index)
router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/cmdline", pprof.Cmdline)
router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/profile", pprof.Profile)
router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/symbol", pprof.Symbol)
router.HTTPRouter.HandlerFunc(http.MethodPatch, "/debug/pprof/trace", pprof.Trace)
router.HTTPRouter.Handler(http.MethodPatch, "/debug/pprof/goroutine", pprof.Handler("goroutine"))
router.HTTPRouter.Handler(http.MethodPatch, "/debug/pprof/heap", pprof.Handler("heap"))
router.HTTPRouter.Handler(http.MethodPatch, "/debug/pprof/threadcreate", pprof.Handler("threadcreate"))
router.HTTPRouter.Handler(http.MethodPatch, "/debug/pprof/block", pprof.Handler("block"))
router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/", pprof.Index)
router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/cmdline", pprof.Cmdline)
router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/profile", pprof.Profile)
router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/symbol", pprof.Symbol)
router.HTTPRouter.HandlerFunc(http.MethodGet, "/debug/pprof/trace", pprof.Trace)
router.HTTPRouter.Handler(http.MethodGet, "/debug/pprof/goroutine", pprof.Handler("goroutine"))
router.HTTPRouter.Handler(http.MethodGet, "/debug/pprof/heap", pprof.Handler("heap"))
router.HTTPRouter.Handler(http.MethodGet, "/debug/pprof/threadcreate", pprof.Handler("threadcreate"))
router.HTTPRouter.Handler(http.MethodGet, "/debug/pprof/block", pprof.Handler("block"))
}

// Set the 404 handler (any request not detected)
Expand Down
20 changes: 9 additions & 11 deletions actions/base/routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
// TestBaseRegisterRoutes will test routes
func (ts *TestSuite) TestBaseRegisterRoutes() {
ts.T().Run("test routes", func(t *testing.T) {

// index
handle, _, _ := ts.Router.HTTPRouter.Lookup(http.MethodGet, "/")
assert.NotNil(t, handle)
Expand All @@ -38,32 +37,31 @@ func (ts *TestSuite) TestBaseRegisterRoutes() {
})

ts.T().Run("test debug profile routes", func(t *testing.T) {

handle, _, _ := ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/")
handle, _, _ := ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/")
assert.NotNil(t, handle)

handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/cmdline")
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/cmdline")
assert.NotNil(t, handle)

handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/profile")
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/profile")
assert.NotNil(t, handle)

handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/symbol")
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/symbol")
assert.NotNil(t, handle)

handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/trace")
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/trace")
assert.NotNil(t, handle)

handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/goroutine")
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/goroutine")
assert.NotNil(t, handle)

handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/heap")
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/heap")
assert.NotNil(t, handle)

handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/threadcreate")
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/threadcreate")
assert.NotNil(t, handle)

handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodPatch, "/debug/pprof/block")
handle, _, _ = ts.Router.HTTPRouter.Lookup(http.MethodGet, "/debug/pprof/block")
assert.NotNil(t, handle)
})
}
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

// main method starts everything for the BUX Server
// @title BUX: Server
// @version v0.8.0
// @version v0.10.0
// @securityDefinitions.apikey bux-auth-xpub
// @in header
// @name bux-auth-xpub
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
APIVersion = "v1"
DefaultNewRelicShutdown = 10 * time.Second
HealthRequestPath = "health"
Version = "v0.5.16"
Version = "v0.10.0"
ConfigFilePathKey = "config_file"
DefaultConfigFilePath = "config.yaml"
ConfigEnvPrefix = "BUX_"
Expand Down
23 changes: 10 additions & 13 deletions docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"info": {
"title": "BUX: Server",
"contact": {},
"version": "v0.5.14"
"version": "v0.10.0"
},
"paths": {
"/v1/access-key": {
Expand Down Expand Up @@ -1871,4 +1871,4 @@
"in": "header"
}
}
}
}
2 changes: 1 addition & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
info:
contact: {}
title: 'BUX: Server'
version: v0.5.14
version: v0.10.0
paths:
/v1/access-key:
delete:
Expand Down
17 changes: 17 additions & 0 deletions release/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9-minimal

WORKDIR /app

ARG project_name
ARG TARGETPLATFORM
ARG version
ARG tag
ENV APP_BINARY=${project_name}
ENV VERSION=${version:-develop}
ENV TAG=${tag:-master}
COPY ./release/entrypoint.sh .
RUN chmod +x entrypoint.sh

COPY ./dist/$TARGETPLATFORM/$APP_BINARY .

ENTRYPOINT ["./entrypoint.sh"]
2 changes: 2 additions & 0 deletions release/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec "./$APP_BINARY" "$@"
Loading

0 comments on commit b5f0a56

Please sign in to comment.