This repository has been archived by the owner on May 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,747 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Dockerized Tests | ||
|
||
on: | ||
push: | ||
branches: [ "master", "main" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
jobs: | ||
all-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run tests in docker container | ||
run: make docker-test-all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
ARG gover=1.19.5 | ||
|
||
FROM golang:$gover | ||
|
||
ARG goplatform=amd64 | ||
ARG cppplatform=x86_64 | ||
ARG lnd=v0.15.5-beta | ||
ARG bitcoind=24.0.1 | ||
ARG vault=1.12.2 | ||
|
||
RUN apt update && apt-get install -y zip | ||
|
||
RUN cd /root && \ | ||
wget https://bitcoincore.org/bin/bitcoin-core-$bitcoind/bitcoin-${bitcoind}-${cppplatform}-linux-gnu.tar.gz && \ | ||
tar xfz bitcoin-$bitcoind-$cppplatform-linux-gnu.tar.gz && \ | ||
mv bitcoin-$bitcoind/bin/* /usr/local/bin/ && \ | ||
wget https://github.com/lightningnetwork/lnd/releases/download/$lnd/lnd-linux-$goplatform-$lnd.tar.gz && \ | ||
tar xfz lnd-linux-$goplatform-$lnd.tar.gz && \ | ||
mv lnd-linux-$goplatform-$lnd/* /usr/local/bin/ && \ | ||
wget https://releases.hashicorp.com/vault/$vault/vault_${vault}_linux_${goplatform}.zip && \ | ||
unzip vault_${vault}_linux_${goplatform}.zip && \ | ||
mv vault /usr/local/bin/ && \ | ||
go install github.com/go-delve/delve/cmd/dlv@latest && \ | ||
echo "export PATH='$PATH:/usr/local/go/bin:/root/go/bin'" >> .bashrc | ||
|
||
VOLUME [ "/app" ] | ||
|
||
WORKDIR /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.PHONY: docker docker-itest docker-test docker-test-all docker-check docker-shell itest test test-all | ||
|
||
IMG_NAME := lndsigner-builder | ||
|
||
GOVER := 1.19.5 | ||
GOPLATFORM := amd64 | ||
CPPPLATFORM := x86_64 | ||
LND := v0.15.5-beta | ||
BITCOIND := 24.0.1 | ||
VAULT := 1.12.2 | ||
|
||
STAMPPREIMAGE := $(GOVER)$(GOPLATFORM)$(CPPPLATFORM)$(LND)$(BITCOIND)$(VAULT) | ||
|
||
BUILDERSTAMP != echo $(STAMPPREIMAGE) | sha256sum | cut -d " " -f 1 | ||
IMAGE_BUILT != docker image ls $(IMG_NAME):$(BUILDERSTAMP) | grep $(BUILDERSTAMP) | wc -l | ||
|
||
# docker-check checks if an image with the builderstamp already exists. If not, | ||
# it builds one. | ||
docker-check: | ||
ifeq ($(IMAGE_BUILT), 0) | ||
docker build -t $(IMG_NAME):$(BUILDERSTAMP) . | ||
endif | ||
|
||
# docker just tags the latest image to the builderstamp, in case the | ||
# dependencies have been changed and a new image was built. | ||
docker: docker-check | ||
docker image tag $(IMG_NAME):$(BUILDERSTAMP) $(IMG_NAME):latest | ||
|
||
# docker-itest runs itests in a docker container, then removes the container. | ||
docker-itest: docker | ||
docker run -t --rm \ | ||
--mount type=bind,source=$(CURDIR),target=/app $(IMG_NAME):latest \ | ||
make itest | ||
|
||
# docker-test runs unit tests in a docker container, then removes the container. | ||
docker-test: docker | ||
docker run -t --rm \ | ||
--mount type=bind,source=$(CURDIR),target=/app $(IMG_NAME):latest \ | ||
make test | ||
|
||
# docker-test-all runs unit and integration tests in a docker container, then | ||
# removes the container. | ||
docker-test-all: docker | ||
docker run -t --rm \ | ||
--mount type=bind,source=$(CURDIR),target=/app $(IMG_NAME):latest \ | ||
make test-all | ||
|
||
# docker-shell opens a shell to a dockerized environment with all dependencies | ||
# and also dlv installed for easy debugging, then removes the container. | ||
docker-shell: docker | ||
docker run -it --rm \ | ||
--mount type=bind,source=$(CURDIR),target=/app $(IMG_NAME):latest \ | ||
bash -l | ||
|
||
itest: | ||
go install -race ./cmd/... && go test -v -count=1 -race -tags=itest -cover ./itest | ||
|
||
test: | ||
go test -v -count=1 -race -cover ./... | ||
|
||
test-all: | ||
go install -race ./cmd/... && go test -v -count=1 -race -tags=itest -cover ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2015-2022 Lightning Labs and The Lightning Network Developers | ||
# Copyright (C) 2022 Bottlepay and The Lightning Network Developers | ||
|
||
set -e | ||
|
||
# generate compiles the *.pb.go stubs from the *.proto files. | ||
function generate() { | ||
echo "Generating root gRPC server protos" | ||
|
||
PROTOS="walletunlocker.proto" | ||
|
||
# For each of the sub-servers, we then generate their protos, but a restricted | ||
# set as they don't yet require REST proxies, or swagger docs. | ||
for file in $PROTOS; do | ||
DIRECTORY=$(dirname "${file}") | ||
echo "Generating protos from ${file}, into ${DIRECTORY}" | ||
|
||
# Generate the protos. | ||
protoc -I/usr/local/include -I. \ | ||
--go_out . --go_opt paths=source_relative \ | ||
--go-grpc_out . --go-grpc_opt paths=source_relative \ | ||
"${file}" | ||
done | ||
} | ||
|
||
# format formats the *.proto files with the clang-format utility. | ||
function format() { | ||
find . -name "*.proto" -print0 | xargs -0 clang-format --style=file -i | ||
} | ||
|
||
# Compile and format the itest package. | ||
pushd itest | ||
format | ||
generate | ||
popd |
Oops, something went wrong.