Compare commits
14 Commits
5ff7affd95
...
v1.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ed1d4f60e | ||
|
|
a639558ce4 | ||
|
|
3dc4942942 | ||
|
|
ed8f9a4538 | ||
|
|
1283fdc9c4 | ||
|
|
71017f1e61 | ||
|
|
81d73e9b08 | ||
|
|
36111ff781 | ||
|
|
3a1db4e80c | ||
|
|
7284b9d4b9 | ||
|
|
206f158c8e | ||
|
|
2cd818c331 | ||
|
|
952552302a | ||
|
|
b6224cd2fd |
117
.gitea/workflows/build.yml
Normal file
117
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
name: Build and Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
tags: ['v*']
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: msys2 {0}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.24'
|
||||||
|
cache: false
|
||||||
|
|
||||||
|
- name: Setup MSYS2
|
||||||
|
uses: msys2/setup-msys2@v2
|
||||||
|
with:
|
||||||
|
msystem: MINGW64
|
||||||
|
path-type: inherit
|
||||||
|
update: true
|
||||||
|
install: >-
|
||||||
|
mingw-w64-x86_64-gcc
|
||||||
|
mingw-w64-x86_64-opus
|
||||||
|
mingw-w64-x86_64-opusfile
|
||||||
|
mingw-w64-x86_64-portaudio
|
||||||
|
mingw-w64-x86_64-pkgconf
|
||||||
|
zip
|
||||||
|
|
||||||
|
- name: Build TUI
|
||||||
|
run: |
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
mkdir -p dist
|
||||||
|
# More descriptive name: ts3-tui
|
||||||
|
go build -o dist/ts3-tui.exe ./cmd/tui
|
||||||
|
# Copy DLLs
|
||||||
|
cp /mingw64/bin/libogg-0.dll dist/
|
||||||
|
cp /mingw64/bin/libopus-0.dll dist/
|
||||||
|
cp /mingw64/bin/libopusfile-0.dll dist/
|
||||||
|
cp /mingw64/bin/libportaudio-2.dll dist/ || true
|
||||||
|
# Create ZIP with architecture name
|
||||||
|
cd dist && zip -r ../ts3-tui-windows-x86_64.zip . *
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ts3-tui-windows-zip
|
||||||
|
path: ts3-tui-windows-x86_64.zip
|
||||||
|
|
||||||
|
build-linux:
|
||||||
|
runs-on: linux-x86_64
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.24'
|
||||||
|
cache: false
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y \
|
||||||
|
libportaudio2 portaudio19-dev \
|
||||||
|
libopus-dev libopusfile-dev \
|
||||||
|
libpulse-dev pkg-config gcc
|
||||||
|
|
||||||
|
- name: Build TUI
|
||||||
|
run: |
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
export ARCH=$(uname -m)
|
||||||
|
mkdir -p dist
|
||||||
|
# More descriptive name: ts3-tui-linux-ARCH
|
||||||
|
go build -o dist/ts3-tui-linux-${ARCH} ./cmd/tui
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ts3-tui-linux-binaries
|
||||||
|
path: dist/*
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: [build-windows, build-linux]
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Generate Changelog
|
||||||
|
run: |
|
||||||
|
# Get commits since the last tag (or since the beginning)
|
||||||
|
git log --oneline $(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD)..HEAD > changelog.txt
|
||||||
|
|
||||||
|
- name: Download Artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
body_path: changelog.txt
|
||||||
|
files: |
|
||||||
|
ts3-tui-windows-zip/ts3-tui-windows-x86_64.zip
|
||||||
|
ts3-tui-linux-binaries/*
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -4,7 +4,8 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
func redirectStderr(f *os.File) {
|
func redirectStderr(f *os.File) {
|
||||||
@@ -12,12 +13,12 @@ func redirectStderr(f *os.File) {
|
|||||||
// Silence altogether if no debug file
|
// Silence altogether if no debug file
|
||||||
null, err := os.OpenFile(os.DevNull, os.O_WRONLY, 0)
|
null, err := os.OpenFile(os.DevNull, os.O_WRONLY, 0)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
syscall.Dup2(int(null.Fd()), int(os.Stderr.Fd()))
|
_ = unix.Dup2(int(null.Fd()), int(os.Stderr.Fd()))
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect fd 2 (stderr) to our debug file
|
// Redirect fd 2 (stderr) to our debug file
|
||||||
// This captures C-level library noise (ALSA, PortAudio) into the log
|
// This captures C-level library noise (ALSA, PortAudio) into the log
|
||||||
syscall.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
|
_ = unix.Dup2(int(f.Fd()), int(os.Stderr.Fd()))
|
||||||
}
|
}
|
||||||
|
|||||||
47
readme.md
47
readme.md
@@ -73,3 +73,50 @@ This project uses Go **build tags** to support multiple platforms from the same
|
|||||||
|
|
||||||
### Pro Tip: VS Code Remote - WSL
|
### Pro Tip: VS Code Remote - WSL
|
||||||
For the best experience when working on Linux features from Windows, use the **WSL extension**. Open VS Code inside your WSL environment (`code .` from the WSL terminal). This allows `gopls` to run directly in Linux, where all system headers and libraries are natively available.
|
For the best experience when working on Linux features from Windows, use the **WSL extension**. Open VS Code inside your WSL environment (`code .` from the WSL terminal). This allows `gopls` to run directly in Linux, where all system headers and libraries are natively available.
|
||||||
|
|
||||||
|
## 🤖 Gitea Actions (CI/CD)
|
||||||
|
|
||||||
|
El archivo `.gitea/workflows/build.yml` automatiza la compilación y la creación de Releases.
|
||||||
|
|
||||||
|
1. **Builds automáticas**: Cada `push` a `master` genera artefactos descargables.
|
||||||
|
2. **Releases automáticas**: Al subir un tag (`git tag v*`), se crea una Release con:
|
||||||
|
- `ts3-tui-windows-x86_64.zip` (Portable: exe + dlls).
|
||||||
|
- `ts3-tui-linux-x86_64` (Para PC/WSL2).
|
||||||
|
- `ts3-tui-linux-aarch64` (Para ARM/Raspberry Pi).
|
||||||
|
|
||||||
|
### Cómo usar tu propio Windows como Runner
|
||||||
|
|
||||||
|
Si tu Gitea no tiene runners públicos, puedes convertir tu propia máquina Windows en uno:
|
||||||
|
|
||||||
|
1. **Descarga `act_runner`**: Descarga el binario oficial de [Gitea Actions Runner](https://gitea.com/gitea/act_runner/releases).
|
||||||
|
2. **Registro**:
|
||||||
|
- Ve a tu instancia de Gitea -> Administración del Sitio -> Actions -> Runners.
|
||||||
|
- Copia el **Registration Token**.
|
||||||
|
- Ejecuta: `./act_runner register`
|
||||||
|
- Introduce la URL de tu Gitea y el token.
|
||||||
|
- En **labels**, asegúrate de poner `windows-latest:host`.
|
||||||
|
3. **Ejecución**:
|
||||||
|
- Lanza el runner: `./act_runner daemon`.
|
||||||
|
- Ahora, cualquier push lanzará la build en tu PC de forma automática.
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> El workflow usa **MSYS2** automáticamente para instalar `opus` y `portaudio` en el entorno temporal de la build, así que no necesitas configurar nada extra en el sistema del runner.
|
||||||
|
|
||||||
|
### Cómo añadir un Runner en WSL2 (para x86_64)
|
||||||
|
|
||||||
|
Si tu runner principal es ARM (como una Raspberry Pi) y quieres compilar para tu PC (x86_64), lo mejor es poner un runner dentro de WSL2:
|
||||||
|
|
||||||
|
1. **Entra en WSL2**: Ejecuta `wsl` en tu terminal.
|
||||||
|
2. **Descarga `act_runner`**:
|
||||||
|
```bash
|
||||||
|
curl -L https://gitea.com/gitea/act_runner/releases/download/v0.2.13/act_runner-0.2.13-linux-amd64 -o act_runner
|
||||||
|
chmod +x act_runner
|
||||||
|
```
|
||||||
|
3. **Registro**:
|
||||||
|
- Igual que en Windows, usa `./act_runner register` con el token de tu Gitea.
|
||||||
|
- En **labels**, pon algo como `linux-x86_64:host`.
|
||||||
|
4. **Actualiza el workflow**:
|
||||||
|
- En `.gitea/workflows/build.yml`, cambia `runs-on: ubuntu-latest` por `runs-on: linux-x86_64` en el job `build-linux`.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Al usar el label `:host`, el runner usará las herramientas instaladas en tu Linux de WSL2 sin necesidad de Docker, lo que lo hace mucho más rápido.
|
||||||
|
|||||||
Reference in New Issue
Block a user