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
64 changes: 64 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Linux Build

# Validation build for the Linux artifacts. Runs on demand and on PRs that
# touch the build, so the cross-platform compile and packaging are exercised
# without cutting a release. Artifacts are uploaded to the run for download.
on:
workflow_dispatch: {}
pull_request:
paths:
- "crates/**"
- "Cargo.toml"
- "Cargo.lock"
- "assets/prompt.desktop"
- "scripts/linux.sh"
- ".github/workflows/linux.yml"

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-22.04
- arch: aarch64
runner: ubuntu-22.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v5

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
clang \
curl \
file \
desktop-file-utils \
libasound2-dev \
libfontconfig-dev \
libssl-dev \
libvulkan1 \
libwayland-dev \
libx11-xcb-dev \
libxkbcommon-x11-dev

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo
uses: Swatinem/rust-cache@v2

- name: Install cargo-deb
run: cargo install cargo-deb --locked

- name: Build + package
run: scripts/linux.sh ${{ matrix.arch }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: prompt-linux-${{ matrix.arch }}
path: dist/linux/*
if-no-files-found: error
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,56 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}

build-linux:
needs: [check-version, create-release]
if: needs.check-version.outputs.changed == 'true'
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-22.04
- arch: aarch64
runner: ubuntu-22.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v5
with:
ref: "v${{ needs.check-version.outputs.version }}"

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
clang \
curl \
file \
desktop-file-utils \
libasound2-dev \
libfontconfig-dev \
libssl-dev \
libvulkan1 \
libwayland-dev \
libx11-xcb-dev \
libxkbcommon-x11-dev

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo
uses: Swatinem/rust-cache@v2

- name: Install cargo-deb
run: cargo install cargo-deb --locked

- name: Build + package
run: scripts/linux.sh ${{ matrix.arch }}

- name: Upload to release
run: gh release upload "v${{ needs.check-version.outputs.version }}" dist/linux/*.tar.gz dist/linux/*.deb dist/linux/*.AppImage --clobber
env:
GH_TOKEN: ${{ github.token }}

update-homebrew:
runs-on: ubuntu-latest
needs: [check-version, build]
Expand Down
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async-task = { git = "https://github.com/smol-rs/async-task.git", rev = "b4486cd
block = { path = "thirdparty/block" }

[workspace.package]
version = "0.2.2"
version = "0.3.0"
edition = "2021"
license = "Apache-2.0"

Expand Down
Binary file added assets/icon512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions assets/prompt.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=Prompt
GenericName=Terminal Emulator
Comment=A fast, modern terminal that gets out of your way
Exec=prompt
Icon=prompt
Terminal=false
Categories=System;TerminalEmulator;Utility;
Keywords=terminal;shell;command;console;
StartupWMClass=prompt
21 changes: 21 additions & 0 deletions crates/app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
[package]
autotests = false
name = "app"
version.workspace = true
edition.workspace = true
license.workspace = true
description = "A fast, modern terminal that gets out of your way"

[[bin]]
name = "prompt"
path = "src/main.rs"

# Linux .deb packaging (see scripts/linux.sh). The `prompt` binary is added
# automatically; here we add the desktop entry and icon. Paths are relative to
# this crate directory.
[package.metadata.deb]
name = "prompt"
maintainer = "Wess Cope <me@wess.io>"
license-file = ["../../LICENSE", "0"]
section = "utils"
priority = "optional"
extended-description = "Prompt is a GPU-accelerated terminal emulator with tabs, recursive splits, live-reload config, and built-in themes."
# An explicit assets list disables cargo-deb's automatic binary inclusion, so
# the binary is listed here too. cargo-deb remaps the `target/release/` prefix
# to the actual --target/profile path.
assets = [
["target/release/prompt", "usr/bin/prompt", "755"],
["../../assets/prompt.desktop", "usr/share/applications/prompt.desktop", "644"],
["../../assets/icon512.png", "usr/share/pixmaps/prompt.png", "644"],
]

[dependencies]
assist = { path = "../assist" }
config = { path = "../config" }
Expand Down
93 changes: 2 additions & 91 deletions crates/app/src/boxdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,94 +104,5 @@ fn blocks(ch: char, w: f32, h: f32) -> Option<BoxGlyph> {
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn horizontal_line_is_a_centred_bar() {
let g = rects('\u{2500}', 8.0, 16.0).unwrap();
let t = thickness(16.0);
assert_eq!(g.rects, vec![(0.0, ((16.0 - t) / 2.0).round(), 8.0, t)]);
assert_eq!(g.alpha, 1.0);
}

#[test]
fn cross_has_both_bars() {
let g = rects('\u{253C}', 8.0, 16.0).unwrap();
assert_eq!(g.rects.len(), 2); // h_full + v_full
}

#[test]
fn corner_joins_two_arms() {
// ┌ spans right and down from centre.
let g = rects('\u{250C}', 10.0, 16.0).unwrap();
assert_eq!(g.rects.len(), 2);
}

#[test]
fn full_block_fills_cell() {
let g = rects('\u{2588}', 8.0, 16.0).unwrap();
assert_eq!(g.rects, vec![(0.0, 0.0, 8.0, 16.0)]);
}

#[test]
fn halves_cover_their_side() {
assert_eq!(
rects('\u{2580}', 8.0, 16.0).unwrap().rects,
vec![(0.0, 0.0, 8.0, 8.0)]
);
assert_eq!(
rects('\u{2584}', 8.0, 16.0).unwrap().rects,
vec![(0.0, 8.0, 8.0, 8.0)]
);
assert_eq!(
rects('\u{258C}', 8.0, 16.0).unwrap().rects,
vec![(0.0, 0.0, 4.0, 16.0)]
);
assert_eq!(
rects('\u{2590}', 8.0, 16.0).unwrap().rects,
vec![(4.0, 0.0, 4.0, 16.0)]
);
}

#[test]
fn shades_use_alpha() {
assert_eq!(rects('\u{2591}', 8.0, 16.0).unwrap().alpha, 0.25);
assert_eq!(rects('\u{2592}', 8.0, 16.0).unwrap().alpha, 0.5);
assert_eq!(rects('\u{2593}', 8.0, 16.0).unwrap().alpha, 0.75);
}

#[test]
fn lower_eighths_grow_from_bottom() {
// ▁ = 1/8 tall at the bottom.
assert_eq!(
rects('\u{2581}', 8.0, 16.0).unwrap().rects,
vec![(0.0, 14.0, 8.0, 2.0)]
);
// ▇ = 7/8 tall.
assert_eq!(
rects('\u{2587}', 8.0, 16.0).unwrap().rects,
vec![(0.0, 2.0, 8.0, 14.0)]
);
}

#[test]
fn left_eighths_grow_from_left() {
// ▏ = 1/8 wide on the left.
assert_eq!(
rects('\u{258F}', 8.0, 16.0).unwrap().rects,
vec![(0.0, 0.0, 1.0, 16.0)]
);
// ▉ = 7/8 wide.
assert_eq!(
rects('\u{2589}', 8.0, 16.0).unwrap().rects,
vec![(0.0, 0.0, 7.0, 16.0)]
);
}

#[test]
fn ordinary_characters_are_not_handled() {
assert!(rects('a', 8.0, 16.0).is_none());
assert!(rects('═', 8.0, 16.0).is_none()); // heavy/double not yet covered
}
}
#[path = "../tests/boxdraw.rs"]
mod tests;
Loading
Loading