Skip to content

Build

Build #608

Workflow file for this run

name: Build
on:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
branches:
- '*'
tags:
- 'v*'
workflow_dispatch: ~
schedule:
- cron: '0 16 * * *'
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [win64,linux64,linuxarm64]
container: ghcr.io/btbn/ffmpeg-builds/${{ matrix.target }}-gpl:latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clone FFmpeg
id: ffclone
run: |
set -xe
git clone --filter=blob:none https://github.com/FFmpeg/FFmpeg.git /FFmpeg
echo "ffsha=$(git -C /FFmpeg rev-parse --verify HEAD)" >> $GITHUB_OUTPUT
echo "contsha=$(curl --unix-socket /var/run/docker.sock http://localhost/containers/${HOSTNAME}/json | python3 -c "import sys, json; print(json.load(sys.stdin)['Image'].rpartition(':')[2])")" >> $GITHUB_OUTPUT
- name: Cache FFmpeg
id: ffcache
uses: actions/cache@v3
with:
path: /FFmpeg
key: ffcache-${{ matrix.target }}-${{ steps.ffclone.outputs.ffsha }}-${{ steps.ffclone.outputs.contsha }}
- name: Build FFmpeg
if: ${{ steps.ffcache.outputs.cache-hit != 'true' }}
run: |
set -xe
cd /FFmpeg
./configure --prefix="$FFBUILD_PREFIX" --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS \
--disable-debug --disable-shared --enable-static --disable-programs --disable-doc --enable-gpl --enable-version3 \
--enable-zlib --enable-libx264 --enable-libx265 --enable-libvpx --enable-libass --enable-libmp3lame \
--enable-libzimg
make -j$(nproc)
- name: Install FFmpeg
run: |
set -xe
cd /FFmpeg
make install
- name: Build GLFW
run: |
set -xe
git clone --filter=blob:none https://github.com/glfw/glfw.git /glfw
cd /glfw
mkdir build && cd build
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \
-DBUILD_SHARED_LIBS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_WAYLAND=OFF ..
ninja -j$(nproc)
ninja install
- name: Build
run: |
set -xe
make -j$(nproc) CC="${FFBUILD_CROSS_PREFIX}gcc" CXX="${FFBUILD_CROSS_PREFIX}g++" \
PKG_CONFIG_FLAGS="--static" PKG_CONFIG_PATH="$PKG_CONFIG_LIBDIR"
- name: Prepare artifacts
run: |
set -xe
${FFBUILD_CROSS_PREFIX}strip --strip-unneeded lavfi-preview*
mkdir artifacts
mv lavfi-preview* artifacts/lavfi-preview-${{ matrix.target }}$(test -f *.exe && echo .exe)
xz -9 -e artifacts/*
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: lavfi-preview
path: artifacts/*
release:
name: Release
needs: build
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: lavfi-preview
path: artifacts
- name: Create Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -xe
TAGNAME="${GITHUB_REF#refs/*/}"
gh release create -t "Release $TAGNAME" $TAGNAME artifacts/*