Skip to content

Commit

Permalink
ci: don't upload debug build to cf, too big, and a bunch of fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
julie-dujardin committed Aug 3, 2024
1 parent e81278d commit b9ec5ad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 33 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ jobs:
strategy:
fail-fast: false
matrix:
build_type: [release, debug]
build_type: [release] # debug blocks_plus_plus.wasm is 62.4 MiB and I'm not uploading more stuff to R2

runs-on: ubuntu-22.04
environment: main
Expand All @@ -198,13 +198,12 @@ jobs:
run: |
cp deploy/cloudflare-pages/* wasm32/
# exclude the engine file from cloudflare pages because it's too big
engine_hash=($(sha256sum wasm32/index.side.wasm))
export engine_hash=($(sha256sum wasm32/index.side.wasm))
rm wasm32/index.side.wasm
# ugly hack to force godot to pull the engine from another domain
build_type=${{ matrix.build_type }}
sed -i "s/{{{DIR}}}/${build_type}_${GODOT_VERSION}_${engine_hash[1]}/" deploy/templates/readAsyncNew
sed -e '/readAsync = (url, onload, onerror) => {/{r readAsyncNew' -e 'd;}' wasm32/index.js > _index.js
mv _index.js wasm32/index.js
export build_type=${{ matrix.build_type }}
sed -i -e "s|{{{DIR}}}|${build_type}_${GODOT_VERSION}_${engine_hash[0]}|g" deploy/templates/readAsyncNew
sed -i -e '/readAsync = (url, onload, onerror) => {/{r deploy/templates/readAsyncNew' -e 'd;}' wasm32/index.js
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
Expand Down
44 changes: 17 additions & 27 deletions .github/workflows/compile_godot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,14 @@ jobs:
path: templates

publish-web:
name: Publish web engine to cloudflare
strategy:
fail-fast: false
matrix:
build_type: [release] # debug build is big, maybe i'll do it later

name: Publish ${{ matrix.build_type }} web engine to cloudflare
runs-on: ubuntu-22.04
environment: main
needs: [compile-web]
steps:
- name: Download web templates
Expand All @@ -258,13 +264,11 @@ jobs:
name: templates-web-${{ env.GODOT_VERSION }}
- name: Prepare Upload
run: |
unzip templates-web-${{ env.GODOT_VERSION }}
unzip web_dlink_release.zip -d release_files
mkdir release_engine
mv release_files/godot.side.wasm release_engine/index.side.wasm
release_hash=($(sha256sum release_engine/index.side.wasm))
echo "RELEASE_HASH=${release_hash[1]}" >> $GITHUB_ENV
unzip web_dlink_${{ matrix.build_type }}.zip -d template_files
mkdir engine
mv template_files/godot.side.wasm engine/index.side.wasm
engine_hash=($(sha256sum engine/index.side.wasm))
echo "ENGINE_HASH=${engine_hash[0]}" >> $GITHUB_ENV
unzip web_dlink_debug.zip -d debug_files
mkdir debug_engine
Expand All @@ -273,28 +277,14 @@ jobs:
echo "DEBUG_HASH=${debug_hash[1]}" >> $GITHUB_ENV
# Only Upload the engine if it doesn't exist already
curl --head --fail https://godot-engine.static.ilus.pw/index.side.wasm
if [ $? -ne 0 ]; then
curl --head --fail https://godot-engine.static.ilus.pw/${{ matrix.build_type }}_${{ env.GODOT_VERSION }}_${{ env.ENGINE_HASH }}/index.side.wasm || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
echo "UPLOAD_ENGINE=true" >> $GITHUB_ENV
else
echo "UPLOAD_ENGINE=false" >> $GITHUB_ENV
fi
- name: Upload release engine to R2
if: env.UPLOAD_ENGINE == 'true'
uses: jakejarvis/s3-sync-action@master
with:
args: --delete
env:
AWS_S3_ENDPOINT: https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com
AWS_S3_BUCKET: ${{ secrets.R2_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_REGION: auto
SOURCE_DIR: release_engine
DEST_DIR: release_${{ env.GODOT_VERSION }}_${{ env.RELEASE_HASH }}

- name: Upload debug engine to R2
- name: Upload ${{ matrix.build_type }} engine to R2
if: env.UPLOAD_ENGINE == 'true'
uses: jakejarvis/s3-sync-action@master
with:
Expand All @@ -305,5 +295,5 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_REGION: auto
SOURCE_DIR: debug_engine
DEST_DIR: debug_${{ env.GODOT_VERSION }}_${{ env.DEBUG_HASH }}
SOURCE_DIR: engine
DEST_DIR: ${{ matrix.build_type }}_${{ env.GODOT_VERSION }}_${{ env.RELEASE_HASH }}

0 comments on commit b9ec5ad

Please sign in to comment.