Skip to content

Commit

Permalink
update public repo to current state of gloomberg
Browse files Browse the repository at this point in the history
  • Loading branch information
benleb committed Apr 13, 2023
1 parent 1794f54 commit 917d5e2
Show file tree
Hide file tree
Showing 170 changed files with 18,292 additions and 372,301 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:

# maintain dependencies for GitHub actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

# maintain dependencies for Go modules
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
27 changes: 11 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: gloomberg build
name: build

on: [push, pull_request, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
# runs-on: self-hosted
permissions: { contents: write, packages: write }

env:
REGISTRY: ghcr.io
Expand All @@ -16,39 +15,35 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
with: { fetch-depth: 0 }

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ">=1.19.0"
check-latest: true
# cache: true
uses: actions/setup-go@v4
with: { cache: true, check-latest: true, go-version-file: "go.mod" }

- name: Run GoReleaser (snapshot)
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@v4
if: "!startsWith(github.ref, 'refs/tags/')"
with:
version: latest
args: build --rm-dist --snapshot
args: build --clean --snapshot
env:
REGISTRY: ${{ env.REGISTRY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser (release)
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@v4
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
args: release --clean
env:
REGISTRY: ${{ env.REGISTRY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: docs

on:
push: { branches: [master, main] }
workflow_dispatch:

permissions: { contents: write }

jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.repository.fork == false

env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with: { python-version: 3.x }

- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git

- run: mkdocs gh-deploy --force
24 changes: 24 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: golangci-lint

on:
pull_request:
push: { branches: [master, main], tags: [v*] }
workflow_dispatch:

# Optional: allow read access to pull request. Use with `only-new-issues` option.
permissions: { contents: read } # pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with: { cache: true, check-latest: true, go-version-file: "go.mod" }

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with: { version: latest }
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@ dist/

# misc
internal/assets
metadata/
dev.md
*.sqlite
.idea

# testing
cmd/rawtx.go
ranks/

# not ready for prime time
deployment/
30 changes: 30 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
run:
timeout: 3m

# never fail
issues-exit-code: 0

linters:
enable-all: true
disable:
- gochecknoglobals
- gomnd
- lll
- funlen
- exhaustivestruct
- exhaustruct
- tagliatelle
- forbidigo
- varnamelen
- wrapcheck
- nestif
- gocognit
- cyclop
- gocyclo
- ireturn
- gochecknoinits
- goerr113
- maligned
- exhaustive
- interfacer
- nilnil
105 changes: 33 additions & 72 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# documentation at https://goreleaser.com
project_name: gloomberg

# This is an example .goreleaser.yml file with some sensible defaults.
Expand All @@ -13,21 +12,10 @@ before:
# - oapi-codegen -package ensmetadata -old-config-style -generate types,client,spec internal/assets/ens_metadata_service_0.0.1-alpha.1.yaml > internal/ensmetadata/ensmetadata.go
builds:
- binary: gloomberg
env:
- CGO_ENABLED=0
flags:
- -trimpath
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64

ignore:
- goos: windows
goarch: arm64
env: ["CGO_ENABLED=0"]
flags: ["-trimpath"]
goos: [linux, darwin]
goarch: [amd64, arm64]

# Set the modified timestamp on the output binary, typically
# you would do this to ensure a build was reproducible. Pass
Expand All @@ -50,70 +38,43 @@ universal_binaries:
replace: true

dockers:
- image_templates: ["{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}-amd64", "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest-amd64"]
use: buildx
dockerfile: .github/run.Dockerfile
build_flag_templates: ["--platform=linux/amd64"]
- image_templates: ["{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}-arm64v8", "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest-arm64v8"]
use: buildx
goarch: arm64
dockerfile: .github/run.Dockerfile
build_flag_templates: ["--platform=linux/arm64/v8"]
- image_templates: ["{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}-amd64", "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest-amd64"]
use: buildx
dockerfile: .github/run.Dockerfile
build_flag_templates: ["--platform=linux/amd64"]
- image_templates: ["{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}-arm64v8", "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest-arm64v8"]
use: buildx
goarch: arm64
dockerfile: .github/run.Dockerfile
build_flag_templates: ["--platform=linux/arm64/v8"]

docker_manifests:
- name_template: "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}"
image_templates: ["{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}-amd64", "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}-arm64v8"]
- name_template: "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest"
image_templates: ["{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest-amd64", "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest-arm64v8"]
- name_template: "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}"
image_templates: ["{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}-amd64", "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:{{ .Version }}-arm64v8"]
- name_template: "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest"
image_templates: ["{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest-amd64", "{{ .Env.REGISTRY }}/benleb/{{ .ProjectName }}:latest-arm64v8"]

kos:
- repository: "ghcr.io/benleb/gloomberg"
bare: true
preserve_import_paths: false
tags: ["{{.Tag}}", latest]
platforms: [linux/amd64, linux/arm64]

# config the checksum filename
# https://goreleaser.com/customization/checksum
checksum:
name_template: "checksums.txt"
# config the checksum filename | https://goreleaser.com/customization/checksum
checksum: { name_template: "checksums.txt" }

snapshot:
# name_template: "{{ incpatch .Version }}-dev"
name_template: "{{ .Summary }}"
snapshot: { name_template: "{{ .Summary }}" }

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
changelog: { sort: asc, filters: { exclude: ["^docs:", "^test:"] } }

announce:
telegram:
# Whether its enabled or not.
# Defaults to false.
enabled: false
# Whether its enabled or not. Defaults to false.
enabled: true

# Integer representation of your channel
chat_id: -575512868

# Message template to use while publishing.
# Defaults to `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}`
message_template: "💸 🚀 🙌 {{ .ProjectName }} {{.Tag}} is out! → {{ .ReleaseURL }} 🙌 🚀 💸"

# gomod:
# # Proxy a module from proxy.golang.org, making the builds verifiable.
# # This will only be effective if running against a tag. Snapshots will ignore this setting.
# # Notice: for this to work your `build.main` must be a package, not a `.go` file.
# #
# # Default is false.
# proxy: true

# # If proxy is true, use these environment variables when running `go mod` commands (namely, `go mod tidy`).
# # Defaults to `os.Environ()`.
# env:
# - GOPROXY=https://proxy.golang.org,direct
# - GOSUMDB=sum.golang.org
# # - GOPRIVATE=example.com/blah

# # Sets the `-mod` flag value.
# # Defaults to empty.
# mod: mod
chat_id: -1001808788625

# # Which Go binary to use.
# # Defaults to `go`.
# gobinary: go1.18
# Message template to use while publishing | `{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}`
message_template: '🚀🙌 {{ .ProjectName }} *{{ replace .Tag "." "\\." }}* is out 🙌🚀 → {{ replace .ReleaseURL "." "\\." }}'
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: ^mkdocs\.yml$
# - id: check-added-large-files
# exclude: ^mkdocs\.yml$

- repo: https://github.com/golangci/golangci-lint
rev: v1.50.1
hooks:
- id: golangci-lint
args: ["--no-config", "--fast"]
Loading

0 comments on commit 917d5e2

Please sign in to comment.