mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-06-19 19:03:00 +02:00
Developers can attach sample files to a PR and list their target paths within the fate-suite in a fate-samples block in the PR description: ```fate-samples vorbis/tos.ogg mov/some-new-sample.mov ``` A new inject-pr-samples.py script fetches the PR metadata from the Forgejo API, resolves each listed path to its matching attachment by filename, and downloads the files into the fate-suite directory before FATE runs. The script validates that pr-number is an integer, that paths are relative, contain no '..', and are at most 3 components deep (matching the deepest paths in the existing fate-suite). Attachment URLs are restricted to the code.ffmpeg.org domain. The script exports a new_samples=true/false output via $FORGEJO_OUTPUT. After FATE completes, a final workflow step fails the run if any new sample was injected, reminding contributors to add their samples to the official fate-suite before the PR can be merged. The script can also be used locally: SAMPLES=/path/to/fate-suite .forgejo/inject-pr-samples.py <pr-number>
140 lines
5.4 KiB
YAML
140 lines
5.4 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
concurrency:
|
|
cancel-in-progress: ${{ forge.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
run_fate:
|
|
name: Fate (${{ matrix.runner }}, ${{ matrix.shared }}, ${{ matrix.bits }} bit)
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
runner: [linux-aarch64]
|
|
shared: ['static']
|
|
bits: ['64']
|
|
include:
|
|
- runner: linux-amd64
|
|
shared: 'static'
|
|
bits: '32'
|
|
- runner: linux-amd64
|
|
shared: 'shared'
|
|
bits: '64'
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Configure
|
|
run: |
|
|
./configure --enable-gpl --enable-nonfree --enable-memory-poisoning --assert-level=2 \
|
|
$([ "${{ matrix.bits }}" != "32" ] || echo --arch=x86_32 --extra-cflags=-m32 --extra-cxxflags=-m32 --extra-ldflags=-m32) \
|
|
$([ "${{ matrix.shared }}" != "shared" ] || echo --enable-shared --disable-static) \
|
|
|| CFGRES=$?
|
|
cat ffbuild/config.log
|
|
exit ${CFGRES:-0}
|
|
- name: Build
|
|
run: make -j$(nproc)
|
|
- name: Restore Cached Fate-Suite
|
|
id: cache
|
|
uses: actions/cache/restore@v5
|
|
with:
|
|
path: fate-suite
|
|
key: fate-suite
|
|
restore-keys: |
|
|
fate-suite-
|
|
- name: Sync Fate-Suite
|
|
id: fate
|
|
run: |
|
|
make fate-rsync SAMPLES=$PWD/fate-suite
|
|
echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | sort | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
|
|
- name: Cache Fate-Suite
|
|
uses: actions/cache/save@v5
|
|
if: ${{ format('fate-suite-{0}', steps.fate.outputs.hash) != steps.cache.outputs.cache-matched-key }}
|
|
with:
|
|
path: fate-suite
|
|
key: fate-suite-${{ steps.fate.outputs.hash }}
|
|
- name: Inject PR Samples
|
|
id: inject
|
|
if: ${{ forge.event_name == 'pull_request' }}
|
|
run: SAMPLES=$PWD/fate-suite .forgejo/inject-pr-samples.py ${{ forge.event.pull_request.number }}
|
|
- name: Run Fate
|
|
run: |
|
|
LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make fate fate-build SAMPLES="$PWD/fate-suite" -j$(nproc) || FATERES=$?
|
|
find . -name "*.err" -exec printf '::group::%s\n' {} \; -exec cat {} \; -exec printf '::endgroup::\n' \;
|
|
exit ${FATERES:-0}
|
|
- name: Fail if new samples were injected
|
|
if: ${{ steps.inject.outputs.new_samples == 'true' }}
|
|
run: |
|
|
echo "New FATE samples were injected from PR attachments. Please add them to the official fate-suite before merging."
|
|
exit 1
|
|
run_fate_full:
|
|
name: Fate (Full, ${{ matrix.target_exec }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
image: ['ghcr.io/btbn/ffmpeg-builds/win64-gpl:latest']
|
|
target_exec: ['wine']
|
|
runs-on: linux-amd64
|
|
container: ${{ matrix.image }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
path: ffmpeg
|
|
- name: Configure
|
|
run: |
|
|
mkdir build && cd build
|
|
../ffmpeg/configure --pkg-config-flags="--static" $FFBUILD_TARGET_FLAGS $FF_CONFIGURE \
|
|
--cc="$CC" --cxx="$CXX" --ar="$AR" --ranlib="$RANLIB" --nm="$NM" \
|
|
--extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" \
|
|
--extra-libs="$FF_LIBS" --extra-ldflags="$FF_LDFLAGS" --extra-ldexeflags="$FF_LDEXEFLAGS" \
|
|
--enable-memory-poisoning --assert-level=2 --target-exec="${{ matrix.target_exec }}" \
|
|
--enable-hardcoded-tables \
|
|
|| CFGRES=$?
|
|
cat ffbuild/config.log
|
|
exit ${CFGRES:-0}
|
|
- name: Build
|
|
run: make -C build -j$(nproc)
|
|
- name: Restore Cached Fate-Suite
|
|
id: cache
|
|
uses: actions/cache/restore@v5
|
|
with:
|
|
path: fate-suite
|
|
key: fate-suite
|
|
restore-keys: |
|
|
fate-suite-
|
|
- name: Sync Fate-Suite
|
|
id: fate
|
|
run: |
|
|
make -C build fate-rsync SAMPLES=$PWD/fate-suite
|
|
echo "hash=$(find fate-suite -type f -printf "%P %s %T@\n" | sort | sha256sum | cut -d' ' -f1)" >> $FORGEJO_OUTPUT
|
|
- name: Cache Fate-Suite
|
|
uses: actions/cache/save@v5
|
|
if: ${{ format('fate-suite-{0}', steps.fate.outputs.hash) != steps.cache.outputs.cache-matched-key }}
|
|
with:
|
|
path: fate-suite
|
|
key: fate-suite-${{ steps.fate.outputs.hash }}
|
|
- name: Inject PR Samples
|
|
id: inject
|
|
if: ${{ forge.event_name == 'pull_request' }}
|
|
run: SAMPLES=$PWD/fate-suite ffmpeg/.forgejo/inject-pr-samples.py ${{ forge.event.pull_request.number }}
|
|
- name: Run Fate
|
|
run: |
|
|
if [[ "${{ matrix.target_exec }}" == "wine" ]]; then
|
|
export WINEDEBUG=-all
|
|
export FREI0R_PATH="$(winepath -w "$FREI0R_PATH")"
|
|
fi
|
|
LD_LIBRARY_PATH="$(printf "%s:" "$PWD"/lib*)$PWD" make -C build fate fate-build SAMPLES="$PWD/fate-suite" -j$(nproc) || FATERES=$?
|
|
find . -name "*.err" -exec printf '::group::%s\n' {} \; -exec cat {} \; -exec printf '::endgroup::\n' \;
|
|
exit ${FATERES:-0}
|
|
- name: Fail if new samples were injected
|
|
if: ${{ steps.inject.outputs.new_samples == 'true' }}
|
|
run: |
|
|
echo "New FATE samples were injected from PR attachments. Please add them to the official fate-suite before merging."
|
|
exit 1
|