Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions doc/source/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
--bg-2: #15130f;
--bg-3: #1c1a14;
--fg: #e8e2d2;
--fg-soft: #c1baa9;
--fg-dim: #9b9281;
--fg-faint: #5b5547;
--rule: #2a2620;
Expand Down Expand Up @@ -264,17 +265,37 @@ a:hover { color: var(--fg) !important; border-bottom-color: var(--fg) !important
text-transform: uppercase;
}

/* Domain signatures (function/class/etc. directives) */
.rst-content dl.py dt,
.rst-content dl.c dt,
.rst-content dl.cpp dt,
.rst-content dl.rst dt {
/* Domain signatures (function/class/etc. directives).
* Sphinx 4+ tags every directive signature dt with `sig sig-object DOMAIN`,
* so one selector covers py/c/cpp/rst plus the custom `das` domain. */
.rst-content dt.sig-object {
background: var(--bg-2) !important;
border: 1px solid var(--rule) !important;
border-radius: 4px;
color: var(--fg);
color: var(--fg) !important;
font-family: var(--font-mono);
}
/* Signature inner spans — sphinx_rtd_theme paints them dark-blue/black on
* white by default, which is unreadable on the dark background. Map them
* onto the same palette the code-block highlighter uses. */
.rst-content dt.sig-object .sig-name,
.rst-content dt.sig-object .sig-name.descname { color: var(--amber) !important; }
.rst-content dt.sig-object .sig-prename,
.rst-content dt.sig-object .sig-prename.descclassname { color: var(--fg-dim) !important; }
.rst-content dt.sig-object .sig-paren,
.rst-content dt.sig-object .sig-param,
.rst-content dt.sig-object .sig-param .n,
.rst-content dt.sig-object .sig-param .pre,
.rst-content dt.sig-object .sig-return,
/* daslang return type renders as bare .pre direct-children of dt, outside
* any sig-return wrapper — dim those too. */
.rst-content dt.sig-object > .pre { color: var(--fg-dim) !important; }

/* Field lists (Arguments:, Returns:, etc.). The "Arguments:" label and the
* bold parameter names sit at full --fg by default, which reads as a wall
* of white in long type signatures — recess them one notch toward grey. */
.rst-content dl.field-list > dt,
.rst-content dl.field-list strong { color: var(--fg-soft) !important; }

/* Footer */
.rst-footer-buttons .btn {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
slug: emsdk-step0-only-clones-need-install-activate-too
title: Why does my CI Emscripten WASM build fail with "Could not find toolchain file" when the emsdk repo was cloned successfully?
created: 2026-05-14
last_verified: 2026-05-14
links: []
---

**`step0_emsdk_install.sh` (a one-liner: `git clone https://github.com/emscripten-core/emsdk.git`) only clones the emsdk *wrapper*. The actual Emscripten toolchain — `emsdk/upstream/emscripten/`, which is what `-DCMAKE_TOOLCHAIN_FILE=.../Emscripten.cmake` resolves against — only lands after you also run `./emsdk install <version>` and `./emsdk activate <version>`.**

Without the install+activate, `emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake` does not exist, cmake errors with:
```
CMake Error at .../CMakeDetermineSystem.cmake:159 (message):
Could not find toolchain file:
"../emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
```

The trap: `step0_emsdk_install.sh` looks like it's doing the install. It's only doing the clone. The actual install is in the activate script (`step1_emsdk_activate_linux.sh`):

```bash
./emsdk/emsdk install latest
./emsdk/emsdk activate latest
source ./emsdk_env.sh
```

## CI recipe

```yaml
- name: "Build WASM (Emscripten)"
run: |
set -eux
cd web
bash step0_emsdk_install.sh # clone wrapper
./emsdk/emsdk install latest # download toolchain (~1 GB)
./emsdk/emsdk activate latest # set version pointer
bash -c "source emsdk/emsdk_env.sh && \
cd build && cmake ... && ninja"
```

`source ./emsdk_env.sh` only sets env vars; without `install + activate` first, the env points at nothing useful. Pin to a specific version (`install 3.1.74`) for reproducible deploys instead of `latest`.

## Where this bit me

daslang.io Forge redesign (PR #2648): the new pages.yml shipped without the install+activate pair, so the WASM build stage failed every deploy. `continue-on-error: true` painted it green in the run summary, and the original staging guard `if [ -d web/output ]` was satisfied (cmake configure created the empty dir even on failure) — silent breakage for hours. The round-5 placeholder gate `if [ -f web/output/daslang_static.js ]` surfaced it loudly when the post-merge deploy finally served the "Runtime rebuild in progress" page. Fixed by adding the two missing commands in [pages.yml](.github/workflows/pages.yml) ahead of the cmake call.

## Questions
- Why does my CI Emscripten WASM build fail with "Could not find toolchain file" when the emsdk repo was cloned successfully?
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
slug: github-pages-env-protection-blocks-pr-workflows-split-build-deploy
title: Why does my GitHub Actions Pages workflow fail instantly on PRs with "Branch is not allowed to deploy to github-pages due to environment protection rules"?
created: 2026-05-14
last_verified: 2026-05-14
links: []
---

**The `environment:` block at the job level is the culprit. Attaching `environment: github-pages` to a job causes GitHub to evaluate the environment's deployment-branch protection rule *before* any step runs — and PR branches don't match the rule's "only deploy from default branch" default.**

Symptoms:
- Job conclusion: `failure`
- `started_at` ≈ `completed_at` (1-2 seconds)
- `runner_id: 0`, `runner_name: ""` (no runner ever assigned)
- `steps: []` (no step recorded)
- Annotation: `Branch "refs/pull/N/merge" is not allowed to deploy to github-pages due to environment protection rules.`

The check fires for `refs/pull/N/merge` (the synthetic merge ref PRs use), `workflow_dispatch` on a non-default branch, and any other non-master push. The deploy steps inside the job are correctly gated by `if: github.ref == 'refs/heads/master'`, but that gate never gets to fire because the job-level `environment:` declaration is what triggers the protection check.

## Two fixes

**Defense-in-depth (correct):** split into separate jobs.

```yaml
jobs:
build: # runs everywhere, no environment attached
steps:
- ... real build steps ...
- if: github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v3

deploy: # only on master, environment attached, env rule satisfied
if: github.ref == 'refs/heads/master'
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
```

PR builds now run to completion (real CI signal), the env protection rule still gates the actual publish, and the workflow's master-only `if:` is the primary gate.

**Quick unblock (defense-out):** disable the environment's branch protection.

```bash
gh api -X PUT repos/OWNER/REPO/environments/github-pages \
--input - <<<'{"deployment_branch_policy": null}'
```

Trade-off: the workflow's step-level `if:` checks become the only barrier. For personal-project repos, fine. For shared infra, prefer the split.

**Why `*` wildcard policy doesn't work:** GitHub's deployment-branch policies match against branch names like `master` / `feature/x`. The synthetic `refs/pull/N/merge` ref is neither a branch nor a tag — `*` matches nothing in this case.

## Where this bit me

dasImgui PR #24 (2026-05-13): the docs.yml workflow had `environment: github-pages` at the job level, so every PR build instant-failed. First docs PR on the repo, so the latent issue surfaced. PR #25 (split build/deploy) fixed the structure; the protection rule was restored to default-branch-only after the refactor landed.

## Questions
- Why does my GitHub Actions Pages workflow fail instantly on PRs with "Branch is not allowed to deploy to github-pages due to environment protection rules"?
5 changes: 3 additions & 2 deletions site/downloads.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<a href="downloads.html">downloads</a>
<a href="blog/index.html">blog</a>
<a href="https://t.me/daScript">community</a>
<a href="playground/index.html">playground</a>
</div>
</div>
<div class="forge-nav__right">
Expand Down Expand Up @@ -71,7 +72,7 @@ <h2 class="forge-h2">Pre-built binaries</h2>
GitHub Releases. Pick the archive that matches your
platform, unzip, add to PATH.
</p>
<a class="forge-link-amber" href="https://github.com/GaijinEntertainment/daScript/releases">github.com/GaijinEntertainment/daScript/releases →</a>
<a class="forge-link-amber" href="https://github.com/GaijinEntertainment/daScript/releases">github.com/GaijinEntertainment/daslang/releases →</a>
</div>
<div>
<div class="forge-news__row">
Expand All @@ -82,7 +83,7 @@ <h2 class="forge-h2">Pre-built binaries</h2>
<div class="forge-news__row">
<div class="forge-news__date">repo</div>
<div class="forge-news__tag">source</div>
<div class="forge-news__title"><a href="https://github.com/GaijinEntertainment/daScript">GaijinEntertainment/daScript — clone &amp; build from source</a></div>
<div class="forge-news__title"><a href="https://github.com/GaijinEntertainment/daScript">GaijinEntertainment/daslang — clone &amp; build from source</a></div>
</div>
<div class="forge-news__row">
<div class="forge-news__date">all tags</div>
Expand Down
2 changes: 1 addition & 1 deletion site/files/forge.css
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ button { font: inherit; border: 0; background: none; color: inherit; cursor: poi
font-family: var(--font-mono);
font-size: 12px;
}
.forge-stat__n { color: var(--fg); font-size: 22px; }
.forge-stat__n { color: var(--fg); font-size: 22px; white-space: nowrap; }
.forge-stat__l { color: var(--fg-faint); margin-top: 2px; }

/* ───── Terminal / code panel (hero right column) ───── */
Expand Down
21 changes: 11 additions & 10 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<a href="downloads.html">downloads</a>
<a href="blog/index.html">blog</a>
<a href="https://t.me/daScript">community</a>
<a href="playground/index.html">playground</a>
</div>
</div>
<div class="forge-nav__right">
Expand Down Expand Up @@ -118,7 +119,7 @@ <h1>
}
}</code></pre>
<div class="forge-output" id="hero-output">
<div class="forge-output__line"><span class="forge-output__prompt">$</span> daslang run hello.das</div>
<div class="forge-output__line"><span class="forge-output__prompt">$</span> daslang hello.das</div>
<div class="forge-output__line forge-output__stdout">hello, world</div>
<div class="forge-output__line forge-output__hint"> tick 0 · tick 1 · tick 2</div>
<div class="forge-output__line forge-output__ok">✓ 0.42 ms · interpreted</div>
Expand Down Expand Up @@ -262,7 +263,7 @@ <h2 class="forge-h2">Grab a release. Or build from source.</h2>
build straight from the repo. AOT compiles to a single C++ stub
you link with your host.
</p>
<a class="forge-link-amber" href="https://github.com/GaijinEntertainment/daScript">github.com/GaijinEntertainment/daScript →</a>
<a class="forge-link-amber" href="https://github.com/GaijinEntertainment/daScript">github.com/GaijinEntertainment/daslang →</a>
</div>
<div class="forge-install__panel">
<div class="forge-install__tabs" role="tablist">
Expand All @@ -272,26 +273,26 @@ <h2 class="forge-h2">Grab a release. Or build from source.</h2>
<div class="forge-install__body">
<div class="forge-install__pane is-active" data-pane="releases">
<div class="forge-install__hint"># 1 — grab a pre-built binary</div>
<div class="forge-install__cmd"><span class="prompt">$</span> open https://github.com/GaijinEntertainment/daScript/releases</div>
<div class="forge-install__cmd"><span class="prompt">$</span> open <a class="forge-link-amber" href="https://github.com/GaijinEntertainment/daScript/releases">https://github.com/GaijinEntertainment/daScript/releases</a></div>
<div class="forge-install__hint"># pick the archive for your platform, unzip, add to PATH</div>
<div class="forge-install__sp"></div>
<div class="forge-install__hint"># 2 — verify it runs</div>
<div class="forge-install__cmd"><span class="prompt">$</span> daslang --version</div>
<div class="forge-install__cmd"><span class="prompt">$</span> daslang run hello.das</div>
<div class="forge-install__cmd"><span class="prompt">$</span> daslang hello.das</div>
<div class="forge-install__sp"></div>
<div class="forge-install__hint"># 3 — (optional) AOT to C++ for native speed</div>
<div class="forge-install__cmd"><span class="prompt">$</span> daslang -aot main.das main_aot.cpp</div>
<div class="forge-install__hint"># 3 — (optional) JIT to native via LLVM for max speed</div>
<div class="forge-install__cmd"><span class="prompt">$</span> daslang -jit hello.das</div>
</div>
<div class="forge-install__pane" data-pane="source">
<div class="forge-install__hint"># requires CMake ≥ 3.15 and a C++17 compiler</div>
<div class="forge-install__cmd"><span class="prompt">$</span> git clone https://github.com/GaijinEntertainment/daScript.git daslang</div>
<div class="forge-install__cmd"><span class="prompt">$</span> cd daslang &amp;&amp; git submodule update --init --recursive</div>
<div class="forge-install__sp"></div>
<div class="forge-install__cmd"><span class="prompt">$</span> cmake -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo</div>
<div class="forge-install__cmd"><span class="prompt">$</span> cmake --build build --target daslang --config RelWithDebInfo</div>
<div class="forge-install__cmd"><span class="prompt">$</span> cmake -B build -S . -DCMAKE_BUILD_TYPE=Release</div>
<div class="forge-install__cmd"><span class="prompt">$</span> cmake --build build --config Release -j 8</div>
<div class="forge-install__sp"></div>
<div class="forge-install__hint"># the binary lands in ./bin/daslang</div>
<div class="forge-install__cmd"><span class="prompt">$</span> ./bin/daslang run hello.das</div>
<div class="forge-install__hint"># the binary lands in ./build/daslang</div>
<div class="forge-install__cmd"><span class="prompt">$</span> ./build/daslang hello.das</div>
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions site/playground/playground-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ if (document.readyState === 'loading') {
} else {
applySharedCodeFromHash();
}

// Run (in main.js) pushes a new history entry on each invocation; popstate
// fires when the user navigates Back/Forward and replays the recorded state.
window.addEventListener('popstate', applySharedCodeFromHash);
2 changes: 1 addition & 1 deletion src/ast/ast_infer_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4044,7 +4044,7 @@ namespace das {
if (ita.expr->alias == expr->name) {
reportAstChanged();
auto csub = ita.expr->subexpr->clone();
// forceAt(csub, ita.expr->at);
forceAt(csub, expr->at);
return csub;
}
}
Expand Down
Loading
Loading