diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml index 1319e6ac..59c70859 100644 --- a/.github/workflows/flatpak.yml +++ b/.github/workflows/flatpak.yml @@ -1,4 +1,4 @@ -name: Flatpak build +name: Flatpak CI on: release: @@ -10,15 +10,49 @@ on: jobs: flatpak: - name: 'Flatpak build' + name: Flatpak build (${{ matrix.config.arch }}) runs-on: ubuntu-24.04 + strategy: + matrix: + config: + - arch: x86_64 + use_qemu: false + + - arch: aarch64 + use_qemu: true + qemu_arch: arm64 + # Don't fail the whole workflow if one architecture fails + fail-fast: false container: image: bilelmoussaoui/flatpak-github-actions:freedesktop-24.08 options: --privileged steps: - uses: actions/checkout@v4 + + - name: Install deps + if: ${{ matrix.config.use_qemu == true }} + run: | + dnf -y install docker + + - name: Set up QEMU + if: ${{ matrix.config.use_qemu == true }} + id: qemu + uses: docker/setup-qemu-action@v2 + with: + platforms: ${{ matrix.config.qemu_arch }} + - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6 with: bundle: oopetris.flatpak - manifest-path: com.github.mgerhold.OOPetris.yml + manifest-path: io.github.openbrickprotocolfoundation.oopetris.yml verbose: ${{ runner.debug == '1' && 'true' || 'false' }} + cache-key: flatpak-builder-${{ github.sha }} + arch: ${{ matrix.config.arch }} + + - uses: flatpak/flatpak-github-actions/flat-manager@v4 + name: 'Deploy' + if: github.event_name != 'pull_request' + with: + repository: beta + flat-manager-url: http://flat-man.oopetris.totto.lt + token: ${{ secrets.FLAT_MANAGER_TOKEN }} diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/lint.yml similarity index 92% rename from .github/workflows/cpp-linter.yml rename to .github/workflows/lint.yml index 4e440b3f..51fc0fac 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: C++ lints(clang-format + clang-tidy) +name: Lint CI on: push: branches: ['main'] @@ -7,6 +7,7 @@ on: jobs: cpp-linter: + name: C++ lints(clang-format + clang-tidy) runs-on: ubuntu-24.04 permissions: pull-requests: write @@ -31,7 +32,7 @@ jobs: - name: Prepare compile_commands.json run: | sudo apt-get update - sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* -y --no-install-recommends + sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* desktop-file-utils -y --no-install-recommends meson setup build -Dbuildtype=release -Dclang_libcpp=disabled -Dtests=true meson compile -C build git_version.hpp diff --git a/.github/workflows/musl.yml b/.github/workflows/musl.yml index ed8e543a..aa5c9037 100644 --- a/.github/workflows/musl.yml +++ b/.github/workflows/musl.yml @@ -1,4 +1,4 @@ -name: musl CI +name: Musl CI on: push: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20ecde2f..6f0894a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* gcovr -y --no-install-recommends + sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* gcovr desktop-file-utils -y --no-install-recommends - name: Configure run: meson setup build -Dbuildtype=debug -Db_coverage=true -Dtests=true -Dclang_libcpp=enabled diff --git a/.github/workflows/installer.yml b/.github/workflows/windows_installer.yml similarity index 98% rename from .github/workflows/installer.yml rename to .github/workflows/windows_installer.yml index f15789cf..5816b7a4 100644 --- a/.github/workflows/installer.yml +++ b/.github/workflows/windows_installer.yml @@ -1,4 +1,4 @@ -name: Installer CI +name: Windows Installer CI on: push: diff --git a/README.md b/README.md index 2ce78e93..9b29e8de 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,21 @@ Or you can download and use prebuilt binaries from the CI-builds. You can find s To download artifacts, click on the newest action and download the artifacts. -[Android](https://github.com/mgerhold/oopetris/actions/workflows/android.yml) +[Android](https://github.com/OpenBrickProtocolFoundation/oopetris/actions/workflows/android.yml) -[Linux (Flatpak)](https://github.com/mgerhold/oopetris/actions/workflows/flatpak.yml) +[Linux (Flatpak)](https://github.com/OpenBrickProtocolFoundation/oopetris/actions/workflows/flatpak.yml) -[Nintendo Switch /3DS](https://github.com/mgerhold/oopetris/actions/workflows/nintendo.yml) +[Nintendo Switch / 3DS](https://github.com/OpenBrickProtocolFoundation/oopetris/actions/workflows/nintendo.yml) -There is no correct Windows and MacOS build atm, you have to built it yourself or use the (maybe not published yet) release builds on github. +[Windows](https://github.com/OpenBrickProtocolFoundation/oopetris/actions/workflows/windows_installer.yml) +There is no correct MacOS build atm, you have to built it yourself or use the (maybe not published yet) releases on GitHub. + +## Releases + +There is an official website for OOPetris, where you also can find different links to auto updatable releases. + +For concrete instructions see [here](docs/releases.md) ## Logo diff --git a/assets/io.github.openbrickprotocolfoundation.oopetris.metainfo.xml.in b/assets/io.github.openbrickprotocolfoundation.oopetris.metainfo.xml.in new file mode 100644 index 00000000..d7633a50 --- /dev/null +++ b/assets/io.github.openbrickprotocolfoundation.oopetris.metainfo.xml.in @@ -0,0 +1,33 @@ + + + @APP_ID@ + OOPetris + A Tetris clone in OOP + MIT + MIT + + pointing + keyboard + touch + gamepad + + +

