chore: add cross-compile workflow
This commit is contained in:
107
.gitea/workflows/cross-compile.yaml
Normal file
107
.gitea/workflows/cross-compile.yaml
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
name: Cross-Compile Binaries
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * 6'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
compile-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- name: Checkout and pull the code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Setup the Go programming language
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version: 'stable'
|
||||||
|
|
||||||
|
- name: Install build dependencies
|
||||||
|
run: |
|
||||||
|
mv /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/microsoft-prod.list.disabled
|
||||||
|
|
||||||
|
until apt-get update; do
|
||||||
|
echo -e "-----\napt-get update failed, retrying in 1s...\n-----"
|
||||||
|
sleep 1s
|
||||||
|
done
|
||||||
|
|
||||||
|
apt-get install -y \
|
||||||
|
build-essential libgl1-mesa-dev libx11-dev libxrandr-dev \
|
||||||
|
libxi-dev libxcursor-dev libxinerama-dev libglfw3-dev \
|
||||||
|
libxxf86vm-dev
|
||||||
|
|
||||||
|
- name: Compile the fyne application for native Linux
|
||||||
|
run: |
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
export CC=gcc
|
||||||
|
export CXX=g++
|
||||||
|
export GOOS=linux
|
||||||
|
export GOARCH=amd64
|
||||||
|
go build -o ./messagebox .
|
||||||
|
|
||||||
|
- name: upload the building actifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: package-linux64
|
||||||
|
path: |
|
||||||
|
./akartontv
|
||||||
|
retention-days: 7
|
||||||
|
overwrite: true
|
||||||
|
|
||||||
|
compile-windows:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- name: Checkout and pull the code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Setup the Go programming language
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version: 'stable'
|
||||||
|
|
||||||
|
- name: Install build dependencies
|
||||||
|
run: |
|
||||||
|
mv /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/microsoft-prod.list.disabled
|
||||||
|
|
||||||
|
until apt-get update; do
|
||||||
|
echo -e "-----\napt-get update failed, retrying in 1s...\n-----"
|
||||||
|
sleep 1s
|
||||||
|
done
|
||||||
|
|
||||||
|
apt-get install -y \
|
||||||
|
build-essential libgl1-mesa-dev libx11-dev libxrandr-dev \
|
||||||
|
libxi-dev libxcursor-dev libxinerama-dev libglfw3-dev \
|
||||||
|
libxxf86vm-dev gcc-mingw-w64 gcc-multilib
|
||||||
|
|
||||||
|
- name: Install go binary
|
||||||
|
run: |
|
||||||
|
go install github.com/tc-hib/go-winres@latest
|
||||||
|
env:
|
||||||
|
GOBIN: /usr/local/bin
|
||||||
|
|
||||||
|
- name: Compile the fyne application for Windows
|
||||||
|
run: |
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
export GOOS=windows
|
||||||
|
export GOARCH=amd64
|
||||||
|
export CC=x86_64-w64-mingw32-gcc
|
||||||
|
export CXX=x86_64-w64-mingw32-g++
|
||||||
|
export CGO_LDFLAGS="-static-libgcc -static-libstdc++"
|
||||||
|
go build -o ./messagebox.exe -ldflags -H=windowsgui .
|
||||||
|
|
||||||
|
- name: upload the building actifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: package-win64
|
||||||
|
path: |
|
||||||
|
./akartontv.exe
|
||||||
|
retention-days: 7
|
||||||
|
overwrite: true
|
||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user