mirror of
https://github.com/AthanorLabs/atomic-swap.git
synced 2026-01-08 21:58:07 -05:00
makefile targets for release binaries (#454)
This commit is contained in:
16
Makefile
16
Makefile
@@ -43,6 +43,22 @@ test:
|
|||||||
test-integration:
|
test-integration:
|
||||||
./scripts/run-integration-tests.sh 2>&1 | tee test-integration.log
|
./scripts/run-integration-tests.sh 2>&1 | tee test-integration.log
|
||||||
|
|
||||||
|
# Instead of building from the local checked-out source, this will install
|
||||||
|
# the most recent commit with a release tag. Use the most recent tagged release
|
||||||
|
# for production swaps.
|
||||||
|
.PHONY: build-release
|
||||||
|
build-release:
|
||||||
|
mkdir -p bin
|
||||||
|
GOBIN=$(PWD)/bin go install -tags=prod github.com/athanorlabs/atomic-swap/cmd/...@latest
|
||||||
|
|
||||||
|
# If you don't have go installed but do have docker, you can build the most
|
||||||
|
# recent release using docker.
|
||||||
|
.PHONY: build-release-in-docker
|
||||||
|
build-release-in-docker:
|
||||||
|
mkdir -p bin
|
||||||
|
docker run --rm -v "$(PWD)/bin:/go/bin" -v $(PWD)/Makefile:/go/Makefile "golang:1.20" bash -c \
|
||||||
|
"make build-release && chown $$(id -u):$$(id -g) bin/{swapd,swapcli,bootnode}"
|
||||||
|
|
||||||
# Install all the binaries into $HOME/go/bin (or alternative GOPATH bin directory)
|
# Install all the binaries into $HOME/go/bin (or alternative GOPATH bin directory)
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
|
|||||||
@@ -118,8 +118,7 @@ func GetVersion() string {
|
|||||||
// The first part a go.mod style version if using "go install" directly with
|
// The first part a go.mod style version if using "go install" directly with
|
||||||
// github. If installing from locally checked out source, the string will be
|
// github. If installing from locally checked out source, the string will be
|
||||||
// "(devel)".
|
// "(devel)".
|
||||||
version.WriteString(info.Main.Version)
|
version.WriteString(strings.Replace(info.Main.Version, "(devel)", "dev-", 1))
|
||||||
version.WriteByte(' ')
|
|
||||||
|
|
||||||
// The commit hash will be present if installing from locally checked out
|
// The commit hash will be present if installing from locally checked out
|
||||||
// sources, or empty if installing directly from the repo's github URL.
|
// sources, or empty if installing directly from the repo's github URL.
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ sudo apt install curl bzip2 jq
|
|||||||
On macOS, you'll need to install `realpath` (from the `coreutils` package). If you
|
On macOS, you'll need to install `realpath` (from the `coreutils` package). If you
|
||||||
are using Homebrew, you can use these commands to install all the needed tools:
|
are using Homebrew, you can use these commands to install all the needed tools:
|
||||||
```bash
|
```bash
|
||||||
brew install coreutils go jq nvm
|
brew install coreutils go jq nvm bash
|
||||||
nvm install node
|
nvm install node
|
||||||
npm install --location=global ganache
|
npm install --location=global ganache
|
||||||
```
|
```
|
||||||
@@ -61,13 +61,25 @@ rm -rf "${TMPDIR:-/tmp}"/xmr[mt]aker-*
|
|||||||
|
|
||||||
### Build the Executables
|
### Build the Executables
|
||||||
|
|
||||||
Build binary:
|
You have several options. If you are looking to do production swaps, use one of
|
||||||
|
the first two release options. All 3 options create `swapd` and `swapcli`
|
||||||
|
binaries in the `bin` directory at the top of the project.
|
||||||
|
|
||||||
|
#### Build the most recent tagged release using Go
|
||||||
|
```bash
|
||||||
|
make build-release
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Build the most recent tagged release using docker (Go not required)
|
||||||
|
```bash
|
||||||
|
make build-release-in-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Build the checked-out sources as-is
|
||||||
```bash
|
```bash
|
||||||
make build
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
This creates `swapd` and `swapcli` binaries in the `bin` directory at the top of the project.
|
|
||||||
|
|
||||||
### Launch Alice and Bob's swapd Instances
|
### Launch Alice and Bob's swapd Instances
|
||||||
|
|
||||||
To launch Alice's swapd instance, use this command:
|
To launch Alice's swapd instance, use this command:
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ if [[ "${BASH_SOURCE[0]}" != "$0" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
version="HEAD" # use "latest" for most recent tagged release
|
# Using "latest" below gives you the last tagged release. Change it to "HEAD" if
|
||||||
|
# you want the most recent, pushed to github, commit on the master branch.
|
||||||
|
version="latest"
|
||||||
install_targets=(
|
install_targets=(
|
||||||
"github.com/athanorlabs/atomic-swap/cmd/swapd@${version}"
|
"github.com/athanorlabs/atomic-swap/cmd/swapd@${version}"
|
||||||
"github.com/athanorlabs/atomic-swap/cmd/swapcli@${version}"
|
"github.com/athanorlabs/atomic-swap/cmd/swapcli@${version}"
|
||||||
Reference in New Issue
Block a user