Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/gotd/td-0.1…
Browse files Browse the repository at this point in the history
…07.0
  • Loading branch information
teslashibe authored Aug 16, 2024
2 parents 858166b + f829163 commit 982eed2
Show file tree
Hide file tree
Showing 50 changed files with 1,946 additions and 1,599 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build-goreleaser-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: goreleaser-build-test

on:
push:
pull_request:

jobs:
goreleaser: # Add this new job for 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: 1.22
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: v2.1.0
args: build --clean --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: goreleaser

on:
push:
tags:
- 'v*' # Add this line to trigger the workflow on tag pushes that match 'v*'

permissions:
id-token: write
contents: read

jobs:
goreleaser: # Add this new job for 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: 1.22
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: v2.1.0
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: static check
on: pull_request

jobs:
imports:
name: Imports
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: check
uses: danhunsaker/[email protected]
with:
run: imports
token: ${{ secrets.GITHUB_TOKEN }}

errcheck:
name: Errcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: check
uses: danhunsaker/[email protected]
with:
run: errcheck
token: ${{ secrets.GITHUB_TOKEN }}

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: check
uses: danhunsaker/[email protected]
with:
run: lint
token: ${{ secrets.GITHUB_TOKEN }}

shadow:
name: Shadow
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: check
uses: danhunsaker/[email protected]
with:
run: shadow
token: ${{ secrets.GITHUB_TOKEN }}

staticcheck:
name: StaticCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: check
uses: danhunsaker/[email protected]
with:
run: staticcheck
token: ${{ secrets.GITHUB_TOKEN }}

sec:
name: Sec
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: check
uses: danhunsaker/[email protected]
with:
run: sec
token: ${{ secrets.GITHUB_TOKEN }}
flags: "-exclude=G104"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ docs/api-reference.md
transcription.txt
snippets.txt
.env copy

# Build result of goreleaser
dist/
38 changes: 38 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Make sure to check the documentation at http://goreleaser.com
version: 2
builds:
- main: ./cmd/masa-node/main.go
ldflags:
- -w -s
- -X github.com/masa-finance/masa-oracle/internal.Version={{.Tag}}
- -X github.com/masa-finance/masa-oracle/internal.Commit={{.Commit}}
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
- freebsd
goarch:
- amd64
- arm
- arm64
source:
enabled: true
name_template: '{{ .ProjectName }}-{{ .Tag }}-source'
archives:
# Default template uses underscores instead of -
- name_template: >-
{{ .ProjectName }}-{{ .Tag }}-
{{- if eq .Os "freebsd" }}FreeBSD
{{- else }}{{- title .Os }}{{end}}-
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{end}}
{{- if .Arm }}v{{ .Arm }}{{ end }}
checksum:
name_template: '{{ .ProjectName }}-{{ .Tag }}-checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
use: github-native
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ print-version:
@echo "Version: ${VERSION}"

build:
@go build -v -ldflags "-X github.com/masa-finance/masa-oracle/pkg/config.Version=${VERSION}" -o ./bin/masa-node ./cmd/masa-node
@go build -v -ldflags "-X github.com/masa-finance/masa-oracle/pkg/config.Version=${VERSION}" -o ./bin/masa-node-cli ./cmd/masa-node-cli
@go build -v -ldflags "-X github.com/masa-finance/masa-oracle/internal/versioning.ApplicationVersion=${VERSION}" -o ./bin/masa-node ./cmd/masa-node
@go build -v -ldflags "-X github.com/masa-finance/masa-oracle/internal/versioning.ApplicationVersion=${VERSION}" -o ./bin/masa-node-cli ./cmd/masa-node-cli

install:
@sh ./node_install.sh
Expand Down
5 changes: 3 additions & 2 deletions cmd/masa-node-cli/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import (
"strings"

"github.com/gdamore/tcell/v2"
"github.com/masa-finance/masa-oracle/pkg/config"
"github.com/masa-finance/masa-oracle/internal/versioning"

"github.com/rivo/tview"
)

Expand Down Expand Up @@ -125,7 +126,7 @@ const (
navigation = `[yellow]use keys or mouse to navigate`
)

var version string = fmt.Sprintf("[green]%s", config.Version)
var version string = fmt.Sprintf(`[green]Application version: %s\n[green]Protocol Version: %s`, versioning.ApplicationVersion, versioning.ProtocolVersion)

// Splash shows the app info
func Splash() (content tview.Primitive) {
Expand Down
7 changes: 4 additions & 3 deletions cmd/masa-node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os/signal"
"syscall"

"github.com/masa-finance/masa-oracle/internal/versioning"
"github.com/masa-finance/masa-oracle/pkg/workers"

"github.com/sirupsen/logrus"
Expand All @@ -21,7 +22,7 @@ import (
func main() {

if len(os.Args) > 1 && os.Args[1] == "--version" {
logrus.Infof("Masa Oracle Node Version: %s\n", config.Version)
logrus.Infof("Masa Oracle Node Version: %s\nMasa Oracle Protocol verison: %s", versioning.ApplicationVersion, versioning.ProtocolVersion)
os.Exit(0)
}

Expand Down Expand Up @@ -97,7 +98,7 @@ func main() {
// and other peers can do work we only need to check this here
// if this peer can or cannot scrape or write that is checked in other places
if node.IsStaked {
go workers.MonitorWorkers(ctx, node)
node.Host.SetStreamHandler(config.ProtocolWithVersion(config.WorkerProtocol), workers.GetWorkHandlerManager().HandleWorkerStream)
go masa.SubscribeToBlocks(ctx, node)
go node.NodeTracker.ClearExpiredWorkerTimeouts()
}
Expand Down Expand Up @@ -135,7 +136,7 @@ func main() {
multiAddr := node.GetMultiAddrs().String() // Get the multiaddress
ipAddr := node.Host.Addrs()[0].String() // Get the IP address
// Display the welcome message with the multiaddress and IP address
config.DisplayWelcomeMessage(multiAddr, ipAddr, keyManager.EthAddress, isStaked, isValidator, cfg.TwitterScraper, cfg.TelegramScraper, cfg.DiscordScraper, cfg.WebScraper, config.Version)
config.DisplayWelcomeMessage(multiAddr, ipAddr, keyManager.EthAddress, isStaked, isValidator, cfg.TwitterScraper, cfg.TelegramScraper, cfg.DiscordScraper, cfg.WebScraper, versioning.ApplicationVersion, versioning.ProtocolVersion)

<-ctx.Done()
}
Loading

0 comments on commit 982eed2

Please sign in to comment.