Skip to content

Commit 0b8b8d2

Browse files
committed
ci: add vcpkg.json
1 parent 3afb879 commit 0b8b8d2

File tree

16 files changed

+206
-27
lines changed

16 files changed

+206
-27
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.7z filter=lfs diff=lfs merge=lfs -text

.github/workflows/rust.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
pull_request:
7+
branches: ["master"]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
runs-on: windows-latest
15+
env:
16+
VCPKG_DEFAULT_TRIPLET: x64-windows-static-md
17+
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/third-party/vcpkg/installed
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
lfs: true
22+
submodules: recursive
23+
- name: Extract data
24+
run: 7z x deploy/ichiran-250113.7z
25+
- name: Setup vcpkg
26+
uses: lukka/run-vcpkg@v11
27+
with:
28+
vcpkgDirectory: "${{ github.workspace }}/third-party/vcpkg"
29+
runVcpkgInstall: true
30+
vcpkgJsonGlob: "**/vcpkg.json"
31+
- name: Build
32+
run: cargo build --verbose
33+
- name: Run tests
34+
run: cargo test --verbose
35+
- uses: actions/upload-artifact@v4
36+
with:
37+
name: niinii
38+
path: target/release/niinii*

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "third-party/imgui-win32-sys/imgui"]
2-
path = third-party/imgui-win32-sys/imgui
3-
url = https://github.com/ocornut/imgui.git
1+
[submodule "third-party/vcpkg"]
2+
path = third-party/vcpkg
3+
url = https://github.com/Microsoft/vcpkg

Cargo.lock

Lines changed: 126 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@ imgui-winit-glow-renderer-viewports = { git = "https://github.com/Netdex/imgui-r
1414
# hudhook = { git = "https://github.com/veeenu/hudhook.git" }
1515

1616
[workspace]
17-
members = [
18-
"niinii",
19-
"ichiran",
20-
"openai-chat",
21-
"third-party/eventsource-stream",
22-
"third-party/imgui-dx11-renderer",
23-
"third-party/vvcore",
24-
]
17+
members = ["niinii", "ichiran", "openai-chat"]
18+
exclude = ["third-party"]
2519
resolver = "2"
2620

2721
# flate2 is slow in debug mode
@@ -30,4 +24,4 @@ opt-level = 3
3024
[profile.dev.package.miniz_oxide]
3125
opt-level = 3
3226
[profile.dev.package.adler2]
33-
opt-level = 3
27+
opt-level = 3

deploy/ichiran-250113.7z

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:7484b50a0d2412394d5a807c4d43cf2c4042dc814a9f59192106a452caf530be
3+
size 422191899

ichiran/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ winapi = { version = "0.3", features = [
3838
"winuser",
3939
"jobapi2",
4040
] }
41+
win32job = "2.0.3"
4142

4243
[dev-dependencies]
4344
tokio = { version = "1", features = ["rt", "macros"] }

ichiran/src/pgdaemon.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::{
44
};
55

66
use tokio::process::{Child, Command};
7+
use win32job::{Job, JobError};
78

89
use crate::ConnParams;
910

@@ -12,6 +13,7 @@ pub struct PostgresDaemon {
1213
data_path: PathBuf,
1314
pg_proc: Result<Child, std::io::Error>,
1415
silent: bool,
16+
_job_obj: Job,
1517
}
1618
impl PostgresDaemon {
1719
pub fn new(
@@ -23,6 +25,8 @@ impl PostgresDaemon {
2325
let pg_bin_dir = pg_bin_dir.into();
2426
let data_path = data_path.into();
2527

28+
let job = Self::create_job_object().expect("failed to create job object");
29+
2630
tracing::info!(?pg_bin_dir, ?data_path, "starting");
2731
let postgres_bin_path = Self::pg_bin_path(&pg_bin_dir, "postgres");
2832

@@ -51,13 +55,22 @@ impl PostgresDaemon {
5155
data_path,
5256
pg_proc: proc,
5357
silent,
58+
_job_obj: job,
5459
}
5560
}
5661
fn pg_bin_path(pg_bin_dir: impl AsRef<Path>, name: impl Into<PathBuf>) -> PathBuf {
5762
let mut bin = name.into();
5863
bin.set_extension(std::env::consts::EXE_EXTENSION);
5964
pg_bin_dir.as_ref().join(bin)
6065
}
66+
fn create_job_object() -> Result<Job, JobError> {
67+
let job = Job::create()?;
68+
let mut info = job.query_extended_limit_info()?;
69+
info.limit_kill_on_job_close();
70+
job.set_extended_limit_info(&info)?;
71+
job.assign_current_process()?;
72+
Ok(job)
73+
}
6174
}
6275
impl Drop for PostgresDaemon {
6376
fn drop(&mut self) {

ichiran/src/protocol/kanji.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ mod tests {
140140
use crate::tests::fixture;
141141

142142
#[tokio::test]
143+
#[ignore]
143144
async fn test_match() {
144145
let ichiran = fixture::ichiran().await;
145146

ichiran/src/protocol/romanize.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ mod tests {
396396
}
397397

398398
#[tokio::test]
399+
#[ignore]
399400
async fn test_match() {
400401
let ichiran = fixture::ichiran().await;
401402
let nikaime = ichiran.romanize("2回目", 1).await.unwrap();
@@ -431,6 +432,7 @@ mod tests {
431432
}
432433

433434
#[tokio::test]
435+
#[ignore]
434436
async fn test_romanize() {
435437
let ichiran = fixture::ichiran().await;
436438
let _furaseteiru = ichiran.romanize("降らせている", 1).await.unwrap();

0 commit comments

Comments
 (0)