generated from GarandPLG/rust-flake-template
Add Linux packaging workflow and related scripts
Introduce a new CI workflow `.gitea/workflows/packages.yml` that builds deb, rpm, AppImage, Flatpak and AUR packages on push and PR events. Add packaging helpers (`build.sh`, `stage.sh`, spec file, PKGBUILD, desktop entry, SVG icon) and supporting assets under `packaging/`. Update `.gitignore` to ignore the generated `dist` directory. Expand documentation (CODE_MAP, AGENTS, PROGRESS, TESTING and new PACKAGING.md) to describe the packaging process and its limitations. Adjust `src/app/threads/audio.rs` and `tests/audio.rs` imports to support loading audio files from installed package layouts.
This commit is contained in:
1 parent
8ee037ccef
commit
c3dbfe435a
15 files changed
+399
-12
No files matched your search
+47
-1
@@ -1,7 +1,9 @@
|
||||
use rodio::Decoder;
|
||||
use std::{
|
||||
fs::read,
|
||||
fs::{self, read},
|
||||
io::{BufReader, Cursor},
|
||||
path::PathBuf,
|
||||
process::{Command, Output},
|
||||
};
|
||||
use war_in_tunnels::app::threads::{SoundrackParts, Soundtrack, load_audio};
|
||||
|
||||
@@ -17,3 +19,47 @@ fn audio_repeats_after_end_of_file() {
|
||||
assert_eq!(source.by_ref().take(sample_count).count(), sample_count);
|
||||
assert_eq!(source.take(1024).count(), 1024);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn packaged_audio_loads_without_project_working_directory() -> () {
|
||||
if std::env::var_os("WAR_IN_TUNNELS_PACKAGED_AUDIO_TEST").is_some() {
|
||||
let mut source: rodio::source::Amplify<
|
||||
rodio::decoder::LoopedDecoder<BufReader<Cursor<Vec<u8>>>>,
|
||||
> = load_audio(&Soundtrack::Default, &SoundrackParts::Calm);
|
||||
assert_eq!(source.by_ref().take(1024).count(), 1024);
|
||||
return;
|
||||
}
|
||||
|
||||
let directory: PathBuf = std::env::temp_dir().join(format!(
|
||||
"war-in-tunnels-packaged-audio-{}",
|
||||
std::process::id()
|
||||
));
|
||||
fs::create_dir_all(directory.join("soundtracks/default")).unwrap();
|
||||
fs::create_dir_all(directory.join("working-directory")).unwrap();
|
||||
let executable: PathBuf = directory.join("audio-test");
|
||||
fs::copy(std::env::current_exe().unwrap(), &executable).unwrap();
|
||||
for filename in ["calm.ogg", "test.ogg"] {
|
||||
fs::copy(
|
||||
PathBuf::from("soundtracks/default").join(filename),
|
||||
directory.join("soundtracks/default").join(filename),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
let output: Output = Command::new(executable)
|
||||
.args([
|
||||
"--exact",
|
||||
"packaged_audio_loads_without_project_working_directory",
|
||||
"--nocapture",
|
||||
])
|
||||
.env("WAR_IN_TUNNELS_PACKAGED_AUDIO_TEST", "1")
|
||||
.current_dir(directory.join("working-directory"))
|
||||
.output()
|
||||
.unwrap();
|
||||
fs::remove_dir_all(directory).unwrap();
|
||||
assert!(
|
||||
output.status.success(),
|
||||
"{}{}",
|
||||
String::from_utf8_lossy(&output.stdout),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user