-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
169 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
|
||
test: | ||
strategy: | ||
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: Cache windows ffmpeg | ||
id: cache-ffmpeg | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.FFMPEG_CACHE_PATH }} | ||
key: ffmpeg-${{ env.FFMPEG_VERSION }}-${{ runner.os }} | ||
|
||
- if: ${{ steps.cache-ffmpeg.outputs.cache-hit != 'true' && runner.os == 'Linux' }} | ||
name: Prepare linux ffmpeg install | ||
run: | | ||
sudo apt-get install yasm | ||
- if: ${{ steps.cache-ffmpeg.outputs.cache-hit != 'true' && runner.os == 'macOS' }} | ||
name: Prepare macos ffmpeg install | ||
run: | | ||
brew install yasm | ||
- if: ${{ steps.cache-ffmpeg.outputs.cache-hit != 'true' && runner.os == 'Windows' }} | ||
name: Prepare windows ffmpeg install | ||
run: | | ||
choco install make | ||
choco install yasm | ||
echo "FFMPEG_POST_CHECKOUT='&& git apply $(cygpath -u ${{ github.WORKSPACE }})/.github/workflows/windows.patch'" >> $env:GITHUB_ENV | ||
- if: ${{ steps.cache-ffmpeg.outputs.cache-hit != 'true' }} | ||
name: Install ffmpeg | ||
run: | | ||
make install-ffmpeg srcPath=${{ env.FFMPEG_PATH }}/src version=${{ env.FFMPEG_VERSION }} postCheckout=${{ env.FFMPEG_POST_CHECKOUT }} | ||
- 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 -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# https://trac.ffmpeg.org/ticket/6620 | ||
diff --git a/ffbuild/library.mak b/ffbuild/library.mak | ||
index 793e9d41fa..e3c15e1d67 100644 | ||
--- a/ffbuild/library.mak | ||
+++ b/ffbuild/library.mak | ||
@@ -35,7 +35,8 @@ OBJS += $(SHLIBOBJS) | ||
endif | ||
$(SUBDIR)$(LIBNAME): $(OBJS) $(STLIBOBJS) | ||
$(RM) $@ | ||
- $(AR) $(ARFLAGS) $(AR_O) $^ | ||
+ $(file > objs.txt, $^) | ||
+ $(AR) $(ARFLAGS) $(AR_O) @objs.txt | ||
$(RANLIB) $@ | ||
|
||
install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
version = "n5.1.2" | ||
srcPath = "tmp/$(version)/src" | ||
postCheckout = "" | ||
|
||
generate-flags: | ||
go run internal/cmd/flags/main.go | ||
|
||
install-ffmpeg: | ||
rm -rf $(srcPath) | ||
mkdir -p $(srcPath) | ||
git clone https://github.com/FFmpeg/FFmpeg $(srcPath) | ||
cd $(srcPath) && git checkout $(version) | ||
# cd $(srcPath) is necessary for windows build since otherwise git doesn't clone in the proper dir | ||
cd $(srcPath) && git clone https://github.com/FFmpeg/FFmpeg $(srcPath) | ||
cd $(srcPath) && git checkout $(version) $(postCheckout) | ||
cd $(srcPath) && ./configure --prefix=.. $(configure) | ||
cd $(srcPath) && make | ||
cd $(srcPath) && make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//go:build !windows | ||
|
||
package astiav | ||
|
||
import "C" | ||
|
||
type cLong = C.long | ||
type cUlong = C.ulong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//go:build windows | ||
|
||
package astiav | ||
|
||
import "C" | ||
|
||
type cLong = C.longlong | ||
type cUlong = C.ulonglong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters