-
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (89 loc) · 3.78 KB
/
go-test.yml
File metadata and controls
99 lines (89 loc) · 3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Go tests
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
jobs:
build:
name: Build and test on ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- os: linux
arch: amd64
runner: ubuntu-24.04
- os: linux
arch: arm64
runner: ubuntu-24.04-arm
- os: darwin
arch: amd64
runner: macos-15-intel
- os: darwin
arch: arm64
runner: macos-15
fail-fast: false
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Install libclang for generator
run: |
if [ "${{ matrix.os }}" = "linux" ]; then
sudo apt-get update
# Use libclang-18 which works with Newbluecake/bootstrap v0.17.1 (supports clang 17+)
sudo apt-get install -y libclang-18-dev llvm-18-dev
echo "CGO_LDFLAGS=-L/usr/lib/llvm-18/lib" >> $GITHUB_ENV
echo "CGO_CFLAGS=-I/usr/lib/llvm-18/include" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/usr/lib/llvm-18/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
elif [ "${{ matrix.os }}" = "darwin" ]; then
# On macOS, use LLVM 18 to match Linux environment
brew install llvm@18 || brew install llvm
if [ -d "$(brew --prefix llvm@18)" ]; then
LLVM_PREFIX=$(brew --prefix llvm@18)
else
LLVM_PREFIX=$(brew --prefix llvm)
echo "::warning::Using latest LLVM on macOS instead of version 18"
fi
echo "CGO_LDFLAGS=-L${LLVM_PREFIX}/lib" >> $GITHUB_ENV
echo "CGO_CFLAGS=-I${LLVM_PREFIX}/include" >> $GITHUB_ENV
echo "PATH=${LLVM_PREFIX}/bin:$PATH" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=${LLVM_PREFIX}/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
fi
- name: Download FFmpeg libraries
run: go run ./cmd/download-lib/
- name: Build
run: go build -v .
# Note: macOS may show linker warnings about version mismatches if the static
# libraries were built on a newer macOS version than the runner.
# These warnings are harmless - the libraries have MACOSX_DEPLOYMENT_TARGET=13.0
- name: Test
run: go test -v .
# The generator creates Go bindings from FFmpeg headers using libclang.
# It's only needed during development when FFmpeg is updated.
# Using Newbluecake/bootstrap v0.17.1 which supports LLVM/Clang 17+
- name: Run generator (optional - for development only)
run: |
echo "::notice::Generator uses Newbluecake/bootstrap v0.17.1 which supports LLVM 17+"
echo "::notice::Using LLVM 18 in CI, compatible with the fork's clang 17 support"
echo "Running generator with environment:"
echo "CGO_LDFLAGS=$CGO_LDFLAGS"
echo "CGO_CFLAGS=$CGO_CFLAGS"
go run ./internal/generator 2>&1 | grep -v "cgo-gcc-prolog\|deprecated" || true
continue-on-error: true
- name: Check for generated code differences
run: |
if ! git diff --quiet *.gen.go; then
echo "::notice title=Generated Code Diff on ${{ matrix.os }}/${{ matrix.arch }}::Generated bindings differ from committed version. This may be platform-specific behavior."
git diff *.gen.go > /tmp/generator-diff.txt
echo "::group::Generator Diff"
cat /tmp/generator-diff.txt
echo "::endgroup::"
else
echo "::notice title=Generated Code Match on ${{ matrix.os }}/${{ matrix.arch }}::Generated bindings match committed version."
fi
continue-on-error: true