Skip to content

Commit 9e6552e

Browse files
committed
feat(build): add CI workflows for Linux and Windows builds with dependency installation scripts
1 parent c77a0e1 commit 9e6552e

6 files changed

Lines changed: 450 additions & 0 deletions

File tree

.github/workflows/build-all.yml

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
name: Build All Platforms
2+
3+
# Trigger: solo cuando se crea un tag de versión
4+
on:
5+
push:
6+
tags:
7+
- 'v*'
8+
workflow_dispatch:
9+
10+
env:
11+
GO_VERSION: '1.21'
12+
NODE_VERSION: '20'
13+
14+
jobs:
15+
# Job para Windows
16+
build-windows:
17+
name: Build Windows
18+
runs-on: windows-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
submodules: recursive
25+
26+
- name: Setup Go
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version: ${{ env.GO_VERSION }}
30+
cache: true
31+
cache-dependency-path: go.sum
32+
33+
- name: Setup pnpm
34+
uses: pnpm/action-setup@v4
35+
with:
36+
version: 10
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: ${{ env.NODE_VERSION }}
42+
cache: 'pnpm'
43+
cache-dependency-path: frontend/pnpm-lock.yaml
44+
45+
- name: Install frontend dependencies
46+
working-directory: ./frontend
47+
run: pnpm install --frozen-lockfile
48+
49+
- name: Build frontend
50+
working-directory: ./frontend
51+
run: pnpm build
52+
53+
- name: Install Wails
54+
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
55+
56+
- name: Build Wails application
57+
run: wails build -platform windows/amd64
58+
59+
- name: Rename artifact
60+
shell: bash
61+
run: |
62+
mv build/bin/Sendlog-Syslog.exe build/bin/Sendlog-Syslog-windows-amd64.exe
63+
64+
- name: Upload artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: windows-build
68+
path: build/bin/Sendlog-Syslog-windows-amd64.exe
69+
retention-days: 1
70+
71+
# Job para Linux
72+
build-linux:
73+
name: Build Linux
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v4
79+
with:
80+
submodules: recursive
81+
82+
- name: Install Linux dependencies
83+
run: |
84+
sudo apt-get update
85+
sudo apt-get install -y \
86+
libgtk-3-dev \
87+
libwebkit2gtk-4.0-dev \
88+
build-essential \
89+
pkg-config \
90+
libappindicator3-dev
91+
92+
- name: Setup Go
93+
uses: actions/setup-go@v5
94+
with:
95+
go-version: ${{ env.GO_VERSION }}
96+
cache: true
97+
cache-dependency-path: go.sum
98+
99+
- name: Setup pnpm
100+
uses: pnpm/action-setup@v4
101+
with:
102+
version: 10
103+
104+
- name: Setup Node.js
105+
uses: actions/setup-node@v4
106+
with:
107+
node-version: ${{ env.NODE_VERSION }}
108+
cache: 'pnpm'
109+
cache-dependency-path: frontend/pnpm-lock.yaml
110+
111+
- name: Install frontend dependencies
112+
working-directory: ./frontend
113+
run: pnpm install --frozen-lockfile
114+
115+
- name: Build frontend
116+
working-directory: ./frontend
117+
run: pnpm build
118+
119+
- name: Install Wails
120+
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
121+
122+
- name: Build Wails application
123+
run: wails build -platform linux/amd64
124+
125+
- name: Rename artifact
126+
run: |
127+
mv build/bin/Sendlog-Syslog build/bin/Sendlog-Syslog-linux-amd64
128+
129+
- name: Upload artifact
130+
uses: actions/upload-artifact@v4
131+
with:
132+
name: linux-build
133+
path: build/bin/Sendlog-Syslog-linux-amd64
134+
retention-days: 1
135+
136+
# Job para crear el release con todos los binarios
137+
create-release:
138+
name: Create Release
139+
needs: [build-windows, build-linux]
140+
runs-on: ubuntu-latest
141+
if: startsWith(github.ref, 'refs/tags/v')
142+
143+
steps:
144+
- name: Checkout code
145+
uses: actions/checkout@v4
146+
147+
- name: Download Windows artifact
148+
uses: actions/download-artifact@v4
149+
with:
150+
name: windows-build
151+
path: ./release
152+
153+
- name: Download Linux artifact
154+
uses: actions/download-artifact@v4
155+
with:
156+
name: linux-build
157+
path: ./release
158+
159+
- name: List release files
160+
run: ls -la ./release
161+
162+
- name: Extract version from tag
163+
id: version
164+
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
165+
166+
- name: Create GitHub Release
167+
uses: softprops/action-gh-release@v1
168+
with:
169+
name: SendLog Syslog ${{ steps.version.outputs.version }}
170+
body: |
171+
## SendLog Syslog ${{ steps.version.outputs.version }}
172+
173+
### Downloads
174+
- **Windows**: `Sendlog-Syslog-windows-amd64.exe`
175+
- **Linux**: `Sendlog-Syslog-linux-amd64`
176+
177+
### Linux Installation
178+
```bash
179+
chmod +x Sendlog-Syslog-linux-amd64
180+
./Sendlog-Syslog-linux-amd64
181+
```
182+
183+
### Requirements
184+
- **Linux**: GTK3 and WebKitGTK runtime libraries
185+
```bash
186+
sudo apt install libgtk-3-0 libwebkit2gtk-4.0-37
187+
```
188+
files: |
189+
./release/Sendlog-Syslog-windows-amd64.exe
190+
./release/Sendlog-Syslog-linux-amd64
191+
draft: false
192+
prerelease: false
193+
env:
194+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-linux.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Build Linux Release
2+
3+
# Trigger del workflow
4+
on:
5+
# Se ejecuta cuando haces push a la rama main o creas un tag
6+
push:
7+
branches:
8+
- main
9+
tags:
10+
- 'v*'
11+
# Permite ejecutar manualmente desde la pestaña Actions
12+
workflow_dispatch:
13+
14+
# Variables de entorno globales
15+
env:
16+
GO_VERSION: '1.21'
17+
NODE_VERSION: '20'
18+
19+
jobs:
20+
build-linux:
21+
name: Build for Linux
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
# 1. Checkout del código
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
submodules: recursive
30+
31+
# 2. Instalar dependencias de sistema para Wails (GTK + WebKit)
32+
- name: Install Linux dependencies
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y \
36+
libgtk-3-dev \
37+
libwebkit2gtk-4.0-dev \
38+
build-essential \
39+
pkg-config \
40+
libappindicator3-dev
41+
42+
# 3. Setup Go con cache de dependencias
43+
- name: Setup Go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version: ${{ env.GO_VERSION }}
47+
cache: true
48+
cache-dependency-path: go.sum
49+
50+
# 4. Setup pnpm
51+
- name: Setup pnpm
52+
uses: pnpm/action-setup@v4
53+
with:
54+
version: 10
55+
56+
# 5. Setup Node.js con cache integrado
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: ${{ env.NODE_VERSION }}
61+
cache: 'pnpm'
62+
cache-dependency-path: frontend/pnpm-lock.yaml
63+
64+
# 6. Instalar dependencias del frontend
65+
- name: Install frontend dependencies
66+
working-directory: ./frontend
67+
run: pnpm install --frozen-lockfile
68+
69+
# 7. Build del frontend (producción)
70+
- name: Build frontend
71+
working-directory: ./frontend
72+
run: pnpm build
73+
74+
# 8. Instalar Wails CLI
75+
- name: Install Wails
76+
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
77+
78+
# 9. Build de la aplicación Wails para Linux
79+
- name: Build Wails application
80+
run: wails build -platform linux/amd64
81+
82+
# 10. Crear nombre del artefacto con timestamp
83+
- name: Get timestamp
84+
id: timestamp
85+
run: echo "timestamp=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
86+
87+
# 11. Upload del ejecutable como artefacto
88+
- name: Upload Linux executable
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: Send-Log-TCP-linux-${{ steps.timestamp.outputs.timestamp }}
92+
path: |
93+
build/bin/Sendlog-Syslog
94+
retention-days: 30
95+
96+
# 12. (Opcional) Crear release si es un tag
97+
- name: Create Release
98+
if: startsWith(github.ref, 'refs/tags/v')
99+
uses: softprops/action-gh-release@v1
100+
with:
101+
files: build/bin/Sendlog-Syslog
102+
draft: false
103+
prerelease: false
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ The application features a clean, card-based interface with:
5353
- Node.js 18+
5454
- pnpm
5555

