From e63f95eda857f58f57c8fd81549ae3610defa3fe Mon Sep 17 00:00:00 2001 From: Kiisu_Master <142301391+Kiisu-Master@users.noreply.github.com> Date: Fri, 12 Apr 2024 17:48:43 +0300 Subject: [PATCH] Update automation - Fix rcedit and wine not working - Add web builds - Add comments - Cache Godot binaries - Use Godot 4.2.2-rc3 - Run exports in parallel - Report error if no artifacts are uploaded - General overhaul --- .github/actions/godot-export/action.yml | 9 +++ .github/actions/set-up-godot/action.yml | 39 ++++++++++++ .github/workflows/dev-build.yml | 59 ----------------- .github/workflows/dev-desktop.yml | 84 +++++++++++++++++++++++++ .github/workflows/dev-web.yml | 43 +++++++++++++ README.md | 2 +- export_presets.cfg | 4 +- 7 files changed, 178 insertions(+), 62 deletions(-) create mode 100644 .github/actions/godot-export/action.yml create mode 100644 .github/actions/set-up-godot/action.yml delete mode 100644 .github/workflows/dev-build.yml create mode 100644 .github/workflows/dev-desktop.yml create mode 100644 .github/workflows/dev-web.yml diff --git a/.github/actions/godot-export/action.yml b/.github/actions/godot-export/action.yml new file mode 100644 index 00000000..9cd47142 --- /dev/null +++ b/.github/actions/godot-export/action.yml @@ -0,0 +1,9 @@ +name: Export Godot project +runs: + using: composite + steps: + - name: Export + shell: bash + run: | + mkdir -v -p ~/build/${BUILD_NAME} + godot --headless --export-release "${PLATFORM}" ~/build/${BUILD_NAME}/${PROJECT_NAME}.${EXTENSION} diff --git a/.github/actions/set-up-godot/action.yml b/.github/actions/set-up-godot/action.yml new file mode 100644 index 00000000..5585493f --- /dev/null +++ b/.github/actions/set-up-godot/action.yml @@ -0,0 +1,39 @@ +name: Set up Godot +runs: + using: composite + steps: + - name: Make folders + shell: bash + run: | + # Set up folders for Godot editor and export templates. + # This is done before the download step because this uses caching and doesn't always need to download. + # The ~/godot directory is for the editor, so it can be added to PATH. + mkdir -v -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE} + mkdir -v -p ~/godot + - name: Use cache + id: godot-cache + uses: + actions/cache@v4 + with: + key: ${{ env.GODOT_VERSION }}-${{ env.GODOT_RELEASE }} + path: | + ~/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.${{ env.GODOT_RELEASE }} + ~/godot + - name: Download Godot + if: ${{ steps.godot-cache.outputs.cache-hit != 'true' }} + shell: bash + run: | + # Download Godot editor and export templates from godot-builds repo. + wget -q https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}-${GODOT_RELEASE}/Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_export_templates.tpz & + wget -q https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}-${GODOT_RELEASE}/Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_linux.x86_64.zip & + wait + # Unpack the files. + unzip Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_linux.x86_64.zip -d ~ & + unzip Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_export_templates.tpz -d ~ & + wait + # Move to correct places. + mv ~/templates/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_RELEASE} + mv ~/Godot_v${GODOT_VERSION}-${GODOT_RELEASE}_linux.x86_64 ~/godot/godot + - name: Add Godot to path + shell: bash + run: echo "~/godot" >> $GITHUB_PATH diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml deleted file mode 100644 index b9a8d229..00000000 --- a/.github/workflows/dev-build.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: CI - -on: - workflow_dispatch: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -env: - GODOT_VERSION: 4.2.2-rc2 - GODOT_VERSION_DOT: 4.2.2.rc2 - EXPORT_NAME: GodSVG - -jobs: - export: - name: Export GodSVG - runs-on: ubuntu-latest - steps: - - name: Setup Godot and folders - run: | - mkdir -v -p ~/build/windows-64bit ~/build/linux-64bit ~/.local/share/godot/export_templates - wget -q https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_export_templates.tpz - wget -q https://github.com/godotengine/godot-builds/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_linux.x86_64.zip - unzip Godot_v${GODOT_VERSION}_linux.x86_64.zip -d ~ - unzip Godot_v${GODOT_VERSION}_export_templates.tpz -d ~ - mv ~/templates/ ~/.local/share/godot/export_templates/${GODOT_VERSION_DOT} - ~/Godot_v${GODOT_VERSION}_linux.x86_64 --headless --quit - - name: Setup WINE and rcedit for Windows export - run: | - dpkg --add-architecture i386 && apt-get update && apt-get install -y wine-stable && apt-get install -y wine32 - wget -q https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe - mkdir -v -p ~/.local/share/rcedit - mv rcedit-x64.exe ~/.local/share/rcedit - echo 'export/windows/wine = "/usr/bin/wine"' >> ~/.config/godot/editor_settings-4.tres - echo 'export/windows/rcedit = "/github/home/.local/share/rcedit/rcedit-x64.exe"' >> ~/.config/godot/editor_settings-4.tres - - name: Checkout repo - uses: actions/checkout@v4 - - name: Build Windows executable - run: | - ~/Godot_v${GODOT_VERSION}_linux.x86_64 --headless -v --export-release "Windows Desktop" ~/build/windows-64bit/$EXPORT_NAME.exe - - name: Build Linux executable - run: | - ~/Godot_v${GODOT_VERSION}_linux.x86_64 --headless -v --export-release "Linux/X11" ~/build/linux-64bit/$EXPORT_NAME.x86_64 - chmod +x ~/build/linux-64bit/$EXPORT_NAME.x86_64 - cd ~/build - tar zcvf linux-64bit.tar.gz linux-64bit - - name: Upload Windows Artifact - uses: actions/upload-artifact@v4 - with: - name: Windows-64bit - path: ~/build/windows-64bit/ - retention-days: 14 - - name: Upload Linux Artifact - uses: actions/upload-artifact@v4 - with: - name: Linux-64bit - path: ~/build/linux-64bit.tar.gz - retention-days: 14 \ No newline at end of file diff --git a/.github/workflows/dev-desktop.yml b/.github/workflows/dev-desktop.yml new file mode 100644 index 00000000..5dcacb95 --- /dev/null +++ b/.github/workflows/dev-desktop.yml @@ -0,0 +1,84 @@ +name: dev-desktop + +on: + workflow_dispatch: + push: + branches: [ main ] + pull_request: + branches: [ main ] + + +env: + GODOT_VERSION: 4.2.2 + GODOT_RELEASE: rc3 + PROJECT_NAME: GodSVG + + +jobs: + export-windows: + name: Export GodSVG for Windows + runs-on: ubuntu-latest + env: + PLATFORM: "Windows Desktop" + EXTENSION: "exe" + BUILD_NAME: "windows-64bit" + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up Godot + uses: ./.github/actions/set-up-godot + - name: Set up WINE and rcedit for Windows export + run: | + # Download rcedit and intall wine. + wget -q https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y wine-stable + sudo apt-get install -y wine32 + # Move rcedit to different place. + mkdir -v -p ~/.local/share/rcedit + mv rcedit-x64.exe ~/.local/share/rcedit + # CD out of project directory so Godot doesn't load it. + cd ~ + # Run Godot to generate editor config file. + godot --headless --quit + # Add wine and rcedit paths to Godot config. + echo 'export/windows/wine = "/usr/bin/wine"' >> ~/.config/godot/editor_settings-4.tres + echo 'export/windows/rcedit = "/home/runner/.local/share/rcedit/rcedit-x64.exe"' >> ~/.config/godot/editor_settings-4.tres + - name: Export project + uses: ./.github/actions/godot-export + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.BUILD_NAME }} + path: ~/build/${{ env.BUILD_NAME }}/ + if-no-files-found: error + retention-days: 14 + + export-linux: + name: Export GodSVG for Linux + runs-on: ubuntu-latest + env: + PLATFORM: "Linux/X11" + EXTENSION: "x86_64" + BUILD_NAME: "linux-64bit" + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up Godot + uses: ./.github/actions/set-up-godot + - name: Export project + uses: ./.github/actions/godot-export + - name: Make Linux export runnable + run: | + # Set run permission. + chmod +x ~/build/${BUILD_NAME}/${PROJECT_NAME}.x86_64 + cd ~/build + tar zcvf ${BUILD_NAME}.tar.gz ${BUILD_NAME} + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.BUILD_NAME }} + path: ~/build/${{ env.BUILD_NAME }}.tar.gz + if-no-files-found: error + retention-days: 14 diff --git a/.github/workflows/dev-web.yml b/.github/workflows/dev-web.yml new file mode 100644 index 00000000..0f063e74 --- /dev/null +++ b/.github/workflows/dev-web.yml @@ -0,0 +1,43 @@ +name: dev-web + +on: + workflow_dispatch: + push: + branches: [ main ] + + +env: + GODOT_VERSION: 4.2.2 + GODOT_RELEASE: rc3 + PROJECT_NAME: GodSVG + + +jobs: + export-web: + name: Export GodSVG for web and publish. + runs-on: ubuntu-latest + env: + PLATFORM: "Web" + EXTENSION: "html" + BUILD_NAME: "web" + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up Godot + uses: ./.github/actions/set-up-godot + - name: Export project + uses: ./.github/actions/godot-export + - name: Finish up Web build. + run: | + cd ~/build/${BUILD_NAME}/ + # Rename main html file to index.html so browsers can find it. + mv ${PROJECT_NAME}.html index.html + # Add service worker so project loads on github pages. This can maybe be removed when switch to Godot 4.3. + wget https://github.com/gzuidhof/coi-serviceworker/raw/master/coi-serviceworker.js + # This adds the line in index.html that loads the service worker script. It does that by first finding the main script tag and adding to it. + sed -i 's#\( \)# \n\1#g' index.html + - name: Publish on Github pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: ~/build/${{ env.BUILD_NAME }} + target-folder: dev diff --git a/README.md b/README.md index 455a6945..7c8feb4a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Download the version you want from [the list of GodSVG releases](https://github. Note that if you're on MacOS, you need to [disable Gatekeeper](https://disable-gatekeeper.github.io/) if you haven't yet. I don't have the time or money to deal with Apple's gatekeeping. -Link to the web build: https://mewpurpur.github.io/GodSVG/web-build (Currently experimental) +Link to the web build: https://mewpurpur.github.io/GodSVG/dev (Currently experimental) To run the latest unreleased version, you can download Godot from https://godotengine.org (v4.2.2.rc2 required). After getting the repository files on your machine, you must open Godot, click the "Import" button, and import the `project.godot` folder. If there are a lot of errors which some people have reported, it's Godot's fault. Try closing and opening the project a few times, changing small things on the code that errors out, etc. until the errors hopefully clear. diff --git a/export_presets.cfg b/export_presets.cfg index 0cfee5ee..6a78d2b0 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -217,7 +217,7 @@ export_filter="exclude" export_files=PackedStringArray() include_filter="" exclude_filter="web-build/*, *.md, *.ico, visual/editor_only/*" -export_path="../GodSVG meta/GodSVG exports/GodSVG.html" +export_path="" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false @@ -226,7 +226,7 @@ encrypt_directory=false [preset.3.options] custom_template/debug="" -custom_template/release="/home/volter/Desktop/godot/bin/web_release.zip" +custom_template/release="" variant/extensions_support=false vram_texture_compression/for_desktop=true vram_texture_compression/for_mobile=false