Skip to content

add pr suggestions #247

add pr suggestions

add pr suggestions #247

Workflow file for this run

name: Test
on:
push:
branches: [ "master", "dev", "leandromoreira-master" ]
pull_request:
branches: [ "master" ]
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
FFMPEG_VERSION: n5.1.2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- 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@v3
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@v3
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@v4
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