From 578dd8e2b05e6bfdd87ef745cc34a328dd1dffb0 Mon Sep 17 00:00:00 2001 From: florianvazelle Date: Mon, 1 Jan 2024 11:18:42 +0100 Subject: [PATCH] ci: fix export commands --- .github/actions/setup-godot/action.yml | 35 ++++++++++++++++++++++ .github/workflows/release-packaging.yml | 6 ++++ Justfile | 39 +++++++++++++++++++------ export_presets.cfg | 8 ++--- 4 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 .github/actions/setup-godot/action.yml diff --git a/.github/actions/setup-godot/action.yml b/.github/actions/setup-godot/action.yml new file mode 100644 index 0000000..86e97f1 --- /dev/null +++ b/.github/actions/setup-godot/action.yml @@ -0,0 +1,35 @@ +name: Setup Godot +description: Setup Godot dependencies. +runs: + using: "composite" + steps: + + - name: Installing Linux dependencies + if: ${{ runner.os == 'Linux' }} + shell: bash + run: sudo apt-get install -y pulseaudio xvfb x11-xserver-utils mesa-vulkan-drivers + + - name: Starting X11 server on :0 + if: ${{ runner.os == 'Linux' }} + shell: bash + run: xset -q || /bin/bash -c "sudo Xvfb -ac :0 -screen 0 1920x1080x24 > /dev/null 2>&1 &" + env: + DISPLAY: ":0" + + - name: Check that X11 server is running + if: ${{ runner.os == 'Linux' }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 1 + max_attempts: 5 + command: /bin/bash -c "xset -q > /dev/null 2>&1" + env: + DISPLAY: ":0" + + - name: Starting dummy sound device + if: ${{ runner.os == 'Linux' }} + uses: nick-fields/retry@v2 + with: + timeout_minutes: 1 + max_attempts: 3 + command: pulseaudio --check || pulseaudio -D diff --git a/.github/workflows/release-packaging.yml b/.github/workflows/release-packaging.yml index 13bd7b1..88d7dd5 100644 --- a/.github/workflows/release-packaging.yml +++ b/.github/workflows/release-packaging.yml @@ -44,6 +44,9 @@ jobs: - name: Load dotenv run: just ci-load-dotenv + - name: Setup Godot dependencies + uses: ./.github/actions/setup-godot + - name: Export run: just export @@ -68,6 +71,9 @@ jobs: - name: Load dotenv run: just ci-load-dotenv + - name: Setup Godot dependencies + uses: ./.github/actions/setup-godot + - name: Export run: just export-web diff --git a/Justfile b/Justfile index db02a00..40465c4 100644 --- a/Justfile +++ b/Justfile @@ -108,14 +108,12 @@ install-templates: # Download game plugins install-addons: - [ -f plug.gd ] && just godot --headless --script plug.gd install || true + [ -f plug.gd ] && just godot --script plug.gd install || true # Workaround from https://github.com/godotengine/godot/pull/68461 # Import game resources import-resources: - just godot --headless --export-pack null /dev/null - # timeout 60 just godot --editor || true - # just godot --headless --quit --editor + timeout 60 just godot --export-pack null /dev/null || true # Updates the game version for export @bump-version: @@ -131,7 +129,12 @@ import-resources: # Godot binary wrapper @godot *ARGS: makedirs install-godot install-templates - {{ godot_bin }} {{ ARGS }} + #!/usr/bin/env sh + if [ "{{ env("CI", "false") }}" = "true" ]; then + just ci-godot-x11 {{ ARGS }} + else + {{ godot_bin }} {{ ARGS }} + fi # Open the Godot editor editor: @@ -145,19 +148,19 @@ fmt: # Export game on Windows export-windows: bump-version install-addons import-resources mkdir -p {{ build_dir }}/windows - just godot --export-release '"Windows Desktop"' --headless {{ build_dir }}/windows/{{ game_name }}.exe + just godot --export-release '"Windows Desktop"' {{ build_dir }}/windows/{{ game_name }}.exe (cd {{ build_dir }}/windows && zip {{ game_name }}-windows-v{{ game_version }}.zip -r .) mv {{ build_dir }}/windows/{{ game_name }}-windows-v{{ game_version }}.zip {{ dist_dir }}/{{ game_name }}-windows-v{{ game_version }}.zip rm -rf {{ build_dir }}/windows # Export game on MacOS export-mac: bump-version install-addons import-resources - just godot --export-release "macOS" --headless {{ dist_dir }}/{{ game_name }}-mac-v{{ game_version }}.zip + just godot --export-release "macOS" {{ dist_dir }}/{{ game_name }}-mac-v{{ game_version }}.zip # Export game on Linux export-linux: bump-version install-addons import-resources mkdir -p {{ build_dir }}/linux - just godot --export-release "Linux/X11" --headless {{ build_dir }}/linux/{{ game_name }}.x86_64 + just godot --export-release "Linux/X11" {{ build_dir }}/linux/{{ game_name }}.x86_64 (cd {{ build_dir }}/linux && zip {{ game_name }}-linux-v{{ game_version }}.zip -r .) mv {{ build_dir }}/linux/{{ game_name }}-linux-v{{ game_version }}.zip {{ dist_dir }}/{{ game_name }}-linux-v{{ game_version }}.zip rm -rf {{ build_dir }}/linux @@ -165,7 +168,7 @@ export-linux: bump-version install-addons import-resources # Export game for the web export-web: bump-version install-addons import-resources mkdir -p {{ build_dir }}/web - just godot --export-release "Web" --headless {{ build_dir }}/web/index.html + just godot --export-release "Web" {{ build_dir }}/web/index.html # Export on all platform export: export-windows export-mac export-linux @@ -198,6 +201,24 @@ ci-load-dotenv: echo "game_name={{ game_name }}" >> $GITHUB_ENV echo "game_version={{ game_version }}" >> $GITHUB_ENV +# Starts godot using Xvfb and pulseaudio +ci-godot-x11 *ARGS: + #!/bin/bash + set -e + # Set locale to 'en' if locale is not already set. + # Godot will fallback to this locale anyway and it + # prevents an error message being printed to console. + [ "$LANG" == "C.UTF-8" ] && LANG=en || true + + # Start dummy sound device. + pulseaudio --check || pulseaudio -D + + # Running godot with X11 Display. + xvfb-run --auto-servernum {{ godot_bin }} {{ ARGS }} + + # Cleanup (allowed to fail). + pulseaudio -k || true + # Download Butler [private] install-butler: makedirs diff --git a/export_presets.cfg b/export_presets.cfg index 1162a11..b2c9738 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -35,8 +35,8 @@ application/modify_resources=true application/icon="" application/console_wrapper_icon="" application/icon_interpolation=4 -application/file_version="1.4.4.20231203" -application/product_version="1.4.4.20231203" +application/file_version="1.0.0.20231231" +application/product_version="1.0.0.20231231" application/company_name="Mechanical Flower" application/product_name="Marble" application/file_description="" @@ -130,8 +130,8 @@ application/icon_interpolation=4 application/bundle_identifier="io.itch.MechanicalFlower" application/signature="" application/app_category="Games" -application/short_version="1.4" -application/version="1.4.4" +application/short_version="1.0" +application/version="1.0.0" application/copyright="2023-present Mechanical Flower" application/copyright_localized={} application/min_macos_version="10.12"