From aa2fecead8fdc49eef5d90aa50b3246a6c8bb0da Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Sun, 17 Mar 2024 22:44:46 +0100 Subject: [PATCH] hello world Signed-off-by: Vincenzo Palazzo --- .github/workflows/build.yml | 37 ++++++++ .github/workflows/release.yml | 34 +++++++ .gitignore | 2 + Makefile | 31 +++++++ cmd/main.go | 6 ++ flake.lock | 163 ++++++++++++++++++++++++++++++++++ flake.nix | 52 +++++++++++ go.mod | 3 + 8 files changed, 328 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml create mode 100644 Makefile create mode 100644 cmd/main.go create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 go.mod diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7b89215 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,37 @@ +name: Build and test Go +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - { OS: "linux", ARCH: "386", ARM: "" } + - { OS: "linux", ARCH: "amd64", ARM: "" } + - { OS: "linux", ARCH: "arm", ARM: "5" } + - { OS: "linux", ARCH: "arm", ARM: "6" } + - { OS: "linux", ARCH: "arm", ARM: "7" } + - { OS: "linux", ARCH: "arm64", ARM: "" } + - { OS: "darwin", ARCH: "amd64", ARM: "" } + steps: + - name: Set up Go 1.18 + uses: actions/setup-go@v1 + with: + go-version: 1.18 + + - name: Check out source code + uses: actions/checkout@v1 + + - name: Go test + run: make check + + - name: Build + run: make build OS=${{ matrix.OS }} ARCH=${{ matrix.ARCH }} ARM=${{ matrix.ARM }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d29e1ae --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: Release the package for all the architecture. +on: + push: + tags: + - 'v*' +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - { OS: "linux", ARCH: "386" } + - { OS: "linux", ARCH: "amd64" } + - { OS: "linux", ARCH: "arm" } + - { OS: "linux", ARCH: "arm64" } + - { OS: "darwin", ARCH: "amd64" } + steps: + - name: Set up Go 1.18 + uses: actions/setup-go@v1 + with: + go-version: 1.18 + + - name: Check out source code + uses: actions/checkout@v1 + + - name: Build + run: make build OS=${{ matrix.OS }} ARCH=${{ matrix.ARCH }} + + - name: Upload Archive + uses: actions/upload-artifact@v2 + with: + path: lnprototest* diff --git a/.gitignore b/.gitignore index 3b735ec..9c9116e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ # Go workspace file go.work + +lnprototestd diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..557267e --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +CC=go +FMT=gofmt +NAME=lnprototestd +BASE_DIR=/script +OS=linux +ARCH=386 +ARM= + +default: fmt lint + $(CC) build -o $(NAME) cmd/main.go + +fmt: + $(CC) fmt ./... + +lint: + golangci-lint run + +check: + $(CC) test -v ./... + +check-dev: + richgo test ./... -v + +build: + env GOOS=$(OS) GOARCH=$(ARCH) GOARM=$(ARM) $(CC) build -o $(NAME)-$(OS)-$(ARCH) cmd/main.go + +coffee: + $(CC) build -o $(NAME) -ldflags "-s -w" cmd/main.go + +dep: + $(CC) get -u all diff --git a/cmd/main.go b/cmd/main.go new file mode 100644 index 0000000..2fa21bd --- /dev/null +++ b/cmd/main.go @@ -0,0 +1,6 @@ +// / Lightning Network protocol integration tests +// / +// / Author: Vincenzo Palazzo +package main + +func main() {} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..73f3bef --- /dev/null +++ b/flake.lock @@ -0,0 +1,163 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "goflake": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1680659771, + "narHash": "sha256-5Gli0PdnZh2rUQTDapyz0pDG+yzRq5AAPoMpZkdMaGQ=", + "owner": "sagikazarmark", + "repo": "go-flake", + "rev": "1a32d77792361575b617f7e52f107273ef4ba723", + "type": "github" + }, + "original": { + "owner": "sagikazarmark", + "repo": "go-flake", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1666539104, + "narHash": "sha256-jeuC+d375wHHxMOFLgu7etseCQVJuPNKoEc9X9CsErg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0e6df35f39651504249a05191f9a78d251707e22", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1710712015, + "narHash": "sha256-2T+pn4qVH55hJobyUz3N78jqarNOYfTyYVMbzmJn+3g=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5bd006778f756658054b376f1da46c9bee41410d", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1706487304, + "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "goflake": "goflake", + "nixpkgs": "nixpkgs_2", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1710641527, + "narHash": "sha256-R9JZEevtSyg7++LEryYJRrfyEe45azJxmu2k9VezEW0=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "50db54295d3922a3b7a40d580b84d75150b36c34", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..927552c --- /dev/null +++ b/flake.nix @@ -0,0 +1,52 @@ +{ + description = "A rewriating of lnprototest library for black box testing of the lightning network protocol"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + goflake.url = "github:sagikazarmark/go-flake"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; + + outputs = { self, nixpkgs, flake-utils, goflake, rust-overlay, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlay ]; + }; + in { + packages = { + default = pkgs.gnumake; + }; + formatter = pkgs.nixpkgs-fmt; + + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ + # build dependencies + libcap + gcc + pkg-config + git + + gnumake + golangci-lint + + go + + # integration test dependencies + clightning + bitcoind + ]; + + shellHook = '' + export CGO_ENABLED=0 + export HOST_CC=gcc + export PWD=$(pwd) + + make dep + ''; + }; + } + ); +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2399211 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/vincenzopalazzo/lnprototest-v2 + +go 1.22.1