makefile targets for release binaries (#454)

This commit is contained in:
Dmitry Holodov
2023-05-03 13:26:51 -05:00
committed by GitHub
parent f7862219a8
commit 2143df291b
4 changed files with 36 additions and 7 deletions

View File

@@ -43,6 +43,22 @@ test:
test-integration:
./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)
.PHONY: install
install:

View File

@@ -118,8 +118,7 @@ func GetVersion() string {
// 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
// "(devel)".
version.WriteString(info.Main.Version)
version.WriteByte(' ')
version.WriteString(strings.Replace(info.Main.Version, "(devel)", "dev-", 1))
// The commit hash will be present if installing from locally checked out
// sources, or empty if installing directly from the repo's github URL.

View File

@@ -34,7 +34,7 @@ sudo apt install curl bzip2 jq
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:
```bash
brew install coreutils go jq nvm
brew install coreutils go jq nvm bash
nvm install node
npm install --location=global ganache
```
@@ -61,13 +61,25 @@ rm -rf "${TMPDIR:-/tmp}"/xmr[mt]aker-*
### 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
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
To launch Alice's swapd instance, use this command:

View File

@@ -12,7 +12,9 @@ if [[ "${BASH_SOURCE[0]}" != "$0" ]]; then
exit 1
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=(
"github.com/athanorlabs/atomic-swap/cmd/swapd@${version}"
"github.com/athanorlabs/atomic-swap/cmd/swapcli@${version}"