@@ -3,90 +3,62 @@ name: build and test
33on :
44 push :
55 branches : [ main ]
6- pull_request :
6+ pull_request_target :
77 branches : [ main ]
88
99jobs :
10- debug-windows :
10+ build-and-test :
11+ strategy :
12+ fail-fast : false
13+ matrix :
14+ os : [windows-latest, ubuntu-latest]
15+ configuration : [Debug, Release]
1116
12- runs-on : windows-latest
13- environment : test-windows-x64
17+ runs-on : ${{ matrix.os }}
18+ environment : ${{ matrix.os == 'windows-latest' && ' test-windows-x64' || 'test-linux-x64' }}
1419
1520 steps :
16- - uses : actions/checkout@v6
17- - name : Setup .NET
18- uses : actions/setup-dotnet@v5
21+ - name : Checkout (push)
22+ if : github.event_name == 'push'
23+ uses : actions/checkout@v6
24+ - name : Checkout base branch (pull_request_target)
25+ if : github.event_name == 'pull_request_target'
26+ uses : actions/checkout@v6
1927 with :
20- dotnet-version : |
21- 10.0.x
22- - name : Clean
23- run : dotnet clean --configuration Debug && dotnet nuget locals all --clear
24- - name : Install dependencies
25- run : dotnet restore
26- - name : Build
27- run : dotnet build --configuration Debug --no-restore
28- - name : Test
29- run : dotnet test --configuration Debug --no-build --verbosity normal
30-
31- debug-linux :
32-
33- runs-on : ubuntu-latest
34- environment : test-linux-x64
35-
36- steps :
37- - uses : actions/checkout@v6
38- - name : Setup .NET
39- uses : actions/setup-dotnet@v5
28+ ref : ${{ github.event.pull_request.base.ref }}
29+ - name : Download ffmpeg binaries
30+ run : |
31+ curl -L "${{ secrets.FFMPEG_BINARIES_URL }}" -o file.zip
32+ - name : Unzip ffmpeg binaries on Linux
33+ if : runner.os == 'Linux'
34+ run : |
35+ sudo apt-get update
36+ sudo apt-get install -y unzip
37+ unzip file.zip -d Binaries
38+ rm file.zip
39+ - name : Unzip ffmpeg binaries on Windows
40+ if : runner.os == 'Windows'
41+ run : |
42+ Expand-Archive -Path file.zip -DestinationPath Binaries
43+ Remove-Item file.zip
44+ - name : Checkout PR head (pull_request_target)
45+ if : github.event_name == 'pull_request_target'
46+ uses : actions/checkout@v6
4047 with :
41- dotnet-version : |
42- 10.0.x
43- - name : Clean
44- run : dotnet clean --configuration Debug && dotnet nuget locals all --clear
45- - name : Install dependencies
46- run : dotnet restore
47- - name : Build
48- run : dotnet build --configuration Debug --no-restore
49- - name : Test
50- run : dotnet test --configuration Debug --no-build --verbosity normal
51-
52- release-windows :
53-
54- runs-on : windows-latest
55- environment : test-windows-x64
56-
57- steps :
58- - uses : actions/checkout@v6
59- - name : Setup .NET
60- uses : actions/setup-dotnet@v5
61- with :
62- dotnet-version : |
63- 10.0.x
64- - name : Clean
65- run : dotnet clean --configuration Release && dotnet nuget locals all --clear
66- - name : Install dependencies
67- run : dotnet restore
68- - name : Build
69- run : dotnet build --configuration Release --no-restore
70- - name : Test
71- run : dotnet test --configuration Release --no-build --verbosity normal
72-
73- release-linux :
74-
75- runs-on : ubuntu-latest
76- environment : test-linux-x64
77-
78- steps :
79- - uses : actions/checkout@v6
48+ ref : ${{ github.event.pull_request.head.sha }}
49+ clean : false
8050 - name : Setup .NET
8151 uses : actions/setup-dotnet@v5
8252 with :
8353 dotnet-version : |
8454 10.0.x
8555 - name : Clean
86- run : dotnet clean --configuration Release && dotnet nuget locals all --clear
56+ run : dotnet clean --configuration ${{ matrix.configuration }} && dotnet nuget locals all --clear
8757 - name : Install dependencies
8858 run : dotnet restore
8959 - name : Build
90- run : dotnet build --configuration Release --no-restore
60+ run : dotnet build --configuration ${{ matrix.configuration }} --no-restore
9161 - name : Test
92- run : dotnet test --configuration Release --no-build --verbosity normal
62+ run : dotnet test --configuration ${{ matrix.configuration }} --no-build --verbosity normal
63+ env :
64+ FFMPEG_BINARIES_PATH : ${{ github.workspace }}/Binaries
0 commit comments