-
Notifications
You must be signed in to change notification settings - Fork 46
113 lines (92 loc) · 3.59 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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