diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89a8ee6..829e480 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,8 @@ -# Runs on the org's self-hosted home runners (shared with other -# repositories: one VM, one Docker daemon). Their host has no Rust and no -# sudo, so the job runs in a container where it is root and can -# apt-install what it needs. The runner runs as uid 1001 and cleans the -# workspace and its temp directory before the next job; it can't remove -# what root left there, so the job ends by handing both back. +# Runs on GitHub's hosted runners, as Gannet's CI does: the repo is open source, +# and the org's self-hosted home runners take private repos only (a public +# repo's pull requests would otherwise run outside code on them). The job +# runs in an Ubuntu container where it is root and can apt-install what it +# needs. # # No test opens a window. name: CI @@ -19,7 +18,7 @@ concurrency: group: ci-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} -# The job runs PR code as root on shared runners: its token reads only. +# The job runs pull request code: its token reads only. permissions: contents: read @@ -31,7 +30,7 @@ env: jobs: check: name: fmt, clippy, tests, release build - runs-on: [self-hosted, home] + runs-on: ubuntu-24.04 container: ubuntu:24.04 timeout-minutes: 30 steps: @@ -44,11 +43,10 @@ jobs: apt-get install -y -qq --no-install-recommends \ git ca-certificates curl build-essential pkg-config \ libxkbcommon-dev python3 >/dev/null + # Fork code runs after this, so the token isn't left in git's config. - uses: actions/checkout@v4 - # A clean Rust each time: an earlier job's half-installed rustup in - # the shared $HOME breaks the install. - - name: Start from a clean home - run: rm -rf "$HOME/.cargo" "$HOME/.rustup" + with: + persist-credentials: false - uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy @@ -70,7 +68,12 @@ jobs: # The renderer's frame budget: only meaningful optimised, so it's # ignored in the debug test run. - name: Performance budgets - run: cargo test --release --locked -- --ignored budget_ --test-threads=1 + # The 1 ms frame budget is for an aliasOS desktop. Hosted runners are + # about twice as slow (1.06 ms where the desktop takes 0.53 ms), so + # here it only guards against a renderer that got much slower. + env: + ALIAS_CALC_FRAME_BUDGET_US: "3000" + run: cargo test --release --locked -- --ignored budget_ --test-threads=1 --nocapture - name: Scripts parse run: | python3 -m py_compile bench/calcbench.py @@ -90,6 +93,3 @@ jobs: PREFIX=/usr DESTDIR="$stage" ./install.sh uninstall test "$(find "$stage" -type f | wc -l)" -eq 0 rm -rf "$stage" - - name: Hand the workspace back to the runner user - if: always() - run: chown -R 1001:1001 "$GITHUB_WORKSPACE" "$RUNNER_TEMP" diff --git a/Cargo.lock b/Cargo.lock index 5e7f048..216174a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,7 +55,7 @@ dependencies = [ [[package]] name = "alias-calc" -version = "0.1.1" +version = "0.1.2" dependencies = [ "fontdue", "rust_decimal", diff --git a/Cargo.toml b/Cargo.toml index 596e76b..54e5e29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "alias-calc" -version = "0.1.1" +version = "0.1.2" edition = "2024" -license = "LicenseRef-Proprietary" +license = "MIT" description = "A tiny, instant calculator for aliasOS" publish = false diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..79569e9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Alias Project, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 4351c23..4d83bed 100644 --- a/README.md +++ b/README.md @@ -68,3 +68,7 @@ Hyprland pings every window every 1.5 s to check that it still responds (`xdg_wm [trace] 0.369 ms configured [trace] 0.608 ms frame committed (320x480 px) ``` + +## Licence + +MIT (`LICENSE`). The JetBrains Mono subsets compiled into the binary are under the SIL Open Font License 1.1 (`fonts/OFL.txt`). diff --git a/a11y/Cargo.toml b/a11y/Cargo.toml index 1ea4a2b..8a649d7 100644 --- a/a11y/Cargo.toml +++ b/a11y/Cargo.toml @@ -2,7 +2,7 @@ name = "alias-calc-a11y" version = "0.1.0" edition = "2024" -license = "LicenseRef-Proprietary" +license = "MIT" description = "Alias Calc's screen reader bridge, loaded only when one is running" publish = false diff --git a/src/ui.rs b/src/ui.rs index 076503f..fffae06 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1034,20 +1034,37 @@ mod tests { (320.0, 480.0), 2.0, ); - let runs = 200; - let start = Instant::now(); - for _ in 0..runs { - draw( - &mut Canvas::new(&mut bytes, w, h), - &mut fonts, - &palette, - &view, - (320.0, 480.0), - 2.0, - ); - } - let per_frame = start.elapsed() / runs; - println!("full frame at 640x960: {per_frame:?}"); - assert!(per_frame.as_micros() < 1000, "{per_frame:?}"); + // The best of several batches: a shared CI runner's neighbours can + // stall one batch, but they don't make the renderer slower. + let (batches, runs) = (10, 40); + let per_frame = (0..batches) + .map(|_| { + let start = Instant::now(); + for _ in 0..runs { + draw( + &mut Canvas::new(&mut bytes, w, h), + &mut fonts, + &palette, + &view, + (320.0, 480.0), + 2.0, + ); + } + start.elapsed() / runs + }) + .min() + .unwrap(); + println!("full frame at 640x960: {per_frame:?} (best of {batches} batches of {runs})"); + // 1 ms is the budget on an aliasOS desktop. A slower machine (CI's + // shared runners are about twice as slow) sets its own limit, which + // still catches a renderer that has got several times slower. + let limit_us = std::env::var("ALIAS_CALC_FRAME_BUDGET_US") + .ok() + .and_then(|v| v.parse::().ok()) + .unwrap_or(1000); + assert!( + per_frame.as_micros() < limit_us, + "{per_frame:?} (limit {limit_us} µs)" + ); } }