56+
### Linux (Ubuntu/Debian) Dependencies
57+
```bash
58+
sudo apt update
59+
sudo apt install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
60+
```
61+
62+
Or use the automated script:
63+
```bash
64+
./scripts/install-linux-deps.sh
65+
```
66+
5667
### Setup
5768

5869
1. Clone the repository:
@@ -81,6 +92,15 @@ wails dev
8192

8293
## 🏗️ Building
8394

95+
### Linux (Ubuntu/Debian)
96+
```bash
97+
# First time: Install dependencies
98+
./scripts/install-linux-deps.sh
99+
100+
# Build
101+
./scripts/build-linux.sh
102+
```
103+
84104
### Windows
85105
```bash
86106
./scripts/build-windows.sh

main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/wailsapp/wails/v2/pkg/logger"
99
"github.com/wailsapp/wails/v2/pkg/options"
1010
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
11+
"github.com/wailsapp/wails/v2/pkg/options/linux"
1112
"github.com/wailsapp/wails/v2/pkg/options/mac"
1213
"github.com/wailsapp/wails/v2/pkg/options/windows"
1314
)
@@ -77,6 +78,13 @@ func main() {
7778
Icon: icon,
7879
},
7980
},
81+
// Linux platform specific options
82+
Linux: &linux.Options{
83+
Icon: icon,
84+
WindowIsTranslucent: false,
85+
WebviewGpuPolicy: linux.WebviewGpuPolicyAlways,
86+
ProgramName: "SendLog Syslog",
87+
},
8088
})
8189

8290
if err != nil {

scripts/build-linux.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
echo -e "Start running the script..."
4+
cd ../
5+
6+
echo -e "Checking Linux dependencies..."
7+
8+
# Check for required packages
9+
check_dependency() {
10+
if ! pkg-config --exists "$1" 2>/dev/null; then
11+
echo -e "\033[31mError: $1 is not installed.\033[0m"
12+
echo -e "Install it with: sudo apt install $2"
13+
exit 1
14+
fi
15+
}
16+
17+
check_dependency "gtk+-3.0" "libgtk-3-dev"
18+
check_dependency "webkit2gtk-4.0" "libwebkit2gtk-4.0-dev"
19+
20+
echo -e "\033[32mAll dependencies satisfied!\033[0m"
21+
22+
echo -e "Start building the app for Linux platform..."
23+
wails build --clean --platform linux/amd64
24+
25+
if [ $? -eq 0 ]; then
26+
echo -e "\033[32mBuild successful!\033[0m"
27+
echo -e "Output: build/bin/Sendlog-Syslog"
28+
else
29+
echo -e "\033[31mBuild failed!\033[0m"
30+
exit 1
31+
fi
32+
33+
echo -e "End running the script!"

0 commit comments

Comments
 (0)