Files
cuframes/.gitea/workflows/build.yml
T
gx 2b94742df4
build / cmake build (CUDA 12.4, Ubuntu 22.04) (pull_request) Successful in 6m24s
build / ffmpeg filter patch (out-of-tree) (pull_request) Successful in 6m21s
ci: retry + explicit Node 20 version check в bootstrap
Symptom (run #1826 fail на u4-runner):
  Bootstrap step молча установил Node 12 (Ubuntu default) вместо Node 20
  из NodeSource → actions/checkout@v4 не парсится (ES2022 static blocks).

Cause:
  curl ... setup_20.x на slow network (u4 через VPN) timeout/fail silently,
  apt install fallback на default ubuntu nodejs (Node 12). Без error.

Fix:
  - curl --retry 3 --retry-delay 5 --connect-timeout 30
  - retry-loop на NodeSource setup (3 попытки)
  - явная verification major version >= 18 после install, fail с exit 1
    если установился Node < 18

Применяется к обоим jobs (cmake-build и filter-build).

Связано: PR #4 (v0.2), run #1826 fail.
2026-05-19 17:31:33 +01:00

182 lines
7.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: build
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'docs/**'
- 'BENCHMARKS.md'
- 'ROADMAP.md'
- 'CHANGELOG.md'
- 'LICENSE'
- '.gitea/ISSUE_TEMPLATE/**'
pull_request:
branches: [main]
jobs:
cmake-build:
name: cmake build (CUDA 12.4, Ubuntu 22.04)
runs-on: ubuntu-22.04
container:
image: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
steps:
# actions/checkout@v4 требует Node 20+. Ubuntu 22.04 apt даёт Node 12 — не подходит.
# Ставим Node 20 из NodeSource repo.
- name: Bootstrap Node 20 + git (для actions/checkout)
run: |
set -e
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends curl git ca-certificates gnupg
# NodeSource setup может молча упасть на slow networks (особенно через VPN
# на u4-runner); retry + явная verification что Node >= 18 после install.
for i in 1 2 3; do
if curl -fsSL --retry 3 --retry-delay 5 --connect-timeout 30 \
https://deb.nodesource.com/setup_20.x | bash -; then
break
fi
echo "NodeSource setup attempt $i failed, retrying..."
sleep 10
done
apt-get install -y --no-install-recommends nodejs
NODE_VER=$(node --version)
echo "node: $NODE_VER"
# actions/checkout@v4 требует Node 20+ (ES2022 static blocks).
# Если NodeSource setup упал и установился Ubuntu's Node 12 — фейлим явно.
NODE_MAJOR=$(echo "$NODE_VER" | sed -E 's/^v([0-9]+).*/\1/')
if [ "$NODE_MAJOR" -lt 18 ]; then
echo "ERROR: Node $NODE_VER too old, NodeSource setup likely failed" >&2
exit 1
fi
- name: Install build deps
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get install -y --no-install-recommends \
build-essential cmake ninja-build pkg-config \
libavformat-dev libavcodec-dev libavutil-dev libswscale-dev
- name: Checkout
uses: actions/checkout@v4
- name: Configure (full — libcuframes + examples + tools)
run: |
cmake -B build -S . -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DBUILD_EXAMPLES=ON \
-DBUILD_TOOLS=ON \
-DBUILD_FFMPEG_FILTER=OFF \
-DBUILD_PYTHON_BINDINGS=OFF
- name: Build
run: cmake --build build --parallel
- name: Verify produced binaries + library
run: |
ls -la build/libcuframes/libcuframes.so*
ls -la build/libcuframes/libcuframes_static.a
ls -la build/tools/cuframes-rtsp-source/cuframes-rtsp-source
ls -la build/examples/sub_count/sub_count
./build/tools/cuframes-rtsp-source/cuframes-rtsp-source --help | head -5
- name: Install + verify install layout
run: |
cmake --install build --prefix /tmp/cuframes-install
test -f /tmp/cuframes-install/include/cuframes/cuframes.h
test -f /tmp/cuframes-install/include/cuframes/cuframes.hpp
test -f /tmp/cuframes-install/lib/libcuframes.so
test -f /tmp/cuframes-install/lib/libcuframes_static.a
filter-build:
name: ffmpeg filter patch (out-of-tree)
runs-on: ubuntu-22.04
container:
image: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
needs: cmake-build
steps:
- name: Bootstrap Node 20 + git (для actions/checkout)
run: |
set -e
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends curl git ca-certificates gnupg
# NodeSource setup может молча упасть на slow networks (особенно через VPN
# на u4-runner); retry + явная verification что Node >= 18 после install.
for i in 1 2 3; do
if curl -fsSL --retry 3 --retry-delay 5 --connect-timeout 30 \
https://deb.nodesource.com/setup_20.x | bash -; then
break
fi
echo "NodeSource setup attempt $i failed, retrying..."
sleep 10
done
apt-get install -y --no-install-recommends nodejs
NODE_VER=$(node --version)
echo "node: $NODE_VER"
# actions/checkout@v4 требует Node 20+ (ES2022 static blocks).
# Если NodeSource setup упал и установился Ubuntu's Node 12 — фейлим явно.
NODE_MAJOR=$(echo "$NODE_VER" | sed -E 's/^v([0-9]+).*/\1/')
if [ "$NODE_MAJOR" -lt 18 ]; then
echo "ERROR: Node $NODE_VER too old, NodeSource setup likely failed" >&2
exit 1
fi
- name: Install build deps
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get install -y --no-install-recommends \
build-essential cmake ninja-build pkg-config nasm \
libssl-dev libx264-dev libx265-dev libnuma-dev zlib1g-dev \
wget patch
- name: Checkout
uses: actions/checkout@v4
- name: Build libcuframes (для linking в patched ffmpeg)
run: |
cmake -B build -S . -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TOOLS=OFF
cmake --build build --parallel
cmake --install build --prefix /opt/cuframes
# Clone уже-patched FFmpeg fork с локального gitea (быстро + offline).
# Используем ${GITHUB_SERVER_URL} — runner подставит свой view на gitea:
# на R9-runner = http://192.168.88.23:3222, на u4-runner = http://10.8.0.6:3222 (VPN).
# Hardcoded https://git.goldix.org/... не работает на u4 — нет route к public IP.
- name: Clone patched FFmpeg fork (local gitea mirror)
run: |
git clone --depth 1 --branch n7.1-cuframes \
"${GITHUB_SERVER_URL}/gx/ffmpeg-patched.git" /src/ffmpeg
ls /src/ffmpeg/libavformat/cuframesdec.c
- name: Configure FFmpeg (minimal + libcuframes)
run: |
cd /src/ffmpeg
./configure \
--prefix=/opt/ffmpeg \
--enable-libcuframes \
--extra-cflags="-I/opt/cuframes/include -I/usr/local/cuda/include" \
--extra-ldflags="-L/opt/cuframes/lib -L/usr/local/cuda/lib64" \
--extra-libs="-lcudart -lpthread -lrt -lm" \
--disable-x86asm --disable-everything \
--enable-demuxer=cuframes,rawvideo \
--enable-decoder=rawvideo \
--enable-muxer=null,rawvideo \
--enable-protocol=file --enable-ffmpeg \
--disable-doc --disable-htmlpages --disable-manpages \
--disable-podpages --disable-txtpages
- name: Build FFmpeg
run: |
cd /src/ffmpeg
make -j$(nproc) ffmpeg
- name: Verify cuframes demuxer registered
run: |
export LD_LIBRARY_PATH=/opt/cuframes/lib
/src/ffmpeg/ffmpeg -hide_banner -formats | grep cuframes
/src/ffmpeg/ffmpeg -hide_banner -h demuxer=cuframes | head -10