build: test ffmpeg github action

This commit is contained in:
Adrian Shum 2022-09-16 00:45:44 +08:00 committed by GitHub
parent 56847d375d
commit feb4a1f3db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 132 additions and 1 deletions

131
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,131 @@
name: test
on: [push, pull_request]
jobs:
build:
name: Test
runs-on: ubuntu-20.04
env:
CGO_CFLAGS_ALLOW: -Xpreprocessor
VIPS_VERSION: 8.13.0
FFMPEG_VERSION: 5.1.1
V: 1
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.19
- name: Check out code
uses: actions/checkout@v2
- name: Install linux dependencies
run: |
sudo add-apt-repository -y ppa:lovell/cgif
sudo add-apt-repository -y ppa:strukturag/libde265
sudo add-apt-repository -y ppa:strukturag/libheif
sudo apt-get update
sudo apt-get install -y \
python3-pip ninja-build \
glib-2.0-dev libexpat-dev librsvg2-dev libpng-dev \
libjpeg-turbo8-dev libimagequant-dev libfftw3-dev \
libpoppler-glib-dev libxml2-dev \
libopenslide-dev libcfitsio-dev liborc-0.4-dev libpango1.0-dev \
libtiff5-dev libgsf-1-dev giflib-tools libwebp-dev libheif-dev \
yasm libx264-dev libx265-dev libnuma-dev libvpx-dev libtheora-dev \
librtmp-dev libvorbis-dev \
libopenjp2-7-dev libcgif-dev
sudo pip3 install meson
- name: Cache libvips
uses: actions/cache@v3
with:
path: vips-${{ env.VIPS_VERSION }}
key: ${{ runner.os }}-vips-${{ env.V }}-${{ env.VIPS_VERSION }}
restore-keys: |
${{ runner.os }}-vips-${{ env.V }}-
- name: Build libvips from source
run: |
if [ ! -d "vips-${{ env.VIPS_VERSION }}" ]
then
wget https://github.com/libvips/libvips/releases/download/v${{ env.VIPS_VERSION }}/vips-${{ env.VIPS_VERSION }}.tar.gz
tar xf vips-${{ env.VIPS_VERSION }}.tar.gz
fi
cd vips-${{ env.VIPS_VERSION }}
meson setup _build \
--buildtype=release \
--strip \
--prefix=/usr/local \
--libdir=lib \
-Dgtk_doc=false \
-Dmagick=disabled \
-Dintrospection=false
ninja -C _build
sudo ninja -C _build install
sudo ldconfig
- name: Cache ffmpeg
uses: actions/cache@v3
with:
path: ffmpeg-${{ env.FFMPEG_VERSION }}
key: ${{ runner.os }}-ffmpeg-${{ env.V }}-${{ env.FFMPEG_VERSION }}
restore-keys: |
${{ runner.os }}-ffmpeg-${{ env.V }}-
- name: Build ffmpeg from source
run: |
if [ ! -d "ffmpeg-${{ env.FFMPEG_VERSION }}" ]
then
wget https://ffmpeg.org/releases/ffmpeg-${{ env.FFMPEG_VERSION }}.tar.bz2
tar jvxf ffmpeg-${{ env.FFMPEG_VERSION }}.tar.bz2
fi
cd ffmpeg-${{ env.FFMPEG_VERSION }}
./configure --prefix=/usr/local \
--disable-debug \
--disable-doc \
--disable-ffplay \
--disable-static \
--enable-shared \
--enable-version3 \
--enable-gpl \
--enable-libtheora \
--enable-libvorbis \
--enable-librtmp \
--enable-libwebp \
--enable-libvpx \
--enable-libx265 \
--enable-libx264
make && sudo make install
sudo ldconfig
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: make get
- name: Test
run: make test
- name: Commit golden files
if: github.event_name != 'pull_request'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "test: update golden files"
file_pattern: "testdata/golden"
- name: Coveralls
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: profile.cov

View file

@ -95,7 +95,7 @@ RUN go mod download
COPY . . COPY . .
# RUN if [ "$TARGETARCH" = "amd64" ]; then go test ./...; fi RUN if [ "$TARGETARCH" = "amd64" ]; then go test ./...; fi
RUN go build -o ${GOPATH}/bin/imagorvideo ./cmd/imagorvideo/main.go RUN go build -o ${GOPATH}/bin/imagorvideo ./cmd/imagorvideo/main.go
FROM debian:bullseye-slim FROM debian:bullseye-slim