Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor codebase with urfave/cli #120

Merged
merged 28 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/.git/
/.git/
32 changes: 0 additions & 32 deletions .drone.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.16.x

- name: Cache Go modules
uses: actions/cache@v1
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,23 @@ jobs:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
id: go
with:
go-version: 1.16.x

- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: go get -v -t -d ./...
Expand All @@ -25,5 +36,4 @@ jobs:
run: |
make fmt
make install
sudo chmod -R 777 .
make test-ci
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

vendor/
build/
dist/
dist/
21 changes: 13 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
builds:
- main: ./cli/main.go
- main: ./cmd/nigiri
ldflags:
- -s -w -X github.com/vulpemventures/nigiri/cli/cmd.version={{.Version}} -X github.com/vulpemventures/nigiri/cli/cmd.commit={{.Commit}} -X github.com/vulpemventures/nigiri/cli/cmd.date={{.Date}}
- -s -X 'main.version={{.Version}}' -X 'main.commit={{.Commit}}' -X 'main.date={{.Date}}'
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64

checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- "^docs:"
- "^test:"
archives:
-
format: binary
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
- format: binary
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"

release:
prerelease: auto
26 changes: 12 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
.PHONY: install build release dry-release clean cov fmt help vet test
.PHONY: install clean build release dry-release cov fmt help vet test

## install: installs dependencies
install:
export GO111MODULE=on
chmod u+x ./scripts/install
./scripts/install
go mod download
go mod tidy

## build: build binary for ARM
## clean: cleans the binary
clean:
@echo "Cleaning..."
go clean

## build: build binary
build:
export GO111MODULE=on
chmod u+x ./scripts/build
./scripts/build

## release: build and upload binaries to Github Releases
release:
goreleaser

## dry-release: build and test goreleaser
dry-release:
goreleaser --snapshot --skip-publish --rm-dist

## clean: cleans the binary
clean:
@echo "Cleaning..."
export GO111MODULE=on
chmod u+x ./scripts/clean
./scripts/clean

## help: prints this help message
help:
@echo "Usage: \n"
Expand All @@ -46,7 +44,7 @@ test: clean install
go test -v -count=1 -race ./...

## test-ci: runs travis tests
test-ci:
test-ci: clean
@echo "Testing..."
go test -short -v ./...

Expand Down
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ It offers a [JSON HTTP proxy passtrough](https://github.com/vulpemventures/nigir

You can have Elements too with the `--liquid` flag.

Are you looking to spin-up Nigiri in Travis or Github Action? Look [here](https://github.com/vulpemventures/nigiri-travis)


# No time to make a Nigiri yourself?
## Pre-built binary
Expand Down Expand Up @@ -51,7 +49,6 @@ $ nigiri rpc --liquid getnewaddress "" "bech32"
el1qqwwx9gyrcrjrhgnrnjq9dq9t4hykmr6ela46ej63dnkdkcg8veadrvg5p0xg0zd6j3aug74cv9m4cf4jslwdqnha2w2nsg9x3
```


# Make from scratch
## Utensils

Expand Down Expand Up @@ -83,14 +80,11 @@ $ git clone https://github.com/vulpemventures/nigiri.git
$ make install
```

This will create `~/.nigiri` copying there the `{bitcoin|elements}.conf` you can modify.

* Build binary

```
# MacOSX
$ make build-mac
# Linux
$ make build-linux
$ make build
```

Done! You should be able to find the binary in the local `./build` folder. Give it permission to execute and move/rename into your PATH.
Expand Down Expand Up @@ -187,6 +181,21 @@ $ nigiri rpc --liquid getnewaddress "" "bech32"
el1qqwwx9gyrcrjrhgnrnjq9dq9t4hykmr6ela46ej63dnkdkcg8veadrvg5p0xg0zd6j3aug74cv9m4cf4jslwdqnha2w2nsg9x3
```

* Run in headless mode (without Esplora)
If you are looking to spin-up Nigiri in Travis or Github Action you can use the `--ci` flag.

```
$ nigiri start --ci [--liquid]
```


* Update the docker images

```
$ nigiri update
```




Nigiri uses the default directory `~/.nigiri` to store configuration files and docker-compose files.
Expand Down
120 changes: 0 additions & 120 deletions cli/cmd/faucet.go

This file was deleted.

Loading