Skip to content

Commit

Permalink
Desktop Dev Builds (#72)
Browse files Browse the repository at this point in the history
Co-authored-by: Horacio Herrera <[email protected]>
  • Loading branch information
ericvicenti and horacioh authored Dec 13, 2024
1 parent 515b447 commit 6681a57
Show file tree
Hide file tree
Showing 21 changed files with 3,319 additions and 1,242 deletions.
8 changes: 6 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ export VITE_DESKTOP_GRPC_PORT="$SEED_GRPC_PORT"
export VITE_DESKTOP_APPDATA="Seed-local"
export VITE_DESKTOP_HOSTNAME="http://localhost"
export VITE_METRIC_SERVER_HTTP_PORT="58003"
export VITE_VERSION="0.0.0.local"
export VITE_VERSION="0.0.0.local-dev"
export VITE_COMMIT_HASH="LOCAL_abcdefghijklmnopqrst0123456789qwertyuiopasdfghjklzxcvbnm"

export SEED_P2P_TESTNET_NAME="dev"

export VITE_LIGHTNING_API_URL="https://ln.testnet.seed.hyper.media"
export VITE_GATEWAY_URL="https://dev.hyper.media"

# Needed for the Go extension in VS Code to find the right toolchain.
export GOROOT="$(go env GOROOT)"
Expand All @@ -49,4 +53,4 @@ export GOROOT="$(go env GOROOT)"
export VITE_DESKTOP_SENTRY_DSN="https://8d3089ffb71045dc911bc66efbd3463a@o4504088793841664.ingest.sentry.io/4505527460429824"
export SITE_SENTRY_DSN="https://e7703dbcf2ae9a059413b49d343ba415@o4504088793841664.ingest.us.sentry.io/4507979996463104"

# NODE_ENV=test VITE_DESKTOP_P2P_PORT=5800 VITE_DESKTOP_HTTP_PORT=58001 VITE_DESKTOP_GRPC_PORT=58002 VITE_DESKTOP_APPDATA=appData.test.local
# NODE_ENV=test VITE_DESKTOP_P2P_PORT=5800 VITE_DESKTOP_HTTP_PORT=58001 VITE_DESKTOP_GRPC_PORT=58002 VITE_DESKTOP_APPDATA=appData.test.local
8 changes: 4 additions & 4 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runs:
go-version: "1.23.3"

- name: "Install native packages"
if: inputs.matrix-os == 'ubuntu-24.04'
if: inputs.matrix-os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf rpm
Expand All @@ -34,14 +34,14 @@ runs:
# flatpak gnome-software-plugin-flatpak flatpak-builder elfutils

# - name: "Setup Flatpak"
# if: inputs.matrix-os == 'ubuntu-24.04'
# if: inputs.matrix-os == 'ubuntu-latest'
# run: |
# sudo flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# shell: bash

- name: Setup cache Ubuntu
uses: actions/cache@v3
if: inputs.matrix-os == 'ubuntu-24.04'
if: inputs.matrix-os == 'ubuntu-latest'
with:
path: |
~/.cache/go-build
Expand All @@ -52,7 +52,7 @@ runs:
- name: Setup cache Macos
uses: actions/cache@v3
if: inputs.matrix-os == 'macos-latest'
if: startsWith(inputs.matrix.os, 'macos')
with:
path: |
~/Library/Caches/go-build
Expand Down
221 changes: 221 additions & 0 deletions .github/workflows/desktop-dev-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
name: Desktop dev release

permissions:
contents: write

on:
workflow_dispatch:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
AWS_REGION: us-east-1

jobs:
build-info:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_version.outputs.version }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set Version
id: set_version
run: |
node scripts/generate-dev-version.mjs --debug
VERSION=$(node scripts/generate-dev-version.mjs)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Display Version
run: |
echo "App Version: ${{ steps.set_version.outputs.version }}"
frontend-tests:
runs-on: ubuntu-latest
needs: [build-info]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test

build-binaries:
name: Build ${{ matrix.config.os }} @ ${{ matrix.config.arch }}
runs-on: ${{ matrix.config.os }}
# if: startsWith(github.ref, 'refs/tags/')
needs: [build-info, frontend-tests]
strategy:
matrix:
config:
- os: macos-13-large
arch: x64
goarch: amd64
daemon_name: x86_64-apple-darwin
- os: macos-13-xlarge
arch: arm64
goarch: arm64
daemon_name: aarch64-apple-darwin
- os: ubuntu-latest
arch: x64
goarch: amd64
daemon_name: x86_64-unknown-linux-gnu
- os: windows-latest
arch: x64
goarch: amd64
daemon_name: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ./.github/actions/ci-setup
with:
matrix-os: ${{ matrix.config.os }}
# matrix-target: ${{ matrix.config.daemon_name }}
# matrix-arch: ${{ matrix.config.arch }}

