-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add webassembly build #70697
Merged
Merged
add webassembly build #70697
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
75d3dc9
emscripten
rameshvarun c9b80c4
fix build
nornagon 41741ab
restore version
nornagon 2d9d48b
html updates
nornagon bcaf6ce
permit webgl 2
nornagon 2cedbbf
-gseparate-dwarf
nornagon fe2deb1
github action
nornagon e0ac135
fix action branches
nornagon fcdf2ee
fix action more
nornagon a14e565
automatically detect parallelism
nornagon 010d887
fix separate-dwarf to only be on ldflags
nornagon 273fa84
fix artifact name
nornagon eae5933
un-disable warnings?
nornagon 0eba251
move ASYNCIFY to ldflags
nornagon 0fc790d
fix scripts
nornagon dca8093
fix scripts
nornagon 6f928a2
allow all tilesets, simplify obsolete mod removal
nornagon d9b1a39
build with std=gnu++17
nornagon 06bed36
remove pre.js
nornagon 18cbdd7
remove emscripten_exception.cpp
nornagon 4778a2c
instead of gnu++17, turn off the warning
nornagon 33dff59
wrap more things in #if defined(EMSCRIPTEN)
nornagon 884d527
cleanups
nornagon 0c066ad
put filesystem.cpp changes behind #define
nornagon 4ce8b73
browse link points to main CDDA repo
nornagon c6199b9
reformat index.html with prettier
nornagon f01a309
astyle
nornagon 942c101
update workflow
nornagon ae13f67
remove unused env in workflow
nornagon bf9d67f
remove nonsense
nornagon b761397
ignore ESC in main menu
nornagon d3bafce
speedbump when closing page if game is unsaved
nornagon b61cff3
fs sync polling => precise
nornagon e64dd60
forgot to include emscripten.h
nornagon 0e8d6fa
don't strip emscripten
nornagon 0a9a09a
astyle
nornagon c6ff81d
expose setFsNeedsSync on window
nornagon b484fdf
acorn bug...?
nornagon 60ef5cf
looks like -gseparate-dwarf prevents some binaryen opts
nornagon 99eb8b6
we don't generate the debug.wasm any more
nornagon 7ecee4e
Merge branch 'master' into emscripten-new
nornagon 45f3573
move game_unsaved = false to before return in game::save
nornagon a225a5c
make setFsNeedsSync static to suppress -Wmissing-declarations error
nornagon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Emscripten build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- 'android/**' | ||
- 'build-data/osx/**' | ||
- 'doc/**' | ||
- 'doxygen_doc/**' | ||
- 'lang/**' | ||
- 'lgtm/**' | ||
- 'tools/**' | ||
- '!tools/format/**' | ||
- 'utilities/**' | ||
pull_request: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- 'android/**' | ||
- 'build-data/osx/**' | ||
- 'doc/**' | ||
- 'doxygen_doc/**' | ||
- 'lang/**' | ||
- 'lgtm/**' | ||
- 'tools/**' | ||
- '!tools/format/**' | ||
- 'utilities/**' | ||
|
||
# We only care about the latest revision of a PR, so cancel previous instances. | ||
concurrency: | ||
group: emscripten-build-${{ github.event.pull_request.number || github.ref_name }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_catatclysm: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: mymindstorm/setup-emsdk@v13 | ||
|
||
- name: Prepare web data | ||
run: ./build-scripts/prepare-web-data.sh | ||
|
||
- name: Build with emcc (emscripten) | ||
run: ./build-scripts/build-emscripten.sh | ||
|
||
- name: Assemble web bundle | ||
run: ./build-scripts/prepare-web.sh | ||
|
||
- name: Create artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: play-cdda | ||
path: build/* |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -exo pipefail | ||
|
||
emsdk install 3.1.51 | ||
emsdk activate 3.1.51 | ||
|
||
make -j`nproc` NATIVE=emscripten BACKTRACE=0 TILES=1 TESTS=0 RUNTESTS=0 RELEASE=1 cataclysm-tiles.js | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious if ccache works with emcc so we can reduce build times. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this is definitely worth looking into. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
set -exo pipefail | ||
|
||
rm -rf web_bundle | ||
|
||
BUNDLE_DIR=web_bundle | ||
DATA_DIR=$BUNDLE_DIR/data | ||
mkdir -p $DATA_DIR | ||
cp -R data/{core,font,fontdata.json,json,mods,names,raw,motd,credits,title,help} $DATA_DIR/ | ||
cp -R gfx $BUNDLE_DIR/ | ||
|
||
# Remove .DS_Store files. | ||
find web_bundle -name ".DS_Store" -type f -exec rm {} \; | ||
|
||
# Remove obsolete mods. | ||
echo "Removing obsolete mods..." | ||
for MOD_DIR in $DATA_DIR/mods/*/ ; do | ||
if jq -e '.[] | select(.type == "MOD_INFO") | .obsolete' "$MOD_DIR/modinfo.json" >/dev/null; then | ||
echo "$MOD_DIR is obsolete, excluding from web_bundle..." | ||
rm -rf $MOD_DIR | ||
fi | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
set -exo pipefail | ||
|
||
mkdir -p build/ | ||
cp \ | ||
index.html \ | ||
cataclysm-tiles.{data,js,wasm} \ | ||
data/font/Terminus.ttf \ | ||
build | ||
cp data/cataicon.ico build/favicon.ico |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since #70870 is now uploading WebAssembly builds, should we remove this step here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still handy for development—the emscripten SDK doesn't work well on macOS or Windows, so it's handy to be able to download the built artifact from CI for testing. I'm not aware of any major downsides to uploading it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought
upload-artifact
shares the total GitHub Actions storage limit of the repository, so too many build artifact uploads could evict other data like ccache.But I just re-checked GitHub Actions doc and it only says GitHub Actions storage usage is free for public repositories without mentioning storage limits or data eviction policy, so I'm not too sure now.