1- name : Build
1+ name : Build & Test
22
33on :
44 push :
55 branches : ["main", "master"]
6+ pull_request :
7+ branches : ["main", "master"]
68
79jobs :
8- build :
9- name : Build FrameExtractor
10- runs-on : ${{ matrix.os }}
10+ build-windows :
11+ name : Build Windows - ${{ matrix.arch }} (${{ matrix.compiler }})
12+ runs-on : windows-latest
1113 strategy :
14+ fail-fast : false
1215 matrix :
13- os : [ubuntu-latest, windows-latest]
16+ arch : [x64, ARM64]
17+ compiler : [MSVC, MinGW]
18+ exclude :
19+ # MinGW doesn't support ARM64
20+ - arch : ARM64
21+ compiler : MinGW
1422
1523 steps :
1624 - name : Checkout repository
@@ -19,14 +27,212 @@ jobs:
1927 - name : Setup .NET SDK
2028 uses : actions/setup-dotnet@v4
2129 with :
22- dotnet-version : ' 8.x'
30+ dotnet-version : ' 8.0.x'
31+
32+ - name : Setup MinGW (x64 only)
33+ if : matrix.compiler == 'MinGW'
34+ uses : msys2/setup-msys2@v2
35+ with :
36+ msystem : MINGW64
37+ update : true
38+ install : >-
39+ mingw-w64-x86_64-gcc
40+ mingw-w64-x86_64-make
2341
2442 - name : Restore dependencies
2543 run : dotnet restore
2644
27- - name : Build project
28- run : dotnet build --configuration Release --no-restore
45+ - name : Build with MSVC
46+ if : matrix.compiler == 'MSVC'
47+ run : |
48+ dotnet build `
49+ --configuration Release `
50+ --no-restore `
51+ -p:RuntimeIdentifier=win-${{ matrix.arch }} `
52+ -p:PlatformTarget=${{ matrix.arch }}
53+
54+ - name : Build with MinGW
55+ if : matrix.compiler == 'MinGW'
56+ shell : msys2 {0}
57+ run : |
58+ export PATH="/mingw64/bin:$PATH"
59+ dotnet build \
60+ --configuration Release \
61+ --no-restore \
62+ -p:RuntimeIdentifier=win-x64 \
63+ -p:UseMinGW=true
2964
3065 - name : Run tests
31- run : dotnet test --no-build --verbosity normal
66+ run : dotnet test --no-build --verbosity normal --configuration Release
3267 continue-on-error : true
68+
69+ - name : Publish
70+ run : |
71+ $rid = "win-${{ matrix.arch }}"
72+ $compiler = "${{ matrix.compiler }}"
73+
74+ dotnet publish FrameExtractor/FrameExtractor.csproj `
75+ -c Release `
76+ -r $rid `
77+ -p:SelfContained=true `
78+ -p:PublishSingleFile=true `
79+ -p:IncludeNativeLibrariesForSelfExtract=true `
80+ -p:PublishTrimmed=false `
81+ -p:DebugType=None `
82+ -p:DebugSymbols=false `
83+ -o artifacts/$compiler-$rid
84+
85+ - name : Upload build artifacts
86+ uses : actions/upload-artifact@v4
87+ with :
88+ name : FrameExtractor-Windows-${{ matrix.arch }}-${{ matrix.compiler }}
89+ path : artifacts/${{ matrix.compiler }}-win-${{ matrix.arch }}/*
90+ retention-days : 7
91+
92+ build-linux-appimage :
93+ name : Build Linux AppImage - ${{ matrix.arch }}
94+ runs-on : ubuntu-latest
95+ strategy :
96+ fail-fast : false
97+ matrix :
98+ arch : [x86_64, aarch64]
99+
100+ steps :
101+ - name : Checkout repository
102+ uses : actions/checkout@v4
103+
104+ - name : Setup .NET SDK
105+ uses : actions/setup-dotnet@v4
106+ with :
107+ dotnet-version : ' 8.0.x'
108+
109+ - name : Install AppImage tools
110+ run : |
111+ sudo apt-get update
112+ sudo apt-get install -y wget fuse libfuse2
113+
114+ # Download appimagetool
115+ wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${{ matrix.arch }}.AppImage
116+ chmod +x appimagetool-${{ matrix.arch }}.AppImage
117+ sudo mv appimagetool-${{ matrix.arch }}.AppImage /usr/local/bin/appimagetool
118+
119+ - name : Setup cross-compilation for ARM64
120+ if : matrix.arch == 'aarch64'
121+ run : |
122+ sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
123+
124+ - name : Restore dependencies
125+ run : dotnet restore
126+
127+ - name : Publish
128+ run : |
129+ if [ "${{ matrix.arch }}" == "x86_64" ]; then
130+ RID="linux-x64"
131+ else
132+ RID="linux-arm64"
133+ fi
134+
135+ dotnet publish FrameExtractor/FrameExtractor.csproj \
136+ -c Release \
137+ -r $RID \
138+ -p:SelfContained=true \
139+ -p:PublishSingleFile=true \
140+ -p:IncludeNativeLibrariesForSelfExtract=true \
141+ -p:PublishTrimmed=false \
142+ -p:DebugType=None \
143+ -p:DebugSymbols=false \
144+ -o publish/$RID
145+
146+ - name : Create AppImage structure
147+ run : |
148+ if [ "${{ matrix.arch }}" == "x86_64" ]; then
149+ RID="linux-x64"
150+ else
151+ RID="linux-arm64"
152+ fi
153+
154+ # Create AppDir structure
155+ mkdir -p AppDir/usr/bin
156+ mkdir -p AppDir/usr/share/applications
157+ mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
158+ mkdir -p AppDir/usr/share/metainfo
159+
160+ # Copy application
161+ cp publish/$RID/FrameExtractor AppDir/usr/bin/
162+ chmod +x AppDir/usr/bin/FrameExtractor
163+
164+ # Copy icon from repository
165+ cp Assets/Icons/FrameExtractor_Icon.png AppDir/usr/share/icons/hicolor/256x256/apps/
166+
167+ # Create desktop file
168+ cat > AppDir/usr/share/applications/frameextractor.desktop << 'EOF'
169+ [Desktop Entry]
170+ Type=Application
171+ Name=FrameExtractor
172+ Comment=Video frame extraction tool
173+ Exec=FrameExtractor
174+ Icon=FrameExtractor_Icon
175+ Categories=AudioVideo;Video;
176+ Terminal=false
177+ EOF
178+
179+ # Create icon (placeholder - replace with actual icon)
180+ cat > AppDir/usr/share/icons/hicolor/256x256/apps/FrameExtractor_Icon.png << 'EOF'
181+ EOF
182+
183+ # Create AppStream metadata
184+ cat > AppDir/usr/share/metainfo/frameextractor.appdata.xml << 'EOF'
185+ <?xml version="1.0" encoding="UTF-8"?>
186+ <component type="desktop">
187+ <id>com.frameextractor.FrameExtractor</id>
188+ <name>FrameExtractor</name>
189+ <summary>Video frame extraction tool</summary>
190+ <description>
191+ <p>Extract frames from video files with FFmpeg integration</p>
192+ </description>
193+ <launchable type="desktop-id">frameextractor.desktop</launchable>
194+ <url type="homepage">https://github.com/nokarin-dev/FrameExtractor</url>
195+ <provides>
196+ <binary>FrameExtractor</binary>
197+ </provides>
198+ <releases>
199+ <release version="2.0.1" date="2024-12-02"/>
200+ </releases>
201+ </component>
202+ EOF
203+
204+ # Create AppRun
205+ cat > AppDir/AppRun << 'EOF'
206+ #!/bin/bash
207+ SELF=$(readlink -f "$0")
208+ HERE=${SELF%/*}
209+ export PATH="${HERE}/usr/bin:${PATH}"
210+ export LD_LIBRARY_PATH="${HERE}/usr/lib:${LD_LIBRARY_PATH}"
211+ exec "${HERE}/usr/bin/FrameExtractor" "$@"
212+ EOF
213+
214+ chmod +x AppDir/AppRun
215+
216+ # Create .DirIcon link
217+ ln -sf usr/share/icons/hicolor/256x256/apps/FrameExtractor_Icon.png AppDir/.DirIcon
218+
219+ - name : Build AppImage
220+ run : |
221+ if [ "${{ matrix.arch }}" == "x86_64" ]; then
222+ RID="linux-x64"
223+ else
224+ RID="linux-arm64"
225+ fi
226+
227+ # Build AppImage
228+ ARCH=${{ matrix.arch }} appimagetool AppDir FrameExtractor-${{ matrix.arch }}.AppImage
229+
230+ # Make executable
231+ chmod +x FrameExtractor-${{ matrix.arch }}.AppImage
232+
233+ - name : Upload AppImage artifact
234+ uses : actions/upload-artifact@v4
235+ with :
236+ name : FrameExtractor-Linux-${{ matrix.arch }}-AppImage
237+ path : FrameExtractor-${{ matrix.arch }}.AppImage
238+ retention-days : 7
0 commit comments