- name: Build Backend (Unix)
if: matrix.config.os != 'windows-latest'
run: |
mkdir -p plz-out/bin/backend
go build -o plz-out/bin/backend/seed-daemon-${{ matrix.config.daemon_name }} ./backend/cmd/seed-daemon
env:
GOARCH: ${{ matrix.config.goarch }}
CGO_ENABLED: 1

- name: Build Backend (Windows)
if: matrix.config.os == 'windows-latest'
run: |
mkdir -p plz-out/bin/backend
go build -o plz-out/bin/backend/seed-daemon-${{ matrix.config.daemon_name }}.exe ./backend/cmd/seed-daemon
env:
GOOS: "windows"
GOARCH: ${{ matrix.config.goarch }}
CGO_ENABLED: 1

- name: Set MacOS signing certs
if: startsWith(matrix.config.os, 'macos')
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
run: |
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p $APPLE_KEYCHAIN_PASSWORD build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p $APPLE_KEYCHAIN_PASSWORD build.keychain
security import certificate.p12 -k build.keychain -P $APPLE_CERTIFICATE_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k $APPLE_KEYCHAIN_PASSWORD build.keychain
rm -fr *.p12
security set-keychain-settings -lut 1200 # prevent the keychain to get locked before codesign is done
- name: Set temporal version in package.json
run: |
node scripts/set-desktop-version.mjs
env:
VITE_VERSION: "${{ needs.build-info.outputs.version }}"
- name: Build, package & make (Unix)
if: matrix.config.os != 'windows-latest'
run: |
yarn desktop:publish --arch=${{ matrix.config.arch }}
env:
timeout-minutes: 10
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DAEMON_NAME: ${{ matrix.config.daemon_name }}
VITE_VERSION: "${{ needs.build-info.outputs.version }}"
VITE_COMMIT_HASH: "${{ github.sha }}"
VITE_DESKTOP_P2P_PORT: "57000"
VITE_DESKTOP_HTTP_PORT: "57001"
VITE_DESKTOP_GRPC_PORT: "57002"
VITE_DESKTOP_APPDATA: "Seed-dev"
VITE_DESKTOP_HOSTNAME: "http://localhost"
VITE_LIGHTNING_API_URL: "https://ln.testnet.seed.hyper.media"
VITE_GATEWAY_URL: "https://dev.hyper.media"
VITE_DESKTOP_SENTRY_DSN: "${{ secrets.DESKTOP_SENTRY_DSN }}"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
SEED_P2P_TESTNET_NAME: "dev"

- name: Build, package and make (Win32)
if: startsWith(matrix.config.os, 'windows')
run: |
yarn desktop:publish --arch=${{ matrix.config.arch }}
env:
timeout-minutes: 10
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DAEMON_NAME: "${{ matrix.config.daemon_name }}.exe"
VITE_VERSION: "${{ needs.build-info.outputs.version }}"
VITE_COMMIT_HASH: "${{ github.sha }}"
VITE_DESKTOP_P2P_PORT: "57000"
VITE_DESKTOP_HTTP_PORT: "57001"
VITE_DESKTOP_GRPC_PORT: "57002"
VITE_DESKTOP_APPDATA: "Seed-dev"
VITE_DESKTOP_HOSTNAME: "http://localhost"
VITE_LIGHTNING_API_URL: "https://ln.seed.hyper.media"
VITE_GATEWAY_URL: "https://dev.hyper.media"
VITE_DESKTOP_SENTRY_DSN: "${{ secrets.DESKTOP_SENTRY_DSN }}"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
SEED_P2P_TESTNET_NAME: "dev"

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.config.daemon_name }}
path: frontend/apps/desktop/out/make/**/*

