Files
AynaLivePlayer/.github/workflows/build.yml
aynakeya 2bc19e2e0c asdf
2024-05-23 20:10:38 +08:00

91 lines
2.5 KiB
YAML

name: Build
on: [push]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
executable_ext: ""
install_deps: sudo apt-get install -y libmpv-dev libgl-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libgl1-mesa-dev xorg-dev
- os: windows-latest
goos: windows
goarch: amd64
executable_ext: ".exe"
install_deps: ""
runs-on: ${{ matrix.os }}
timeout-minutes: 10
env:
EXECUTABLE_NAME: AynaLivePlayer
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Set up environment variables
run: |
echo "GOOS=${{ matrix.goos }}" >> $GITHUB_ENV
echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV
echo "EXECUTABLE=${EXECUTABLE_NAME}${{ matrix.executable_ext }}" >> $GITHUB_ENV
- name: Install dependencies (Windows)
if: matrix.goos == 'windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
install: >-
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-mpv
- name: Set up MSYS2 environment for Go build
if: matrix.goos == 'windows'
shell: msys2 {0}
run: |
echo "CGO_CFLAGS=$(pkgconf --cflags mpv)" >> $GITHUB_ENV
echo "CGO_LDFLAGS=$(pkgconf --libs mpv)" >> $GITHUB_ENV
- name: check
if: matrix.goos == 'windows'
run: |
ls /mingw64/include
- name: Install dependencies
run: ${{ matrix.install_deps }}
- name: Install Fyne CLI
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Tidy go.mod
run: go mod tidy
- name: Bundle assets
run: |
fyne bundle --name resImageIcon --package resource ./assets/icon.png > ./resource/bundle.go
fyne bundle --append --name resFontMSYaHei --package resource ./assets/msyh0.ttf >> ./resource/bundle.go
fyne bundle --append --name resFontMSYaHeiBold --package resource ./assets/msyhbd0.ttf >> ./resource/bundle.go
- name: Build application
run: go build -o ./$EXECUTABLE app/main.go
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-build
path: ./${{ env.EXECUTABLE }}