Repository navigation
Deploy the tested Web release to Vercel through CI #20
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
057b6d2
Deploy the tested Web release to Vercel through CI
vriesdcrv d2c6506
Check the native fetch response status in the public deployment smoke
vriesdcrv 9bbe27e
Resolve artifact download redirects inside the Vercel build
vriesdcrv 01edd80
Isolate final-mix recordings from random playback state
vriesdcrv 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -35,3 +35,5 @@ node_modules/ | |
| tools/web_tests/test-results/ | ||
| tools/web_tests/playwright-report/ | ||
| .audit/ | ||
| .vercel/ | ||
| .vercel-source/ | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,34 @@ | ||
| # 0020. Publish the tested Web artifact through Vercel CI | ||
|
|
||
| Deploy production only after the native and browser jobs succeed on a push to | ||
| `main`. Disable Vercel Git auto-deploys, use a GitHub production environment, | ||
| and serialize main runs so older production deployments cannot overtake newer | ||
| ones. Node 26.x and Vercel CLI 65.16.0 are pinned for the deployment tooling. | ||
|
|
||
| Use the existing Vercel Hobby team, matching Space Explorer's CI ownership of | ||
| production. The Web release is about 168 MB, above Hobby's 100 MB CLI source-upload | ||
| limit. A small source upload therefore contains only the static hosting config, | ||
| a Python build script, and the current CI run's artifact identity and digest. | ||
| Resolve GitHub's one-minute download redirect inside the build, immediately before | ||
| fetching it. Pass only the deployment job's temporary, repository-scoped GitHub | ||
| token as a build-only secret, with contents/Actions read permissions. Never put it | ||
| in source files, public assets, or requests to redirected artifact storage. | ||
| The build checks GitHub's immutable artifact archive SHA-256, the expected source | ||
| commit, clean release preset, and the complete | ||
| exported file inventory. Only `build/web` becomes public. Godot is not rebuilt. | ||
|
|
||
| Serve COOP `same-origin`, COEP `require-corp`, and `application/wasm` on the engine | ||
| binary. Revalidate stable filenames rather than caching them immutably across | ||
| production releases. Missing paths remain missing; there is no SPA fallback. | ||
|
|
||
| Create a production deployment with `--skip-domain`, exercise the actual hosted | ||
| game, then promote only after that check passes. The staged check uses an | ||
| automation bypass header and cookie so audio worklets can load on a protected | ||
| deployment. Do not record traces containing the bypass credential. After | ||
| promotion, check the production domain without authentication. Keep play and | ||
| saves on the stable production origin. | ||
|
|
||
| The GitHub job token expires after the job. CI supplies a fresh token for each | ||
| deployment; dashboard source rebuilds of old deployments are not supported. | ||
| Existing ready deployments can be promoted or rolled back. Do not upgrade the Vercel plan or add an asset | ||
| hosting service for this workflow. |
This file contains hidden or 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 hidden or 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,51 @@ | ||
| #!/usr/bin/env python3 | ||
| """Create a tiny Vercel source upload referring to this run's immutable artifact.""" | ||
| import argparse | ||
| import json | ||
| import os | ||
| from pathlib import Path | ||
| import re | ||
| import shutil | ||
| import subprocess | ||
| from urllib.request import Request, urlopen | ||
|
|
||
| ROOT = Path(__file__).resolve().parent.parent | ||
|
|
||
|
|
||
| def prepare(repository, run_id, commit, output): | ||
| token = os.environ.get('GH_TOKEN') or os.environ.get('GITHUB_TOKEN') | ||
| if not token: | ||
| token = subprocess.check_output(['gh', 'auth', 'token'], text=True).strip() | ||
| headers = {'Authorization': f'Bearer {token}', 'Accept': 'application/vnd.github+json', | ||
| 'X-GitHub-Api-Version': '2022-11-28'} | ||
| api = f'https://api.github.com/repos/{repository}/actions' | ||
| request = Request(f'{api}/runs/{run_id}/artifacts?per_page=100', headers=headers) | ||
| with urlopen(request, timeout=30) as response: | ||
| artifacts = json.load(response)['artifacts'] | ||
| matches = [item for item in artifacts if item['name'] == f'farlanding-web-{commit}' | ||
| and not item['expired'] and str(item['workflow_run']['id']) == str(run_id)] | ||
| if len(matches) != 1: | ||
| raise ValueError('Expected exactly one release artifact from the current run') | ||
| artifact = matches[0] | ||
| digest = artifact.get('digest', '') | ||
| if not re.fullmatch(r'sha256:[0-9a-f]{64}', digest): | ||
| raise ValueError('GitHub did not supply a SHA-256 archive digest') | ||
| output.mkdir(parents=True, exist_ok=True) | ||
| shutil.copyfile(ROOT / 'vercel.json', output / 'vercel.json') | ||
| shutil.copyfile(ROOT / 'tools/vercel_build.py', output / 'build.py') | ||
| (output / '.vercelignore').write_text('public/\n.vercel/\n') | ||
| (output / 'artifact.json').write_text(json.dumps({ | ||
| 'repository': repository, 'artifact_id': artifact['id'], | ||
| 'sha256': digest.removeprefix('sha256:'), 'commit': commit, | ||
| })) | ||
| print(f'Prepared Vercel source for tested artifact {artifact["id"]} at {commit}') | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument('--repository', required=True) | ||
| parser.add_argument('--run-id', required=True) | ||
| parser.add_argument('--commit', required=True) | ||
| parser.add_argument('--output', type=Path, default=Path('.vercel-source')) | ||
| args = parser.parse_args() | ||
| prepare(args.repository, args.run_id, args.commit, args.output) | ||
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.
Uh oh!
There was an error while loading. Please reload this page.