notify-on-discord:
needs: [build-info, build-binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

# Step 3: Generate artifact URLs and send to Discord
- name: Send Discord Notification
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
VERSION: ${{ needs.build-info.outputs.version }}
run: |
# Debug: List all files in artifacts directory
echo "Listing all files in artifacts directory:"
find artifacts -type f -ls
# Get the GitHub Action Run URL base
BASE_URL="https://seedappdev.s3.eu-west-2.amazonaws.com/dev/latest"
# List all artifacts and construct URLs
MESSAGE="**New dev version: ${VERSION}**"
for file in $(find artifacts -type f); do
FILE_NAME=$(basename "$file")
ARTIFACT_URL="${BASE_URL}/${FILE_NAME}"
MESSAGE="${MESSAGE}\n - [${FILE_NAME}](${ARTIFACT_URL})"
done
# Send the message to Discord
echo "Sending Discord Notification..."
PAYLOAD=$(printf '{"content": "%s"}' "$MESSAGE")
curl -X POST -H "Content-Type: application/json" -d "$PAYLOAD" "$DISCORD_WEBHOOK_URL"
26 changes: 11 additions & 15 deletions .github/workflows/desktop-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ permissions:
contents: write

on:
workflow_dispatch:
schedule:
- cron: "0 8 * * 1-5"
push:
tags:
- "*.*.*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -28,8 +28,7 @@ jobs:
- name: Set Version
id: set_version
run: |
chmod +x ./scripts/generate-daily-version.sh
VERSION=$(./scripts/generate-daily-version.sh ${{ github.ref }})
VERSION=${{ github.ref_name }}
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Display Version
Expand All @@ -50,7 +49,6 @@ jobs:
build-binaries:
name: Build ${{ matrix.config.os }} @ ${{ matrix.config.arch }}
runs-on: ${{ matrix.config.os }}
# if: startsWith(github.ref, 'refs/tags/')
needs: [build-info, frontend-tests]
strategy:
matrix:
Expand All @@ -63,7 +61,7 @@ jobs:
arch: arm64
goarch: arm64
daemon_name: aarch64-apple-darwin
- os: ubuntu-24.04
- os: ubuntu-latest
arch: x64
goarch: amd64
daemon_name: x86_64-unknown-linux-gnu
Expand Down Expand Up @@ -121,50 +119,48 @@ jobs:
node scripts/set-desktop-version.mjs
env:
VITE_VERSION: "${{ needs.build-info.outputs.version }}"

- name: Build, package & make (Unix)
if: matrix.config.os != 'windows-latest'
run: |
yarn desktop:make --arch=${{ matrix.config.arch }}
yarn desktop:publish --arch=${{ matrix.config.arch }}
# DEBUG=electron-notarize*
env:
timeout-minutes: 10
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DAEMON_NAME: ${{ matrix.config.daemon_name }}
VITE_VERSION: "${{ needs.build-info.outputs.version }}"
# VITE_VERSION: "0.0.100"
VITE_COMMIT_HASH: "${{ github.sha }}"
VITE_DESKTOP_P2P_PORT: "56000"
VITE_DESKTOP_HTTP_PORT: "56001"
VITE_DESKTOP_GRPC_PORT: "56002"
VITE_DESKTOP_APPDATA: "Seed"
VITE_DESKTOP_HOSTNAME: "http://localhost"
VITE_LIGHTNING_API_URL: "https://ln.seed.hyper.media"
VITE_GATEWAY_URL: "https://hyper.media"
VITE_DESKTOP_SENTRY_DSN: "${{ secrets.DESKTOP_SENTRY_DSN }}"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

- name: Build, package and make (Win32)
if: matrix.config.os == 'windows-latest'
if: startsWith(matrix.config.os, 'windows')
run: |
yarn desktop:make --arch=${{ matrix.config.arch }}
yarn desktop:publish --arch=${{ matrix.config.arch }}
env:
timeout-minutes: 10
NODE_OPTIONS: --max_old_space_size=4096
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DAEMON_NAME: "${{ matrix.config.daemon_name }}.exe"
VITE_VERSION: "${{ needs.build-info.outputs.version }}"
# VITE_VERSION: "0.0.100"
VITE_COMMIT_HASH: "${{ github.sha }}"
VITE_DESKTOP_P2P_PORT: "56000"
VITE_DESKTOP_HTTP_PORT: "56001"
VITE_DESKTOP_GRPC_PORT: "56002"
VITE_DESKTOP_APPDATA: "Seed"
VITE_DESKTOP_HOSTNAME: "http://localhost"
VITE_LIGHTNING_API_URL: "https://ln.seed.hyper.media"
VITE_GATEWAY_URL: "https://hyper.media"
VITE_DESKTOP_SENTRY_DSN: "${{ secrets.DESKTOP_SENTRY_DSN }}"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"

Expand Down Expand Up @@ -193,6 +189,6 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
tag_name: "${{ needs.build-info.outputs.version }}"
prerelease: false
prerelease: true
generate_release_notes: true
files: ./artifacts/artifacts-*/**/*
2 changes: 1 addition & 1 deletion .github/workflows/desktop-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
config:
- os: macos-latest
- os: macos-13-large
arch: x64
goarch: amd64
daemon_name: x86_64-apple-darwin
Expand Down
Loading

0 comments on commit 6681a57

Please sign in to comment.