Skip to content

Browser changes - #39

Open
thomasballinger wants to merge 5 commits into
masterfrom
endless-web
Open

thomasballinger wants to merge 5 commits into
masterfrom
endless-web

Conversation

@thomasballinger

@thomasballinger thomasballinger commented Oct 16, 2022

Copy link
Copy Markdown
Owner

Pull request just for reference, a nice place to see and annotate the diff.


Note

High Risk
Large, cross-platform CI/release pipeline and build-system changes (CMake/vcpkg packaging, installers, and artifact layout) are prone to breaking builds or releases if any preset/dependency/install rule is off.

Overview
Major CI/CD rebuild: removes AppVeyor, the .winmake SCons wrapper, and Code::Blocks project files, and rewrites GitHub Actions to build/test/package via CMake + vcpkg + Ninja across Linux, Windows (x64/x86 + clang-cl), macOS (x64 + ARM), plus Steam container builds; adds concurrency/permissions hardening, caching, and a dedicated Windows parse-assets/data-parse job.

Build system added: introduces top-level CMakeLists.txt and an extensive CMakePresets.json, adds CPack/NSIS installer packaging for Windows, AppImage packaging flow updated to install-from-CMake outputs, and adds a Doxygen config + CI job to generate API docs.

Project hygiene/community updates: expands .editorconfig and replaces .ecrc with .editorconfig-checker.json, updates codespell ignore lists (incl. new .codespell.words.exclude), adjusts .gitignore/.gitattributes, refreshes issue/PR templates (new wiki template + extra bug-report fields), adds workflow path filters, and introduces a scheduled wiki-sync workflow plus a new browser.yml workflow for Emscripten/AWS deploys.

Written by Cursor Bugbot for commit 52ff73d. This will update automatically on new commits. Configure here.

@thomasballinger
thomasballinger temporarily deployed to aws-deploy October 16, 2022 20:43 Inactive
@thomasballinger
thomasballinger temporarily deployed to aws-deploy May 29, 2023 20:38 — with GitHub Actions Inactive
@thomasballinger
thomasballinger temporarily deployed to aws-deploy May 29, 2023 20:40 — with GitHub Actions Inactive
@thomasballinger
thomasballinger temporarily deployed to aws-deploy May 29, 2023 21:03 — with GitHub Actions Inactive
restore-keys: ${{ env.RESTORE_KEYS }}
append-timestamp: 'false'
- name: Adjust version strings
run: ./utils/cd_update_versions.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing shell: bash breaks Windows release build

High Severity

The Adjust version strings step in release_windows_x64 runs ./utils/cd_update_versions.sh without specifying shell: bash. On Windows runners, the default shell is PowerShell, which cannot execute .sh scripts. The equivalent step in cd.yaml for the cd_windows_x64 job correctly includes shell: bash. This will cause the Windows x64 release build to fail.

Fix in Cursor Fix in Web

