ci: add Linux and Windows build workflow for Gitea Actions
This commit is contained in:
36
.gitea/workflows/build-linux.yml
Normal file
36
.gitea/workflows/build-linux.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Build Linux
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.21'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y \
|
||||||
|
libportaudio2 \
|
||||||
|
portaudio19-dev \
|
||||||
|
libopus-dev \
|
||||||
|
libpulse-dev \
|
||||||
|
pkg-config \
|
||||||
|
gcc
|
||||||
|
|
||||||
|
- name: Build TUI
|
||||||
|
run: |
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
go build -o dist/tui_linux ./cmd/tui
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: tui-linux-binary
|
||||||
|
path: dist/tui_linux
|
||||||
40
.gitea/workflows/build-windows.yml
Normal file
40
.gitea/workflows/build-windows.yml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: Build Windows
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
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.21' # Adjust to your version
|
||||||
|
|
||||||
|
- name: Setup MSYS2
|
||||||
|
uses: msys2/setup-msys2@v2
|
||||||
|
with:
|
||||||
|
msystem: MINGW64
|
||||||
|
update: true
|
||||||
|
install: >-
|
||||||
|
mingw-w64-x86_64-gcc
|
||||||
|
mingw-w64-x86_64-opus
|
||||||
|
mingw-w64-x86_64-portaudio
|
||||||
|
pkg-config
|
||||||
|
|
||||||
|
- name: Build TUI
|
||||||
|
run: |
|
||||||
|
# Ensure Go can find the C libraries via pkg-config
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
go build -o dist/tui_windows.exe ./cmd/tui
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: tui-windows-binary
|
||||||
|
path: dist/tui_windows.exe
|
||||||
22
readme.md
22
readme.md
@@ -73,3 +73,25 @@ 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-windows.yml` automatiza la compilación en cada push.
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user