Skip to content

Commit 92554ff

Browse files
committed
Cleanups while preparing for 0.1.0 release.
1 parent 3fe64de commit 92554ff

File tree

5 files changed

+44
-20
lines changed

5 files changed

+44
-20
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
echo "version is: ${{ env.FL_VERSION }}"
2020
- name: Create GitHub release
2121
id: release
22-
uses: actions/create-release@v1
22+
uses: actions/create-release@v1.1.4
2323
env:
2424
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2525
with:
@@ -54,12 +54,12 @@ jobs:
5454

5555
steps:
5656
- name: Checkout repository
57-
uses: actions/checkout@v2
57+
uses: actions/checkout@v3
5858
with:
5959
fetch-depth: 1
6060

6161
- name: Install Rust
62-
uses: dtolnay/rust-toolchain@v1
62+
uses: dtolnay/rust-toolchain@master
6363
with:
6464
toolchain: ${{ matrix.rust }}
6565
target: ${{ matrix.target }}
@@ -99,10 +99,14 @@ jobs:
9999
run: |
100100
outdir="$(ci/cargo-out-dir "${{ env.TARGET_DIR }}")"
101101
staging="findlargedir-${{ needs.create-release.outputs.fl_version }}-${{ matrix.target }}"
102-
cp {README.md,LICENSE} "$staging/"
102+
mkdir -p "$staging"
103+
cp {README.md,LICENSE} "$staging"
104+
cp "target/${{ matrix.target }}/release/findlargedir" "$staging"
105+
tar -cJf "$staging.tar.xz" "$staging"
106+
echo "ASSET=$staging.tar.xz" >> $GITHUB_ENV
103107
104108
- name: Upload release archive
105-
uses: actions/[email protected].1
109+
uses: actions/[email protected].2
106110
env:
107111
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108112
with:

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
findlargedir
2-
===
1+
# findlargedir
32

43
[![GitHub license](https://img.shields.io/github/license/dkorunic/findlargedir.svg)](https://github.com/dkorunic/findlargedir/blob/master/LICENSE.txt)
54
[![GitHub release](https://img.shields.io/github/release/dkorunic/findlargedir.svg)](https://github.com/dkorunic/findlargedir/releases/latest)
@@ -12,9 +11,8 @@ Program will **not follow symlinks** and **requires r/w permissions** to be able
1211

1312
## Caveats
1413

15-
* requires r/w privileges for an each filesystem being tested, it will also create a temporary directory with a lot of temporary files which are cleaned up afterwards
16-
* accurate mode (`-a`) can cause an excessive I/O and an excessive memory use; only use when appropriate
17-
14+
- requires r/w privileges for an each filesystem being tested, it will also create a temporary directory with a lot of temporary files which are cleaned up afterwards
15+
- accurate mode (`-a`) can cause an excessive I/O and an excessive memory use; only use when appropriate
1816

1917
## Usage
2018

@@ -37,4 +35,5 @@ OPTIONS:
3735

3836
When using **accurate mode** (`-a` parameter) beware that large directory lookups will stall the process completely for extended periods of time. What this mode does is basically a secondary fully accurate pass on a possibly offending directory calculating exact number of entries.
3937

40-
If you want to avoid descending into mounted filesystems (as in find -xdev option), use **onefilesystem mode** with `-o` parameter and this toggled by default.
38+
If you want to avoid descending into mounted filesystems (as in find -xdev option), use **onefilesystem mode** with `-o` parameter and this toggled by default.
39+

ci/cargo-out-dir

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Finds Cargo's `OUT_DIR` directory from the most recent build.
4+
#
5+
# This requires one parameter corresponding to the target directory
6+
# to search for the build output.
7+
8+
if [ $# != 1 ]; then
9+
echo "Usage: $(basename "$0") <target-dir>" >&2
10+
exit 2
11+
fi
12+
13+
# This works by finding the most recent stamp file, which is produced by
14+
# every ripgrep build.
15+
target_dir="$1"
16+
find "$target_dir" -type f -name findlargedir -print0 \
17+
| xargs -0 ls -t \
18+
| head -n1 \
19+
| xargs dirname

src/calibrate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::process;
99
use std::sync::atomic::{AtomicBool, Ordering};
1010
use std::sync::Arc;
1111

12-
pub const DEFAULT_TEST_COUNT: u64 = 10000;
12+
pub const DEFAULT_TEST_COUNT: u64 = 100_000;
1313
const ERROR_EXIT: i32 = 1;
1414

1515
pub fn get_inode_ratio(

src/main.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ static GLOBAL: Jemalloc = Jemalloc;
1818
#[derive(Parser, Debug)]
1919
#[clap(author, version, about, long_about = None)]
2020
struct Args {
21-
#[clap(short, long, default_value_t = calibrate::DEFAULT_TEST_COUNT)]
22-
calibration_count: u64,
23-
24-
#[clap(short, long, default_value_t = false)]
21+
#[clap(short, long, action = clap::ArgAction::Set, default_value_t = false)]
2522
accurate: bool,
2623

27-
#[clap(short, long, default_value_t = true)]
24+
#[clap(short, long, action = clap::ArgAction::Set, default_value_t = true)]
2825
one_filesystem: bool,
2926

30-
#[clap(short = 'A', long, default_value_t = walk::ALERT_COUNT)]
27+
#[clap(short, long, value_parser, default_value_t = calibrate::DEFAULT_TEST_COUNT)]
28+
calibration_count: u64,
29+
30+
#[clap(short = 'A', long, value_parser, default_value_t = walk::ALERT_COUNT)]
3131
alert_threshold: u64,
3232

33-
#[clap(short = 'B', long, default_value_t = walk::BLACKLIST_COUNT)]
33+
#[clap(short = 'B', long, value_parser, default_value_t = walk::BLACKLIST_COUNT)]
3434
blacklist_threshold: u64,
3535

36-
#[clap(required = true, allow_hyphen_values = true)]
36+
#[clap(required = true, value_parser)]
3737
path: Vec<String>,
3838
}
3939

@@ -62,6 +62,8 @@ fn main() -> Result<(), Error> {
6262
let size_inode_ratio =
6363
calibrate::get_inode_ratio(tmp_dir.path(), &shutdown_calibrate, args.calibration_count)
6464
.context("Unable to calibrate inode to size ratio")?;
65+
66+
println!("Please wait a few seconds while removing calibration test directory...");
6567
drop(tmp_dir);
6668

6769
println!("Scanning filesystem path {} started", &path);

0 commit comments

Comments
 (0)