Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into task-merge-conn
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jun 6, 2024
2 parents 3e064a8 + 8bc5539 commit 5edc544
Show file tree
Hide file tree
Showing 75 changed files with 3,003 additions and 1,752 deletions.
188 changes: 188 additions & 0 deletions .github/workflows/wails2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: Wails build - all platforms

on:
push:

jobs:
build:
strategy:
fail-fast: false
matrix:
build: [
{name: albyhub, platform: linux/amd64, os: ubuntu-20.04},
{name: albyhub, platform: windows/amd64, os: windows-2019},
{name: albyhub, platform: darwin/universal, os: macos-12}
]
runs-on: ${{ matrix.build.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

#- uses: dAppServer/[email protected]
# with:
# build-name: ${{ matrix.build.name }}
# build-platform: ${{ matrix.build.platform }}
# package: true
# go-version: '1.21'
# wails-version: 'v2.7.1'
# nsis: false
# node-version: '20.x'

- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y patchelf
- name: Setup GoLang
uses: actions/setup-go@v5
with:
check-latest: true
go-version: 1.21

- name: Get dependencies
run: go get -v -t -d ./...

- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/[email protected]
shell: bash

- name: Install Linux Wails deps
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libgtk-3-0 libwebkit2gtk-4.0-dev gcc-aarch64-linux-gnu
shell: bash

- name: Install macOS Wails deps
if: runner.os == 'macOS'
run: brew install mitchellh/gon/gon
shell: bash

- name: Wails Doctor
working-directory: .
run: wails doctor
shell: bash

# On Windows, we need the shared libraries to be found in the same directory
# as the executable. Wails build will fail otherwise.
- name: Copy shared libraries
if: runner.os == 'Windows'
run: |
cp `go list -m -f "{{.Dir}}" github.com/breez/breez-sdk-go`/breez_sdk/lib/windows-amd64/breez_sdk_bindings.dll ./
cp `go list -m -f "{{.Dir}}" github.com/getAlby/glalby-go`/glalby/x86_64-pc-windows-gnu/glalby_bindings.dll ./
cp `go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go`/ldk_node/x86_64-pc-windows-gnu/ldk_node.dll ./
shell: bash

- name: Copy appicon in place
run: mkdir -p build && cp appicon.png build
shell: bash

- name: Build App
if: runner.os == 'macOS'
run: wails build --platform darwin/universal -webview2 download -o ${{ matrix.build.name }} -tags "wails"
shell: bash

- name: Build App
if: runner.os == 'Linux'
run: wails build --platform linux/amd64 -webview2 download -o ${{ matrix.build.name }} -tags "wails"
shell: bash

- name: Build Windows App
if: runner.os == 'Windows'
run: wails build --platform windows/amd64 -webview2 download -o ${{ matrix.build.name }}.exe -tags "wails"
shell: bash

- name: Copy DLLs to the output directory
if: runner.os == 'Windows'
run: |
cp breez_sdk_bindings.dll ./build/bin/
cp glalby_bindings.dll ./build/bin/
cp ldk_node.dll ./build/bin/
shell: bash

- name: Copy shared libraries to the output directory and adjust directory structure
if: runner.os == 'Linux'
run: |
mkdir -p ./build/bin/albyhub-${{runner.os}}/lib
cp `go list -m -f "{{.Dir}}" github.com/breez/breez-sdk-go`/breez_sdk/lib/linux-amd64/libbreez_sdk_bindings.so ./build/bin/albyhub-${{runner.os}}/lib/
cp `go list -m -f "{{.Dir}}" github.com/getAlby/glalby-go`/glalby/x86_64-unknown-linux-gnu/libglalby_bindings.so ./build/bin/albyhub-${{runner.os}}/lib/
cp `go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go`/ldk_node/x86_64-unknown-linux-gnu/libldk_node.so ./build/bin/albyhub-${{runner.os}}/lib/
mkdir -p ./build/bin/albyhub-${{runner.os}}/bin
mv ./build/bin/${{ matrix.build.name }} ./build/bin/albyhub-${{runner.os}}/bin/
shell: bash

- name: Patch executable RPATH
if: runner.os == 'Linux'
run: |
patchelf --force-rpath --set-rpath '$ORIGIN/../lib' ./build/bin/albyhub-${{runner.os}}/bin/${{ matrix.build.name }}
- name: Copy shared libraries to the output directory
if: runner.os == 'macOS'
run: |
mkdir -p ./build/bin/${{ matrix.build.name }}.app/Contents/Frameworks
lipo -create -output ./build/bin/${{ matrix.build.name }}.app/Contents/Frameworks/libbreez_sdk_bindings.dylib `go list -m -f "{{.Dir}}" github.com/breez/breez-sdk-go`/breez_sdk/lib/darwin-aarch64/libbreez_sdk_bindings.dylib `go list -m -f "{{.Dir}}" github.com/breez/breez-sdk-go`/breez_sdk/lib/darwin-amd64/libbreez_sdk_bindings.dylib
cp `go list -m -f "{{.Dir}}" github.com/getAlby/glalby-go`/glalby/universal-macos/libglalby_bindings.dylib ./build/bin/${{ matrix.build.name }}.app/Contents/Frameworks/
cp `go list -m -f "{{.Dir}}" github.com/getAlby/ldk-node-go`/ldk_node/universal-macos/libldk_node.dylib ./build/bin/${{ matrix.build.name }}.app/Contents/Frameworks/
shell: bash

- name: Patch executable RPATH
if: runner.os == 'macOS'
run: |
install_name_tool -add_rpath @executable_path/../Frameworks ./build/bin/${{ matrix.build.name }}.app/Contents/MacOS/${{ matrix.build.name }}
- name: Add macOS perms
if: runner.os == 'macOS'
run: chmod +x build/bin/${{ matrix.build.name }}.app/Contents/MacOS/${{ matrix.build.name }}
shell: bash

- name: Add Linux perms
if: runner.os == 'Linux'
run: chmod +x build/bin/albyhub-${{runner.os}}/bin/${{ matrix.build.name }}
shell: bash

# Store everything in a tar archive to preserve permissions
# (specifically, the executable bit on the app executable).
- name: Make output tar archive
if: runner.os == 'Linux'
run: |
mkdir -p ./build/out
tar -cjf ./build/out/albyhub-${{runner.os}}.tar.bz2 -C ./build/bin .
rm -Rf ./build/bin/*
mv ./build/out/albyhub-${{runner.os}}.tar.bz2 ./build/bin/
- name: Make DMG image for macOS
if: runner.os == 'macOS'
run: |
mkdir -p ./build/out
hdiutil create -volname "AlbyHub" -srcfolder ./build/bin/${{ matrix.build.name }}.app -ov -format UDZO ./build/out/albyhub-${{runner.os}}.dmg
rm -Rf ./build/bin/*
mv ./build/out/albyhub-${{runner.os}}.dmg ./build/bin/
- uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: albyhub-${{runner.os}}
path: |
./build/bin/albyhub-${{runner.os}}.tar.bz2
if-no-files-found: error

- uses: actions/upload-artifact@v4
if: runner.os == 'macOS'
with:
name: albyhub-${{runner.os}}
path: |
./build/bin/albyhub-${{runner.os}}.dmg
if-no-files-found: error

- uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: albyhub-${{runner.os}}
path: |
*\bin\*
if-no-files-found: error
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"wayou.vscode-todo-highlight",
"golang.go",
"bradlc.vscode-tailwindcss"
]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WORKDIR /build
COPY frontend ./frontend
RUN cd frontend && yarn install && yarn build:http

FROM golang:1.21 as builder
FROM golang:1.22.2 as builder

ARG TARGETPLATFORM
ARG BUILDPLATFORM
Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,35 @@ _If you get a blank screen, try running in your normal terminal (outside of vsco

$ go test

### Profiling

The application supports both the Go pprof library and the DataDog profiler.

#### Go pprof

To enable Go pprof, set the `GO_PROFILER_ADDR` environment variable to the address you want the profiler to be available on (e.g. `localhost:6060`).

Now, you should be able to access the pprof web interface at `http://localhost:6060/debug/pprof`.

You can use the `go tool pprof` command to collect and inspect the profiling data. For example, to profile the application for 30 seconds and then open the pprof web UI, run:

```sh
go tool pprof -http=localhost:8081 -seconds=30 http://localhost:6060/debug/pprof/profile
```

For more information on the Go pprof library, see the [official documentation](https://pkg.go.dev/net/http/pprof).

#### DataDog profiler

To enable the DataDog profiler, set the `DD_PROFILER_ENABLED` environment variable to `true`.

Make sure to specify the required DataDog configuration environment variables as well.

For more information refer to:

- [DataDog Profiler documentation](https://docs.datadoghq.com/profiler/enabling/go/)
- [DataDog Profiler Go library](https://pkg.go.dev/gopkg.in/DataDog/dd-trace-go.v1/profiler)

### Windows

Breez SDK requires gcc to build the Breez bindings. Run `choco install mingw` and copy the breez SDK bindings file into the root of this directory (from your go installation directory) as per the [Breez SDK instructions](https://github.com/breez/breez-sdk-go?tab=readme-ov-file#windows). ALSO copy the bindings file into the output directory alongside the .exe in order to run it.
Expand Down
Loading

0 comments on commit 5edc544

Please sign in to comment.