+ A Tetris clone in OOP. Supports multiplayer, recordings and many more features. For more information vist the github repository. +

+
+ @APP_ID@.desktop + + + Totto16 + + + + https://github.com/OpenBrickProtocolFoundation/oopetris/releases/tag/0.5.6 + + + https://oopetris.totto.lt/ + https://github.com/OpenBrickProtocolFoundation/oopetris/issues + https://github.com/OpenBrickProtocolFoundation/oopetris/pulls + https://github.com/OpenBrickProtocolFoundation/oopetris +
diff --git a/docs/develop.md b/docs/develop.md index ed263bb9..796cab95 100644 --- a/docs/develop.md +++ b/docs/develop.md @@ -8,13 +8,12 @@ For concrete instructions, see the list below: ## Linux -[linux](linux.md) +[Linux](linux.md) ## Serenity OS [serenity](serenity.md) - ## Windows [windows](windows.md) @@ -27,12 +26,10 @@ For concrete instructions, see the list below: [switch](switch.md) - ## Nintendo 3DS [switch](3ds.md) - ## Android [android](android.md) diff --git a/docs/linux.md b/docs/linux.md index 3119961d..ae8fea06 100644 --- a/docs/linux.md +++ b/docs/linux.md @@ -10,7 +10,6 @@ You just have to call these commands: - ```bash meson setup build @@ -19,14 +18,15 @@ meson compile -C build ./build/oopetris # to run the executable ``` - ## Compiling for flatpak You optionally can compile a flatpak image. For that you need some additional binaries, namely the flatpak-builder, than just run: - +> [!NOTE] +> that is not entirely correct + ```bash -flatpak-build com.github.mgerhold.OOPetris.yml +flatpak-build io.github.openbrickprotocolfoundation.oopetris.yml ``` diff --git a/docs/releases.md b/docs/releases.md new file mode 100644 index 00000000..92566c7c --- /dev/null +++ b/docs/releases.md @@ -0,0 +1,45 @@ + + +# OOPetris Releases + + +We support multiple platforms and different types of executables / packages. +So here is a list of supported "package managers" / installation platforms. + +## Android / FDroid + +> [!NOTE] +> This is still WIP + +## Linux / Flatpak + +We provide stable and beta releases via 2 remotes: + +To use the stable version, use this repo: + +```bash +flatpak remote-add --if-not-exists oopetris-stable https://oopetris.totto.lt/repo/assets/oopetris.stable.flatpakrepo + +``` + +And to use beta version: + +```bash +flatpak remote-add --if-not-exists oopetris-beta https://oopetris.totto.lt/repo/assets/oopetris.beta.flatpakrepo + +``` + +Than install it by using this command: + +```bash +flatpak install -v io.github.openbrickprotocolfoundation.oopetris +``` + +To update use the normal flatpak update command, keep in mind, that the bet may be unstable and break things, use with caution! + +## Other + +> [!NOTE] +> This is still WIP + +All other platforms have more difficult to support auto update capabilities, so you can find more on our [website](https://oopetris.totto.lt/releases). diff --git a/com.github.mgerhold.OOPetris.yml b/io.github.openbrickprotocolfoundation.oopetris.yml similarity index 95% rename from com.github.mgerhold.OOPetris.yml rename to io.github.openbrickprotocolfoundation.oopetris.yml index 14be55a0..25239e42 100644 --- a/com.github.mgerhold.OOPetris.yml +++ b/io.github.openbrickprotocolfoundation.oopetris.yml @@ -1,4 +1,4 @@ -app-id: com.github.mgerhold.OOPetris +app-id: io.github.openbrickprotocolfoundation.oopetris runtime: org.freedesktop.Platform runtime-version: "24.08" sdk: org.freedesktop.Sdk diff --git a/src/discord/core.cpp b/src/discord/core.cpp index 217f24e4..97200f26 100644 --- a/src/discord/core.cpp +++ b/src/discord/core.cpp @@ -11,7 +11,7 @@ [[nodiscard]] std::string constants::discord ::get_asset_key(constants::discord::ArtAsset asset) { switch (asset) { - case ArtAsset::logo: + case ArtAsset::Logo: return "logo"; default: UNREACHABLE(); diff --git a/src/discord/core.hpp b/src/discord/core.hpp index 55d917bf..21423b00 100644 --- a/src/discord/core.hpp +++ b/src/discord/core.hpp @@ -3,6 +3,7 @@ #pragma once #include +#include #include "../helper/windows.hpp" @@ -26,7 +27,8 @@ namespace constants::discord { #elif defined(__CONSOLE__) #error "Not supported" #elif defined(FLATPAK_BUILD) - constexpr const char* platform_dependent_launch_arguments = "flatpak run com.github.mgerhold.OOPetris --discord"; + constexpr const char* platform_dependent_launch_arguments = + "flatpak run io.github.openbrickprotocolfoundation.oopetris --discord"; #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) constexpr const char* platform_dependent_launch_arguments = "oopetris.exe --discord"; #elif defined(__APPLE__) @@ -38,7 +40,7 @@ namespace constants::discord { #endif // manually synchronized to https://discord.com/developers/applications/1220147916371394650/rich-presence/assets - enum class ArtAsset { logo }; + enum class ArtAsset : u8 { Logo }; OOPETRIS_GRAPHICS_EXPORTED [[nodiscard]] std::string get_asset_key(ArtAsset asset); diff --git a/src/scenes/main_menu/main_menu.cpp b/src/scenes/main_menu/main_menu.cpp index 9f7ea881..59aebd0d 100644 --- a/src/scenes/main_menu/main_menu.cpp +++ b/src/scenes/main_menu/main_menu.cpp @@ -90,7 +90,7 @@ namespace scenes { discord_instance->set_activity( DiscordActivityWrapper("Selecting playmode", discord::ActivityType::Playing) - .set_large_image("Playing OOPetris", constants::discord::ArtAsset::logo) + .set_large_image("Playing OOPetris", constants::discord::ArtAsset::Logo) .set_start_timestamp(std::chrono::system_clock::now()) ); } diff --git a/src/scenes/replay_game/replay_game.cpp b/src/scenes/replay_game/replay_game.cpp index 4a2362aa..75f0a2df 100644 --- a/src/scenes/replay_game/replay_game.cpp +++ b/src/scenes/replay_game/replay_game.cpp @@ -58,7 +58,7 @@ namespace scenes { discord_instance->set_activity( DiscordActivityWrapper("Replaying a game", discord::ActivityType::Playing) - .set_large_image("Playing OOPetris", constants::discord::ArtAsset::logo) + .set_large_image("Playing OOPetris", constants::discord::ArtAsset::Logo) .set_start_timestamp(std::chrono::system_clock::now()) ); } diff --git a/src/scenes/single_player_game/single_player_game.cpp b/src/scenes/single_player_game/single_player_game.cpp index e1a23899..9c35e66f 100644 --- a/src/scenes/single_player_game/single_player_game.cpp +++ b/src/scenes/single_player_game/single_player_game.cpp @@ -53,7 +53,7 @@ namespace scenes { discord_instance->set_activity( DiscordActivityWrapper("Playing a single-player game", discord::ActivityType::Playing) - .set_large_image("Playing OOPetris", constants::discord::ArtAsset::logo) + .set_large_image("Playing OOPetris", constants::discord::ArtAsset::Logo) .set_start_timestamp(std::chrono::system_clock::now()) ); } diff --git a/tools/dependencies/meson.build b/tools/dependencies/meson.build index 204bf626..2e333dac 100644 --- a/tools/dependencies/meson.build +++ b/tools/dependencies/meson.build @@ -305,7 +305,7 @@ if build_application endif if is_flatpak_build - app_name = 'com.github.mgerhold.OOPetris' + app_name = 'io.github.openbrickprotocolfoundation.oopetris' temp = core_lib.get('compile_args') temp += '-DFLATPAK_BUILD' @@ -319,6 +319,7 @@ if build_application nfde_dep = dependency( 'nativefiledialog-extended', required: not meson.is_cross_build(), + allow_fallback: true, default_options: { 'xdg-desktop-portal': is_flatpak_build ? 'enabled' : 'auto', }, @@ -336,9 +337,17 @@ if build_application c = meson.get_compiler('c') + discord_dep_required = not meson.is_cross_build() and get_option('build_installer') + + if host_machine.system() == 'linux' and host_machine.cpu_family() == 'aarch64' + # not supported on aarch64 linux :( + discord_dep_required = false + endif + discord_sdk_dep = dependency( 'discord-game-sdk', - required: not meson.is_cross_build() and get_option('build_installer'), + allow_fallback: true, + required: discord_dep_required, # only with msvc we need a static library, all others work without adding __declspec() everywhere static: c.get_id() == 'msvc', default_options: c.get_id() != 'msvc' ? {} : {'default_library': 'static'}, diff --git a/tools/install/meson.build b/tools/install/meson.build index db010c62..3ed51689 100644 --- a/tools/install/meson.build +++ b/tools/install/meson.build @@ -1,20 +1,29 @@ if build_application + flatpak_app_name = 'io.github.openbrickprotocolfoundation.oopetris' + ## TODO: only install needed ones, since sometimes we only need e.g. flacs or mp3 and no icons etc. ## install assets install_subdir( meson.project_source_root() / 'assets', install_dir: 'share/oopetris', install_tag: 'assets', - exclude_files: ['oopetris.desktop.in', 'OOPetris.svg', 'recordings.magic'], + exclude_files: [ + 'oopetris.desktop.in', + flatpak_app_name+'.metainfo.xml.in', + 'OOPetris.svg', + 'recordings.magic', + ], exclude_directories: ['icon'], ) app_name = 'oopetris' if is_flatpak_build - app_name = 'com.github.mgerhold.OOPetris' + app_name = flatpak_app_name endif + require_checks = get_option('tests') + conf = configuration_data() conf.set('APP_NAME', app_name) @@ -54,8 +63,8 @@ if build_application endif endif - configure_file( - input: meson.project_source_root() / 'assets/oopetris.desktop.in', + desktop_file = configure_file( + input: meson.project_source_root() / 'assets' / 'oopetris.desktop.in', output: app_name + '.desktop', configuration: conf, install: true, @@ -63,6 +72,48 @@ if build_application install_tag: 'other', ) + desktop_file_validate_exe = find_program('desktop-file-validate', required: require_checks) + + if desktop_file_validate_exe.found() + test( + 'validate desktop file', + desktop_file_validate_exe, + args: [desktop_file], + ) + endif + + if is_flatpak_build + + flaptak_conf = configuration_data() + flaptak_conf.set('APP_ID', app_name) + flaptak_conf.set('APP_VERSION', meson.project_version()) + + metainfo_file = configure_file( + input: meson.project_source_root() / 'assets' / (flatpak_app_name+'.metainfo.xml.in'), + output: app_name + '.metainfo.xml', + configuration: flaptak_conf, + install: true, + install_dir: datadir / 'metainfo', + install_tag: 'other', + ) + + ascli_exe = find_program('appstreamcli', required: require_checks) + + if ascli_exe.found() + test( + 'validate metainfo file', + ascli_exe, + args: [ + 'validate', + '--no-net', + '--explain', + '--pedantic', metainfo_file, + ], + ) + endif + + endif + logos = [ '24x24.png', '48x48.png',