strawberry-audio-player-win.../.github/workflows/build.yml

188 lines
6.9 KiB
YAML

name: Build
on:
push:
pull_request:
types: [opened, synchronize, reopened]
release:
types: [published]
jobs:
build-windows-mingw:
name: Build Windows MinGW
if: github.repository != 'strawberrymusicplayer/strawberry-private'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [ 'x86_64' ]
buildtype: [ 'debug' ]
container:
image: jonaski/strawberry-mxe-${{matrix.arch}}-${{matrix.buildtype}}
steps:
- name: Set cmake buildtype
shell: bash
run: echo "cmake_buildtype=$(echo ${{matrix.buildtype}} | sed 's/.*/\u&/')" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Add safe git directory
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Create Build Environment
run: cmake -E make_directory build
- name: Link MXE directory
run: ln -s /strawberry-mxe ~/mxe-shared
- name: Run CMake
env:
PKG_CONFIG_PATH: /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/lib/pkgconfig
run: >
cmake
-S .
-B build
-DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-${{matrix.arch}}-w64-mingw32-shared.cmake"
-DCMAKE_BUILD_TYPE="${{env.cmake_buildtype}}"
-DCMAKE_PREFIX_PATH="/strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/qt6"
-DBUILD_WITH_QT6=ON
-DBUILD_WERROR=OFF
-DARCH="${{matrix.arch}}"
-DENABLE_WIN32_CONSOLE=$(test "${{matrix.buildtype}}" = "debug" && echo "ON" || echo "OFF")
-DENABLE_DBUS=OFF
-DENABLE_LIBGPOD=OFF
-DENABLE_LIBMTP=OFF
-DENABLE_AUDIOCD=OFF
-DProtobuf_PROTOC_EXECUTABLE="/strawberry-mxe/usr/x86_64-pc-linux-gnu/bin/protoc"
- name: Run Make
run: cmake --build build --config "${{env.cmake_buildtype}}" --parallel $(nproc)
- name: Create directories
working-directory: build
run: mkdir -p gio-modules platforms sqldrivers tls imageformats styles gstreamer-plugins nsisplugins
- name: Copy GIO modules
working-directory: build
run: cp /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/lib/gio/modules/{libgiognutls.dll,libgioopenssl.dll} ${GITHUB_WORKSPACE}/build/gio-modules/
- name: Copy Qt platform plugins
working-directory: build
run: cp /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/qt6/plugins/platforms/qwindows.dll ${GITHUB_WORKSPACE}/build/platforms/
- name: Copy Qt styles
working-directory: build
run: cp /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/qt6/plugins/styles/qmodernwindowsstyle.dll ${GITHUB_WORKSPACE}/build/styles/
- name: Copy Qt TLS plugins
working-directory: build
run: cp /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/qt6/plugins/tls/{qschannelbackend.dll,qopensslbackend.dll} ${GITHUB_WORKSPACE}/build/tls/
- name: Copy Qt SQL drivers
working-directory: build
run: cp /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/qt6/plugins/sqldrivers/qsqlite.dll ${GITHUB_WORKSPACE}/build/sqldrivers/
- name: Copy Qt imageformats
working-directory: build
run: cp /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/qt6/plugins/imageformats/{qgif.dll,qico.dll,qjpeg.dll} ${GITHUB_WORKSPACE}/build/imageformats/
- name: Copy gstreamer plugins
working-directory: build
run: cp /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/bin/gstreamer-1.0/*.dll ${GITHUB_WORKSPACE}/build/gstreamer-plugins/
- name: Copy extra binaries
working-directory: build
run: cp /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/bin/{sqlite3.exe,gst-launch-1.0.exe,gst-play-1.0.exe,gst-discoverer-1.0.exe,libsoup-3.0-0.dll,libnghttp2.dll} .
- name: Copy extra binaries (debug)
if: matrix.buildtype == 'debug'
working-directory: build
run: cp /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/bin/{gdb.exe,libreadline8.dll} .
- name: Copy dependencies
working-directory: build
run: >
/strawberry-mxe/tools/copydlldeps.sh
-c
-d .
-F .
-F ./platforms
-F ./styles
-F ./imageformats
-F ./tls
-F ./sqldrivers
-F ./gstreamer-plugins
-R /strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared
- name: Strip binaries
if: matrix.buildtype == 'release'
working-directory: build
run: find . -type f \( -iname \*.dll -o -iname \*.exe \) -exec /strawberry-mxe/usr/bin/${{matrix.arch}}-w64-mingw32.shared-strip {} \;
- name: Strip gdb.exe
if: matrix.buildtype == 'debug'
working-directory: build
run: /strawberry-mxe/usr/bin/${{matrix.arch}}-w64-mingw32.shared-strip gdb.exe
- name: Copy nsis files
working-directory: build
run: cp ${GITHUB_WORKSPACE}/dist/windows/*.nsi ${GITHUB_WORKSPACE}/dist/windows/*.nsh ${GITHUB_WORKSPACE}/dist/windows/*.ico .
- name: Copy COPYING license file
working-directory: build
run: cp ${GITHUB_WORKSPACE}/COPYING .
- name: List files
working-directory: build
run: ls
- name: Check that all files are included in nsi
shell: bash
working-directory: build
run: |
files_missing=
for i in $(ls -1 *.dll *.exe); do
nsi_file_entry=$(grep -i "^\s\+File\s\+\"$i\"$" strawberry.nsi || true)
if [ "${nsi_file_entry}" = "" ]; then
echo "File ${i} is missing File entry."
fi
nsi_file_delete_entry=$(grep -i "^\s\+Delete\s\+\"\$INSTDIR\\\\$i\"$" strawberry.nsi || true)
if [ "${nsi_file_delete_entry}" = "" ] ; then
echo "File ${i} is missing Delete entry."
fi
if [ "${nsi_file_entry}" = "" ] || [ "${nsi_file_delete_entry}" = "" ] ; then
if [ "${files_missing}" = "" ]; then
files_missing="${i}"
else
files_missing="${files_missing} $i"
fi
fi
done
if ! [ "${files_missing}" = "" ]; then
echo "Files missing in nsi: ${files_missing}"
exit 1
fi
- name: NSI SetCompressor
if: matrix.buildtype == 'debug'
working-directory: build
run: |
sed -i 's,^SetCompressor /SOLID lzma,SetCompressor lzma,g' strawberry.nsi
grep SetCompressor strawberry.nsi
- name: Build Windows installer
working-directory: build
run: makensis -V4 strawberry.nsi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: windows-mingw-${{matrix.arch}}-${{matrix.buildtype}}
path: build/StrawberrySetup*.exe