Skip to content

Commit 3f151b7

Browse files
authored
Merge pull request #590 from semyon-dev/dev
refactoring, better build scripts
2 parents 39c5bb5 + dad208e commit 3f151b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+744
-638
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
11
name: build
22
on:
33
push:
4-
branches: [ "master" ]
5-
# pull_request:
6-
# branches: [ "master" ]
4+
branches: [ "master", "dev" ]
5+
pull_request:
6+
branches: [ "dev" ]
77
workflow_dispatch:
88

9+
env:
10+
GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore
11+
912
jobs:
10-
run_build:
11-
runs-on: ubuntu-latest
12-
steps:
13-
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
1417
- name: clone repo
1518
uses: actions/checkout@v3
16-
19+
1720
- name: download and install
1821
uses: actions/setup-go@v5
1922
with:
20-
go-version: '1.22.2'
23+
go-version: '1.22.5'
2124

22-
- name: protobuff install
23-
run: |
24-
sudo apt update
25-
sudo apt install protobuf-compiler
26-
27-
- name: go_ins_1
28-
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
25+
- name: install protoc (protobuf)
26+
uses: arduino/setup-protoc@v3
27+
with:
28+
version: v27.2
29+
include-pre-releases: false
2930

30-
- name: go_ins_2
31-
run: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
31+
- name: chmod +x
32+
run: chmod +x ./scripts/install_deps && chmod +x ./scripts/build
3233

33-
- name: generate
34-
run: go generate ./...
34+
- name: install dependencies
35+
run: ./scripts/install_deps
3536

36-
- name: check version
37-
run: go version
37+
- name: build linux
38+
run: ./scripts/build linux amd64 dev
3839

39-
- name: check folder
40-
run: ls
40+
- name: build darwin
41+
run: ./scripts/build darwin amd64 dev
4142

42-
- name: do build
43-
run: go build snetd/main.go
43+
- name: build windows
44+
run: ./scripts/build windows amd64 dev

.github/workflows/test.yml

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,37 @@
11
name: tests
22
on:
3-
# push:
4-
# branches: [ "master" ]
3+
push:
4+
branches: [ "dev" ]
55
pull_request:
6-
branches: [ "master" ]
6+
branches: [ "master", "dev" ]
77
workflow_dispatch:
88

9+
env:
10+
GOLANG_PROTOBUF_REGISTRATION_CONFLICT: ignore
11+
912
jobs:
10-
run_tests:
11-
runs-on: ubuntu-latest
12-
steps:
13-
13+
tests:
14+
runs-on: ubuntu-latest
15+
steps:
1416
- name: clone repo
1517
uses: actions/checkout@v3
16-
18+
1719
- name: download and install
1820
uses: actions/setup-go@v5
1921
with:
20-
go-version: '1.22.2'
21-
22-
- name: protobuff install
23-
run: |
24-
sudo apt update
25-
sudo apt install protobuf-compiler
22+
go-version: '1.22.5'
2623

27-
- name: go_ins_1
28-
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
29-
30-
- name: go_ins_2
31-
run: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
32-
33-
- name: generate
34-
run: go generate ./...
24+
- name: install protoc (protobuf)
25+
uses: arduino/setup-protoc@v3
26+
with:
27+
version: v27.2
28+
include-pre-releases: false
3529

36-
- name: check version
37-
run: go version
30+
- name: chmod to allow run script
31+
run: chmod +x ./scripts/install_deps
3832

39-
- name: check folder
40-
run: ls
33+
- name: install dependencies
34+
run: ./scripts/install_deps
4135

42-
- name: do tests
36+
- name: go tests
4337
run: go test -v ./...

.gitignore

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,49 @@
11
# idea cache
22
.idea/
33

4-
# npm cache and configs
4+
# npm cache
5+
resources/blockchain/package-lock.json
56
resources/blockchain/node_modules/
67
resources/blockchain/build/
78
snetd.db
9+
10+
# configs
811
snetd.config.json
9-
/vendor/
10-
/build/
11-
resources/blockchain/package-lock.json
1212

13-
# Autogenerated sources
13+
# autogenerated sources
1414
blockchain/snet-contracts.go
1515
*.pb.go
16+
/vendor/
1617

17-
# Binaries for programs and plugins
18+
# binaries for programs and plugins
19+
/build/
1820
*.exe
1921
*.exe~
2022
*.dll
2123
*.so
2224
*.dylib
2325

24-
# Test binary, build with `go test -c`
26+
# test binary, build with `go test -c`
2527
*.test
2628

27-
# Output of the go coverage tool, specifically when used with LiteIDE
29+
# output of the go coverage tool, specifically when used with LiteIDE
2830
*.out
2931

3032
# vim temporary files
3133
*~
3234
*.swp
3335
*.swo
3436

35-
# etcd server temporary directories
37+
# etcd server directories
3638
storage-*
37-
*.pem
38-
*log
3939
data.etcd/
40+
*.tmp
41+
*.etcd
42+
43+
# certs and keys
44+
*.pem
45+
46+
# logs
47+
*.log
48+
4049

.golangci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This file configures github.com/golangci/golangci-lint.
2+
3+
run:
4+
concurrency: 4
5+
timeout: 5m
6+
tests: false
7+
issues-exit-code: 3
8+
modules-download-mode: readonly
9+
allow-parallel-runners: true
10+
11+
linters:
12+
disable-all: true
13+
enable:
14+
- gosimple
15+
- govet
16+
- ineffassign
17+
- misspell
18+
- unconvert
19+
- typecheck
20+
# - unused
21+
- staticcheck
22+
- bidichk
23+
- durationcheck
24+
- exportloopref
25+
- whitespace
26+
- revive # only certain checks enabled
27+
28+
linters-settings:
29+
gofmt:
30+
simplify: true
31+
revive:
32+
enable-all-rules: false
33+
# here we enable specific useful rules
34+
# see https://golangci-lint.run/usage/linters/#revive for supported rules
35+
rules:
36+
- name: receiver-naming
37+
severity: warning
38+
disabled: false
39+
exclude: [ "" ]
40+
41+
issues:
42+
exclude-dirs-use-default: true
43+
exclude-dirs:
44+
- bin
45+
- build
46+
- \.git
47+
exclude-files:
48+
- ".pb"
49+
exclude-rules:
50+
- linters:
51+
- lll
52+
source: "^//go:generate "

0 commit comments

Comments
 (0)