name: steam-win32-depot
path: |
./install/release/Endless Sky.exe
./install/release/*.dll

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows x86 release missing version string adjustment

Medium Severity

The release_windows_x86 job is missing the Adjust version strings step that exists in every other release job (release_appimage_x64, release_windows_x64, release_macos_x64, release_macos_arm). This means Windows x86 releases will ship with incorrect or default version strings. The job is also missing the Find cache keys and Setup ccache steps, suggesting it was incompletely set up.

Fix in Cursor Fix in Web

Comment thread .github/workflows/browser.yml
steam:
value: ${{ jobs.changed.outputs.steam }}
doxygen_config:
value: ${{ jobs.changed.outputs.doxygen_config }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing doxygen_config job output breaks CI trigger

Medium Severity

The workflow-level output doxygen_config references jobs.changed.outputs.doxygen_config, but the changed job's outputs section (lines 44–60) never defines doxygen_config. The filter exists in path-filters.yml and is produced by the dorny/paths-filter step, but it's not mapped to a job output. As a result, needs.changed.outputs.doxygen_config is always empty in consuming workflows, so the build_documentation_doxygen job in ci.yml won't trigger when only the Doxyfile changes.

Additional Locations (1)

Fix in Cursor Fix in Web

@@ -0,0 +1,3 @@
{
"Exclude": ["test_datafile.cpp", "\\Shader.cpp$", "Font.cpp", "Mask.cpp"]
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed .mp3 exclusion from editorconfig checker config

Medium Severity

The old .ecrc excluded \\.mp3$ from editorconfig checking, but the replacement .editorconfig-checker.json drops this exclusion. The [*] rule in .editorconfig now applies charset = ascii and insert_final_newline = true to all files. When the editorconfig style check runs (triggered by any non-mp3 file change), it will now also check binary .mp3 files in sounds/, which will fail the ASCII charset check.

Fix in Cursor Fix in Web

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

- name: Extract arm artifact
run: |
cd arm
7z x macos-artifact-arm.zip

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artifact download paths break macOS universal build

High Severity

The path parameter in actions/download-artifact@v4 specifies a directory, not a file path. Using path: x64/macos-artifact-x64.zip creates a directory named macos-artifact-x64.zip inside x64/, so the actual zip file ends up at x64/macos-artifact-x64.zip/macos-artifact-x64.zip. The subsequent cd x64 && 7z x macos-artifact-x64.zip then tries to extract a directory, not a file, causing the macOS universal binary release job to fail. Same issue applies to the ARM artifact with path: arm/macos-artifact-arm.zip.

Fix in Cursor Fix in Web

Add the core changes needed to compile and run Endless Sky under
Emscripten/WebAssembly:

- source/Files.cpp: Hardcode resource/config paths to '/' under Emscripten
- source/main.cpp: Mount IDBFS at /saves for persistent save storage
- source/PlayerInfo.cpp: Sync saves to IndexedDB after save/autosave
- source/LoadPanel.cpp: Sync to IndexedDB after snapshot/delete operations
- source/GameWindow.cpp: Skip resolution warning under Emscripten, add
  printf to ExitWithError for browser console visibility
- Makefile: Web-specific build using emcc, with libjpeg-turbo cross-compile,
  ASYNCIFY for blocking game loop, WebGL2, IDBFS, and all source subdirs.
  libjpeg-turbo is built with -DENABLE_SHARED=0: otherwise cmake also emits
  libjpeg.so, which '-l jpeg' prefers over the static archive. Since
  emscripten 6.0.0 disabled FAKE_DYLIBS by default that .so is a real dynamic
  library, and including it implies -sMAIN_MODULE=2, which fails the link with
  "relocation ... cannot be used against symbol; recompile with -fPIC".
- docs/readme-developer.md: document the web build

Based on original web port commits by Michał Janiszewski and Thomas Ballinger:
4f8dc37, 0a1597a, 458ea2e, d5e13af, 862875a, c272718
Make the game run without threads under Emscripten:

- source/TaskQueue.cpp: Under __EMSCRIPTEN__, execute async tasks
  synchronously on the calling thread, skip worker thread pool creation,
  and remove mutex usage. This single change replaces the old 12-file
  ES_NO_THREADS approach since all threading now goes through TaskQueue.

- source/audio/Audio.cpp: Load sounds synchronously instead of in a
  background thread, and skip music playback.

- source/audio/Music.cpp: Skip the Mp3Supplier/FlacSupplier includes and
  return a null supplier from CreateSupplier(), so the build needs neither
  libmad nor FLAC++. The Makefile excludes those suppliers from compilation.

Threads do work in the browser (see the threads branch), but the shared
SharedArrayBuffer heap they require makes Safari reload the page for using
too much memory, so the shipped build stays single-threaded for now.

Based on original commits: 2597b58, 4b8fb21
Add the web-specific frontend files:

- endless-sky.html: Shell HTML with loading screen, IndexedDB asset
  caching, plugin support, save upload/download, mobile touch controls
- js/cached-resource.js: IndexedDB-based asset caching with versioning
- js/plugins.js: Plugin management UI for the web build
- js/save-games.js: Save game upload/download functionality
- loading.mp3: Background music for the loading screen
- hash-data.py: Generate content hashes for cache busting
- copy-to-hashed-location.py: Copy files to content-addressed paths
- credits.txt: Add WebAssembly port credits
- .editorconfig: Allow UTF-8 in credits.txt, so contributor names can be
  spelled correctly. Follows the existing exemptions for changelog,
  copyright, and the appdata/desktop files.

Based on original commits: 0a1597a, 33c929d, f021f7e, 22d4cf2,
d22e015, da5f15e, 458ea2e, e6eb21b, 5b868ac, b68c917,
0ba92cc
Add GitHub Actions workflow for building the Emscripten/WebAssembly
version in CI, pinned to emsdk 6.0.6 to match docs/readme-developer.md.

Based on original commits: d0e5244, 1ef0210, ab64c72, f52f00e
endless-sky.js was hashed before its .wasm/.data references were rewritten
into it, then the rewritten copy was moved over the hashed filename. The
name therefore described the pre-rewrite contents, so two builds differing
only in C++ produced the same filename. Because the rewrite only swaps one
32-hex hash for another, the file length never changed either -- so
'aws s3 sync --size-only' saw the same key at the same size and skipped the
upload. The site kept loading the previous build's wasm.

This silently reverted the sound-effect fix: the corrected wasm uploaded
fine, but no JavaScript referencing it ever did, leaving it orphaned in the
bucket while index.html pointed at the older one.

Hash endless-sky.js last, after the rewrite, so the filename reflects the
bytes that actually ship. --size-only is kept: with correct content
addressing, changed content means a new key, and dropping it would re-upload
the 400MB data bundle on every deploy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant