Compare commits

..

5 commits

Author SHA1 Message Date
bfef9f3fd6 Merge pull request 'Fix rustfmt formatting in icon.rs' (#1) from fix/icon-rs-fmt into master
All checks were successful
CI / ci (push) Successful in 9m16s
2026-07-29 13:58:00 +00:00
Austin Schaefer
1cda8b6f50 Only trigger CI push runs on master to avoid duplicate builds
All checks were successful
CI / ci (pull_request) Successful in 10m41s
Pushing to a branch with an open PR fired both the push and
pull_request triggers for the same commit. pull_request already
covers feature-branch commits, so push only needs to cover master.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-29 12:29:11 +02:00
Austin Schaefer
4e65ef3843 Fix CI job: run on default node image instead of rust:latest
Some checks failed
CI / ci (push) Failing after 20m50s
CI / ci (pull_request) Failing after 1h20m38s
The rust:latest container has no Node.js, but actions/checkout@v4 and
actions/cache@v4 are JS actions that require it to execute at all,
so the job failed before any cargo/fmt steps ran. Use the default
docker runner image and install the Rust toolchain via rustup instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-29 12:25:09 +02:00
Austin Schaefer
d1fd272fbb Fix rustfmt formatting in icon.rs
Some checks failed
CI / ci (push) Failing after 42s
CI / ci (pull_request) Failing after 5s
Reorders imports and reflows a long binding so the new CI's
format-check job passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-29 12:12:57 +02:00
Austin Schaefer
4b751dc246 Add Forgejo Actions CI workflow
Runs cargo fmt/clippy/test/audit via the existing cargo-make ci task on every push and pull request.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-29 12:03:01 +02:00
2 changed files with 42 additions and 4 deletions

37
.forgejo/workflows/ci.yml Normal file
View file

@ -0,0 +1,37 @@
name: CI
on:
push:
branches: [master]
pull_request:
jobs:
ci:
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal --component clippy --component rustfmt
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Install cargo-make and cargo-audit
run: |
for crate in cargo-make cargo-audit; do
command -v "$crate" >/dev/null 2>&1 || cargo install "$crate"
done
- name: Run CI checks
run: cargo make ci

View file

@ -1,5 +1,6 @@
use freedesktop_icons::lookup; use freedesktop_icons::lookup;
use std::path::PathBuf; use std::path::PathBuf;
use std::{env, fs};
const ICON_SIZE: u16 = 32; const ICON_SIZE: u16 = 32;
@ -47,7 +48,7 @@ fn desktop_file_icon_name(desktop_entry: &str) -> Option<String> {
let path = dir let path = dir
.join("applications") .join("applications")
.join(format!("{desktop_entry}.desktop")); .join(format!("{desktop_entry}.desktop"));
if let Ok(contents) = std::fs::read_to_string(&path) if let Ok(contents) = fs::read_to_string(&path)
&& let Some(icon) = parse_icon_key(&contents) && let Some(icon) = parse_icon_key(&contents)
{ {
return Some(icon); return Some(icon);
@ -58,11 +59,11 @@ fn desktop_file_icon_name(desktop_entry: &str) -> Option<String> {
fn data_dirs() -> Vec<PathBuf> { fn data_dirs() -> Vec<PathBuf> {
let mut dirs = vec![]; let mut dirs = vec![];
if let Some(home) = std::env::var_os("HOME") { if let Some(home) = env::var_os("HOME") {
dirs.push(PathBuf::from(home).join(".local/share")); dirs.push(PathBuf::from(home).join(".local/share"));
} }
let xdg_data_dirs = std::env::var("XDG_DATA_DIRS") let xdg_data_dirs =
.unwrap_or_else(|_| "/usr/local/share:/usr/share".to_string()); env::var("XDG_DATA_DIRS").unwrap_or_else(|_| "/usr/local/share:/usr/share".to_string());
dirs.extend(xdg_data_dirs.split(':').map(PathBuf::from)); dirs.extend(xdg_data_dirs.split(':').map(PathBuf::from));
dirs dirs
} }