Skip to content

codec_context.go and format_context.go (#111) #374

codec_context.go and format_context.go (#111)

codec_context.go and format_context.go (#111) #374

Workflow file for this run

name: Test
on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master" ]
jobs:
test-cpu:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
FFMPEG_VERSION: n7.0
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- if: ${{ runner.os == 'Windows' }}
name: Prepare windows
run: |
echo "FFMPEG_PATH=$(cygpath -u $(cd ~ && pwd))/ffmpeg" >> $env:GITHUB_ENV
choco install --allow-empty-checksums pkgconfiglite
- if: ${{ runner.os != 'Windows' }}
name: Prepare non windows
run: |
echo "FFMPEG_PATH=$(echo ~)/ffmpeg" >> $GITHUB_ENV
- if: ${{ runner.os == 'Windows' }}
name: Set windows ffmpeg cache path
run: |
echo "FFMPEG_CACHE_PATH=$(cygpath -w ${{ env.FFMPEG_PATH }})" >> $env:GITHUB_ENV
- if: ${{ runner.os != 'Windows' }}
name: Set non-windows ffmpeg cache path
run: |
echo "FFMPEG_CACHE_PATH=${{ env.FFMPEG_PATH }}" >> $GITHUB_ENV
- name: Load ffmpeg cache
id: load-ffmpeg-cache
uses: actions/cache@v4
with:
path: ${{ env.FFMPEG_CACHE_PATH }}
key: ffmpeg-${{ env.FFMPEG_VERSION }}-${{ runner.os }}
- if: ${{ steps.load-ffmpeg-cache.outputs.cache-hit != 'true' && runner.os == 'Linux' }}
name: Prepare linux ffmpeg install
run: |
sudo apt-get install yasm
- if: ${{ steps.load-ffmpeg-cache.outputs.cache-hit != 'true' && runner.os == 'macOS' }}
name: Prepare macos ffmpeg install
run: |
brew install yasm
- if: ${{ steps.load-ffmpeg-cache.outputs.cache-hit != 'true' && runner.os == 'Windows' }}
name: Prepare windows ffmpeg install
run: |
choco install make
choco install yasm
echo "FFMPEG_PATCH_PATH='$(cygpath -u ${{ github.WORKSPACE }})/.github/workflows/windows.patch'" >> $env:GITHUB_ENV
- if: ${{ steps.load-ffmpeg-cache.outputs.cache-hit != 'true' }}
name: Install ffmpeg
run: |
make install-ffmpeg srcPath=${{ env.FFMPEG_PATH }}/src version=${{ env.FFMPEG_VERSION }} patchPath=${{ env.FFMPEG_PATCH_PATH }}
- if: ${{ steps.load-ffmpeg-cache.outputs.cache-hit != 'true' }}
name: Save ffmpeg cache
uses: actions/cache/save@v4
with:
path: ${{ env.FFMPEG_CACHE_PATH }}
key: ffmpeg-${{ env.FFMPEG_VERSION }}-${{ runner.os }}
- if: ${{ runner.os == 'Windows' }}
name: Set windows environment variables
run: |
echo "CGO_LDFLAGS=-L${{ env.FFMPEG_PATH }}/lib/" >> $env:GITHUB_ENV
echo "CGO_CFLAGS=-I${{ env.FFMPEG_PATH }}/include/" >> $env:GITHUB_ENV
echo "PKG_CONFIG_PATH=$(cygpath -w ${{ env.FFMPEG_PATH }}/lib/pkgconfig)" >> $env:GITHUB_ENV
- if: ${{ runner.os != 'Windows' }}
name: Set non-windows environment variables
run: |
echo "CGO_LDFLAGS=-L${{ env.FFMPEG_PATH }}/lib/" >> $GITHUB_ENV
echo "CGO_CFLAGS=-I${{ env.FFMPEG_PATH }}/include/" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${{ env.FFMPEG_PATH }}/lib/pkgconfig" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Install dependencies
run: go mod download
- name: Run tests
run: |
go test -v -race -covermode atomic -coverprofile=covprofile ./...
- if: github.event_name != 'pull_request'
name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: |
go install github.com/mattn/goveralls@latest
goveralls -coverprofile=covprofile -service=github