CI: Avoid docker containers in favor of prebuilt binaries (#83)

* CI: Use wang-bin/avbuild binaries for Linux

* Add fix for broken .pc files

* Update some tests to be more flexible re: FFmpeg
This commit is contained in:
FreezyLemon 2024-11-04 12:45:37 +01:00 committed by GitHub
parent f1c6b442b5
commit 5834596af4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 59 additions and 26 deletions

View File

@ -23,30 +23,54 @@ env:
jobs: jobs:
build-test-lint-linux: build-test-lint-linux:
name: Linux - FFmpeg ${{ matrix.ffmpeg_version }} - build, test and lint name: Linux - FFmpeg ${{ matrix.ffmpeg.version }} - build, test and lint
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
container: jrottenberg/ffmpeg:${{ matrix.ffmpeg_version }}-ubuntu
strategy: strategy:
matrix: matrix:
ffmpeg_version: ffmpeg:
- "4.2" - version: "4.2"
- "4.3" file: "ffmpeg-4.2-linux-gcc.tar.xz"
- "4.4" - version: "4.3"
- "5.0" file: "ffmpeg-4.3-linux-gcc.tar.xz"
- "5.1" - version: "4.4"
- "6.0" file: "ffmpeg-4.4-linux-clang-default.tar.xz"
- "6.1" lib_subdir: "amd64"
- "7.0" - version: "5.1"
- "7.1" file: "ffmpeg-5.1-linux-clang-default.tar.xz"
lib_subdir: "amd64"
- version: "6.1"
file: "ffmpeg-6.1-linux-clang-default.tar.xz"
lib_subdir: "amd64"
- version: "7.0"
file: "ffmpeg-7.0-linux-clang-default.tar.xz"
lib_subdir: "amd64"
- version: "7.1"
file: "ffmpeg-7.1-linux-clang-default.tar.xz"
lib_subdir: "amd64"
fail-fast: false fail-fast: false
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install dependencies - name: Install dependencies
run: | run: |
apt-get update sudo apt-get update
apt-get install -y --no-install-recommends clang curl pkg-config sudo apt-get install -y --no-install-recommends \
libva2 libva-drm2 libva-x11-2 libvdpau1 libxv1
- name: Download FFmpeg
shell: bash
run: |
mkdir ffmpeg-libs
curl -L "https://sourceforge.net/projects/avbuild/files/linux/${{ matrix.ffmpeg.file }}/download" \
| tar xJf - --strip 1 -C ffmpeg-libs
# https://github.com/wang-bin/avbuild/issues/76
PC_FILES=(ffmpeg-libs/lib/${{ matrix.ffmpeg.lib_subdir }}/pkgconfig/*.pc)
sed -i 's/^prefix=.*$/prefix=${pcfiledir}\/..\/..\/../g' $PC_FILES
sed -i 's/^libdir=.*$/libdir=${prefix}\/lib\/${{ matrix.ffmpeg.lib_subdir }}/g' $PC_FILES
echo "PKG_CONFIG_PATH=$PWD/ffmpeg-libs/lib/${{ matrix.ffmpeg.lib_subdir }}/pkgconfig" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$PWD/ffmpeg-libs/lib/${{ matrix.ffmpeg.lib_subdir }}" >> "$GITHUB_ENV"
- name: Install Rust stable with clippy and rustfmt - name: Install Rust stable with clippy and rustfmt
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
@ -55,7 +79,7 @@ jobs:
with: with:
prefix-key: "v3-rust" prefix-key: "v3-rust"
# Only save cache for one FFmpeg version # Only save cache for one FFmpeg version
save-if: ${{ matrix.ffmpeg_version == '7.1' }} save-if: ${{ matrix.ffmpeg.version == '7.1' }}
- name: Check format - name: Check format
run: cargo fmt -- --check run: cargo fmt -- --check
@ -166,14 +190,23 @@ jobs:
msrv: msrv:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
container: jrottenberg/ffmpeg:7.0-ubuntu
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install dependencies - name: Download FFmpeg
shell: bash
run: | run: |
apt-get update mkdir ffmpeg-libs
apt-get install -y --no-install-recommends clang curl pkg-config curl -L "https://sourceforge.net/projects/avbuild/files/linux/ffmpeg-7.1-linux-clang-lite.tar.xz/download" \
| tar xJf - --strip 1 -C ffmpeg-libs
# https://github.com/wang-bin/avbuild/issues/76
PC_FILES=(ffmpeg-libs/lib/amd64/pkgconfig/*.pc)
sed -i 's/^prefix=.*$/prefix=${pcfiledir}\/..\/..\/../g' $PC_FILES
sed -i 's/^libdir=.*$/libdir=${prefix}\/lib\/amd64/g' $PC_FILES
echo "PKG_CONFIG_PATH=$PWD/ffmpeg-libs/lib/amd64/pkgconfig" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$PWD/ffmpeg-libs" >> "$GITHUB_ENV"
# rust-version from Cargo.toml # rust-version from Cargo.toml
- name: Install Rust 1.65.0 - name: Install Rust 1.65.0
uses: dtolnay/rust-toolchain@1.65.0 uses: dtolnay/rust-toolchain@1.65.0

View File

@ -46,11 +46,11 @@ where
/// # Example /// # Example
/// ///
/// ``` /// ```
/// use ffmpeg_the_third::codec::{encoder, Id}; /// use ffmpeg_the_third::codec::{decoder, Id};
/// use ffmpeg_the_third::format::sample::{Sample, Type}; /// use ffmpeg_the_third::format::sample::{Sample, Type};
/// ///
/// let codec = encoder::find(Id::MP3) /// let codec = decoder::find(Id::MP3)
/// .expect("Can find an MP3 encoder") /// .expect("Can find an MP3 decoder")
/// .audio() /// .audio()
/// .unwrap(); /// .unwrap();
/// ///
@ -297,7 +297,7 @@ mod test {
#[test] #[test]
fn audio_encoder() { fn audio_encoder() {
let codec = encoder::find(Id::MP3).expect("can find mp3 encoder"); let codec = encoder::find(Id::OPUS).expect("can find opus encoder");
// looks like every codec returns Supported::All for color space. // looks like every codec returns Supported::All for color space.
// might change in a future FFmpeg release // might change in a future FFmpeg release
@ -352,15 +352,15 @@ mod test {
#[test] #[test]
fn supports() { fn supports() {
let codec = encoder::find(Id::VP9).expect("can find VP9 encoder"); let codec = encoder::find(Id::FFV1).expect("can find FFV1 encoder");
assert!(supported_color_ranges(codec, None) assert!(supported_color_ranges(codec, None)
.expect("can check color range support") .expect("can check color range support")
.supports(Range::JPEG)); .supports(Range::MPEG));
assert!(!supported_pixel_formats(codec, None) assert!(!supported_pixel_formats(codec, None)
.expect("can check color range support") .expect("can check color range support")
.supports(Pixel::BGR8)); .supports(Pixel::GRAY16));
assert!(supported_frame_rates(codec, None) assert!(supported_frame_rates(codec, None)
.expect("can check frame rate support") .expect("can check frame rate support")