Skip to content

Commit 2405615

Browse files
authored
add some build tooling and update float formatting (#3)
1 parent 66d24fc commit 2405615

File tree

6 files changed

+43
-2
lines changed

6 files changed

+43
-2
lines changed

.cargo/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.x86_64-unknown-linux-musl]
2+
linker = "x86_64-linux-musl-gcc"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
Dockerfile
33
nginx.conf
44
*.log
5+
*.tar.gz
56
/target

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "topngx"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Garrett Squire <github@garrettsquire.com>"]
55
edition = "2018"
66
description = "Top for NGINX"
@@ -19,6 +19,9 @@ rusqlite = "0.23"
1919
structopt = "0.3"
2020
tabwriter = "1.2"
2121

22+
[features]
23+
bundled-sqlite = ["rusqlite/bundled"]
24+
2225
[profile.release]
2326
lto = true
2427
codegen-units = 1

build_release

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
set -eux
4+
5+
# The semantic version is the first and only argument.
6+
VERSION="$1"
7+
8+
cargo build --release
9+
10+
# Cross compile for Linux via the MUSL toolchain.
11+
TARGET_CC=x86_64-linux-musl-gcc \
12+
cargo build \
13+
--release \
14+
--target x86_64-unknown-linux-musl \
15+
--features bundled-sqlite
16+
17+
# Build archives.
18+
shasum -a 256 target/release/topngx > target/release/SHA256
19+
shasum -a 256 target/x86_64-unknown-linux-musl/release/topngx \
20+
> target/x86_64-unknown-linux-musl/release/SHA256
21+
22+
tar -czf "topngx-$VERSION-x86_64-apple-darwin.tar.gz" \
23+
-C target/release \
24+
SHA256 topngx
25+
26+
tar -czf "topngx-$VERSION-x86_64-unknown-linux-musl.tar.gz" \
27+
-C target/x86_64-unknown-linux-musl/release \
28+
SHA256 topngx

src/processor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl Processor {
112112
match val {
113113
Value::Null => write!(&mut tw, "null\t")?,
114114
Value::Integer(i) => write!(&mut tw, "{}\t", i)?,
115-
Value::Real(r) => write!(&mut tw, "{}\t", r)?,
115+
Value::Real(r) => write!(&mut tw, "{:.2}\t", r)?,
116116
Value::Text(t) => write!(&mut tw, "{}\t", t)?,
117117
Value::Blob(b) => write!(&mut tw, "{}\t", String::from_utf8(b)?)?,
118118
}

0 commit comments

Comments
 (0)