try to fix ci #111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: [push, pull_request] | |
jobs: | |
build-linux: | |
strategy: | |
matrix: | |
RUNNER: | |
- ubuntu-22.04 | |
- ubuntu-24.04 | |
runs-on: ${{matrix.RUNNER}} | |
env: | |
CXXFLAGS: -Wall -Wextra -Wno-deprecated-declarations -Werror -Wno-stringop-overflow | |
steps: | |
- name: Setup system name | |
run: echo "SYSTEM_NAME=$(lsb_release --codename --short)" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
lfs: true | |
- name: Install prerequisites | |
run: sudo apt-get update -y && sudo apt-get install -y | |
libasound2-dev | |
libfreetype-dev | |
libsdl2-dev | |
libspdlog-dev | |
nlohmann-json3-dev | |
- name: Install spdlog | |
run: git clone --branch v1.15.0 https://github.com/gabime/spdlog.git && | |
cmake -S spdlog -B spdlog/build -D SPDLOG_USE_STD_FORMAT=ON -D CMAKE_BUILD_TYPE=Release && | |
cmake --build spdlog/build -j $(nproc) && | |
cmake --install spdlog/build --prefix spdlog/install | |
- name: Configure CMake | |
run: cmake | |
-S ${{github.workspace}} | |
-B ${{github.workspace}}/build | |
-D CMAKE_PREFIX_PATH=spdlog/install | |
-D CMAKE_BUILD_TYPE=Release | |
-D MC_COMMIT_SHA=${{github.sha}} | |
-D MC_BUILD_NUMBER=${{github.run_number}} | |
-D CPACK_GENERATOR=DEB | |
-D CPACK_SYSTEM_NAME=$SYSTEM_NAME | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --target midiconn -j $(nproc) | |
- name: Create DEB package | |
run: cd ${{github.workspace}}/build && cpack -C Release | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-${{env.SYSTEM_NAME}} | |
path: | | |
${{github.workspace}}/build/midiconn | |
${{github.workspace}}/build/*.deb | |
build-flatpak: | |
runs-on: ubuntu-latest | |
container: | |
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08 | |
options: --privileged | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
lfs: true | |
- name: Validate metainfo | |
run: appstream-util validate | |
data/packaging/xyz.safeworlds.midiconn.metainfo.xml | |
- name: Build flatpak | |
uses: flatpak/flatpak-github-actions/flatpak-builder@v6 | |
with: | |
manifest-path: ${{github.workspace}}/data/packaging/xyz.safeworlds.midiconn.yml | |
cache-key: flatpak-builder-${{ github.sha }} | |
build-windows: | |
runs-on: windows-latest | |
env: | |
vcpkg-prereqs: nlohmann-json:x64-windows sdl2:x64-windows freetype[core]:x64-windows zlib:x64-windows gettext:x64-windows | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
lfs: true | |
- name: Restore vcpkg prerequisites cache | |
id: restore-cache-vcpkg | |
uses: actions/cache/restore@v4 | |
with: | |
path: C:\vcpkg | |
key: ${{env.vcpkg-prereqs}} | |
- name: Install prerequisites | |
if: ${{ steps.restore-cache-vcpkg.outputs.cache-hit != 'true' }} | |
run: vcpkg install ${{env.vcpkg-prereqs}} | |
- name: Save vcpkg prerequisites cache | |
if: ${{ steps.restore-cache-vcpkg.outputs.cache-hit != 'true' }} | |
uses: actions/cache/save@v4 | |
with: | |
path: C:\vcpkg | |
key: ${{env.vcpkg-prereqs}} | |
- name: Install spdlog | |
run: git clone --branch v1.15.0 https://github.com/gabime/spdlog.git && | |
cmake -S spdlog -B spdlog\build -D SPDLOG_USE_STD_FORMAT=ON -D CMAKE_BUILD_TYPE=Release && | |
cmake --build spdlog\build && | |
cmake --install spdlog\build --prefix spdlog\install | |
- name: Configure CMake | |
run: cmake | |
-B ${{github.workspace}}/build | |
-D MC_COMMIT_SHA=${{github.sha}} | |
-D MC_BUILD_NUMBER=${{github.run_number}} | |
-D MC_CHECK_FOR_UPDATES=ON | |
-D CMAKE_PREFIX_PATH=spdlog\install | |
-D CMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake | |
-D CMAKE_CXX_FLAGS="/await /EHsc" | |
-D X_VCPKG_APPLOCAL_DEPS_INSTALL=ON | |
-T host=x64 | |
-A x64 | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --target midiconn --config Release | |
- name: Build installer | |
run: cd ${{github.workspace}}\build; cpack -C Release | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows | |
path: | | |
${{github.workspace}}\build\Release\*.exe | |
${{github.workspace}}\build\Release\*.dll | |
${{github.workspace}}\build\*.msi | |
release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: | |
- build-linux | |
- build-windows | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
${{github.workspace}}/artifact/*.deb | |
${{github.workspace}}/artifact/*.msi | |
- name: Push artifacts to itch.io | |
shell: bash | |
run: | | |
wget https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default -O butler.zip | |
unzip butler.zip | |
export BUTLER_API_KEY=${{ secrets.BUTLER_API_KEY }} | |
./butler push ${{github.workspace}}/artifact/*.msi mfeproject/midiconn:windows-msi --userversion $GITHUB_REF_NAME | |
./butler push ${{github.workspace}}/artifact/*jammy*.deb mfeproject/midiconn:ubuntu2204-deb --userversion $GITHUB_REF_NAME | |
./butler push ${{github.workspace}}/artifact/*noble*.deb mfeproject/midiconn:ubuntu2404-deb --userversion $GITHUB_REF_NAME |