Skip to content

Build

Build #98

Workflow file for this run

name: Daily Build and Release
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
jobs:
build-windows-msvc:
name: Build Windows MSVC
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
arch: [ 'x86_64' ]
buildtype: [ 'release' ]
steps:
- name: Set prefix path
shell: bash
run: |
echo "prefix_path_backslash=c:\strawberry_msvc_${{matrix.arch}}_${{matrix.buildtype}}" >> $GITHUB_ENV
echo "prefix_path_forwardslash=c:/strawberry_msvc_${{matrix.arch}}_${{matrix.buildtype}}" >> $GITHUB_ENV
echo "prefix_path_unix=/c/strawberry_msvc_${{matrix.arch}}_${{matrix.buildtype}}" >> $GITHUB_ENV
- name: Set cmake buildtype
shell: bash
run: echo "cmake_buildtype=$(echo ${{matrix.buildtype}} | sed 's/.*/\u&/')" >> $GITHUB_ENV
- name: Cleanup PATH
uses: egor-tensin/cleanup-path@v4
with:
dirs: ${{env.prefix_path_backslash}}\bin;C:\Windows;C:\Windows\system32;C:\Program Files\Git\bin;C:\Program Files\CMake\bin;C:\Program Files\GitHub CLI;C:\ProgramData\Chocolatey\bin;C:\Program Files (x86)\NSIS
- name: Create downloads directory
shell: cmd
run: mkdir downloads
- name: Download Windows MSVC dependencies
shell: cmd
working-directory: downloads
run: curl -f -O -L https://github.com/strawberrymusicplayer/strawberry-msvc-dependencies/releases/latest/download/strawberry-msvc-${{matrix.arch}}-${{matrix.buildtype}}.tar.xz
- name: Extract Windows MSVC dependencies
shell: bash
working-directory: downloads
run: tar -C /c -xf strawberry-msvc-${{matrix.arch}}-${{matrix.buildtype}}.tar.xz
- name: Update PATH
run: echo "${{env.prefix_path_backslash}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Copy bin files
shell: bash
run: cp /c/strawberry/c/bin/{patch.exe,strip.exe,strings.exe,objdump.exe} ${{env.prefix_path_unix}}/bin
- name: Delete conflicting files
shell: bash
run: rm -rf /c/{msys64,mingw32,mingw64} /c/strawberry/c "/c/program files/OpenSSL"
- name: Delete conflicting icu
shell: bash
run: find "/c/program files (x86)/windows kits/" -type f \( -iname 'icu*.lib' -o -iname 'icu*.h' \) -print -delete
- name: Download NSIS LockedList plugin
shell: cmd
working-directory: downloads
run: curl -f -O -L https://nsis.sourceforge.io/mediawiki/images/d/d3/LockedList.zip
- name: Extract NSIS LockedList plugin
shell: cmd
working-directory: downloads
run: 7z x LockedList.zip
- name: Download NSIS Registry plugin
shell: cmd
working-directory: downloads
run: curl -f -O -L https://nsis.sourceforge.io/mediawiki/images/4/47/Registry.zip
- name: Extract NSIS Registry plugin
shell: cmd
working-directory: downloads
run: 7z x Registry.zip
- name: Download NSIS Inetc plugin
shell: cmd
working-directory: downloads
run: curl -f -O -L https://nsis.sourceforge.io/mediawiki/images/c/c9/Inetc.zip
- name: Extract NSIS Inetc plugin
shell: cmd
working-directory: downloads
run: 7z x Inetc.zip
- name: Install NSIS plugins
shell: cmd
working-directory: downloads
run: |
copy "Plugins\LockedList64.dll" "C:\Program Files (x86)\NSIS\Plugins\"
copy "Plugins\x86-unicode\LockedList.dll" "C:\Program Files (x86)\NSIS\Plugins\x86-unicode\"
copy "Desktop\Plugin\registry.dll" "C:\Program Files (x86)\NSIS\Plugins\"
copy "Desktop\Plugin\registry.dll" "C:\Program Files (x86)\NSIS\Plugins\x86-unicode\"
copy "Plugins\x86-unicode\INetC.dll" "C:\Program Files (x86)\NSIS\Plugins\x86-unicode\"
- name: Setup MSVC Environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.arch}}
sdk: 10.0.20348.0
vsversion: 2022
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Add safe git directory
shell: bash
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Create Build Environment
shell: cmd
run: cmake -E make_directory build
- name: Set ENABLE_WIN32_CONSOLE (release)
if: matrix.buildtype == 'release'
shell: bash
run: echo "win32_console=OFF" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
repository: strawberrymusicplayer/strawberry
fetch-depth: 1
- name: Create Build Environment
run: cmake -E make_directory build
- name: Run CMake
run: >
cmake
-S .
-B build
-G "Ninja"
-DCMAKE_BUILD_TYPE="${{env.cmake_buildtype}}"
-DCMAKE_PREFIX_PATH="${{env.prefix_path_forwardslash}}/lib/cmake"
-DARCH="${{matrix.arch}}"
-DENABLE_WIN32_CONSOLE=${{env.win32_console}}
-DENABLE_LIBMTP=ON
-DENABLE_AUDIOCD=ON
-DENABLE_SPOTIFY=OFF
- name: Run Make
shell: cmd
env:
CL: "/MP"
run: cmake --build build --config "${{env.cmake_buildtype}}" --parallel 4
- name: Copy extra binaries
shell: cmd
working-directory: build
run: |
copy ${{env.prefix_path_backslash}}\bin\libssl-3*.dll
copy ${{env.prefix_path_backslash}}\bin\libcrypto-3*.dll
copy ${{env.prefix_path_backslash}}\bin\soup-3.0-0.dll
copy ${{env.prefix_path_backslash}}\bin\gst-launch-1.0.exe
copy ${{env.prefix_path_backslash}}\bin\gst-play-1.0.exe
copy ${{env.prefix_path_backslash}}\bin\gst-discoverer-1.0.exe
copy ${{env.prefix_path_backslash}}\bin\sqlite3.exe
- name: Copy extra binaries
shell: cmd
working-directory: build
run: |
copy ${{env.prefix_path_backslash}}\bin\libssl-3*.dll
copy ${{env.prefix_path_backslash}}\bin\libcrypto-3*.dll
copy ${{env.prefix_path_backslash}}\bin\soup-3.0-0.dll
copy ${{env.prefix_path_backslash}}\bin\gst-launch-1.0.exe
copy ${{env.prefix_path_backslash}}\bin\gst-play-1.0.exe
copy ${{env.prefix_path_backslash}}\bin\gst-discoverer-1.0.exe
copy ${{env.prefix_path_backslash}}\bin\sqlite3.exe
- name: Create directories
shell: cmd
working-directory: build
run: |
mkdir gio-modules
mkdir platforms
mkdir styles
mkdir tls
mkdir sqldrivers
mkdir imageformats
mkdir gstreamer-plugins
mkdir nsisplugins
- name: Copy GIO modules
shell: cmd
working-directory: build
run: copy ${{env.prefix_path_backslash}}\lib\gio\modules\*.dll .\gio-modules\
- name: Copy Qt platform plugins
shell: cmd
working-directory: build
run: copy ${{env.prefix_path_backslash}}\plugins\platforms\qwindows*.dll .\platforms\
- name: Copy Qt styles
shell: cmd
working-directory: build
run: copy ${{env.prefix_path_backslash}}\plugins\styles\qmodernwindowsstyle*.dll .\styles\
- name: Copy Qt TLS plugins
shell: cmd
working-directory: build
run: copy ${{env.prefix_path_backslash}}\plugins\tls\*.dll .\tls\
- name: Copy Qt SQL drivers
shell: cmd
working-directory: build
run: copy ${{env.prefix_path_backslash}}\plugins\sqldrivers\qsqlite*.dll .\sqldrivers\
- name: Copy Qt imageformats plugins
shell: cmd
working-directory: build
run: copy ${{env.prefix_path_backslash}}\plugins\imageformats\*.dll .\imageformats\
- name: Copy gstreamer plugins
shell: cmd
working-directory: build
run: copy ${{env.prefix_path_backslash}}\lib\gstreamer-1.0\*.dll .\gstreamer-plugins\
- name: Download copydlldeps.sh
shell: bash
working-directory: build
run: curl -f -O -L https://raw.githubusercontent.com/strawberrymusicplayer/strawberry-mxe/master/tools/copydlldeps.sh
- name: Copy dependencies
shell: bash
working-directory: build
run: >
./copydlldeps.sh
-c
-d .
-F .
-F ./platforms
-F ./styles
-F ./tls
-F ./sqldrivers
-F ./imageformats
-F ./gio-modules
-F ./gstreamer-plugins
-R ${{env.prefix_path_unix}}/bin
- name: Copy nsis files
shell: cmd
working-directory: build
run: |
copy ..\dist\windows\*.nsi .
copy ..\dist\windows\*.nsh .
copy ..\dist\windows\*.ico .
- name: Copy COPYING license file
shell: cmd
working-directory: build
run: copy ..\COPYING .
- name: List files
shell: cmd
working-directory: build
run: dir
- 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: Build Windows installer
working-directory: build
run: makensis strawberry.nsi
- name: Upload MSVC Artifacts
uses: actions/upload-artifact@v3
with:
name: msvc-build-artifacts-${{matrix.arch}}-${{matrix.buildtype}}
path: build
release:
needs: [ build-windows-msvc ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download MSVC Artifacts
uses: actions/download-artifact@v3
with:
name: msvc-build-artifacts-x86_64-release
path: msvc-artifacts
- name: Get current date
id: get-date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: daily-build-${{ env.CURRENT_DATE }}-${{ github.sha }}
release_name: Daily Build-${{ env.CURRENT_DATE }}-${{ github.sha }}
draft: false
prerelease: false
- name: Upload MSVC Artifacts to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: msvc-artifacts/build
asset_name: windows-msvc-x86_64-${{ env.CURRENT_DATE }}-${{ github.sha }}.zip
asset_content_type: application/zip