Skip to content

Commit 107142d

Browse files
committed
⚡ improve bench workflow
1 parent 869416b commit 107142d

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

.github/workflows/bench.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,19 @@ jobs:
2020
with:
2121
fetch-depth: 1
2222

23+
- name: Install just
24+
uses: extractions/setup-just@v1
25+
with:
26+
just-version: "1.39"
27+
2328
- name: Install Rust toolchain
24-
uses: dtolnay/rust-toolchain@stable
29+
uses: actions-rs/toolchain@v1
2530
with:
31+
profile: minimal
32+
toolchain: stable
33+
override: true
2634
components: rustfmt, clippy
35+
targets: wasm32-unknown-unknown
2736

2837
- name: Setup rust cache
2938
uses: Swatinem/rust-cache@v2
@@ -35,19 +44,22 @@ jobs:
3544
target
3645
3746
- name: Check formatting
38-
run: cargo fmt --all -- --check
47+
run: just fmt
3948

40-
- name: Run clippy
41-
run: cargo clippy --all-targets --all-features -- -D warnings
49+
- name: Run lints
50+
run: just lint
4251

4352
- name: Run tests
44-
run: cargo test --all-features
53+
run: just test
4554

4655
- name: Run benchmarks
47-
run: cargo bench
56+
run: just bench
4857
env:
4958
CARGO_TERM_COLOR: always
5059

60+
- name: Check dependencies
61+
run: just deny
62+
5163
- name: Upload benchmark results
5264
uses: actions/upload-artifact@v4
5365
with:
@@ -71,15 +83,19 @@ jobs:
7183
tool: "criterion"
7284
output-file-path: target/criterion/**/new/*.json
7385
alert-threshold: "150%"
86+
github-token: ${{ secrets.GITHUB_TOKEN }}
7487

7588
- name: Check benchmark results
7689
if: github.event_name == 'pull_request'
7790
run: |
7891
if [ -f prev-benchmark/bench_result.json ]; then
79-
# Add custom benchmark comparison logic here
8092
echo "Comparing benchmark results..."
8193
fi
8294
95+
- name: Build documentation
96+
run: just docs
97+
8398
env:
8499
CARGO_TERM_COLOR: always
85100
RUST_BACKTRACE: 1
101+
RUSTFLAGS: "-D warnings"

src/plugins/c.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ macro_rules! export_c_plugin {
150150
pub unsafe extern "C" fn lenna_plugin_process_base64(
151151
b64img: *const std::os::raw::c_char,
152152
) -> *const std::os::raw::c_char {
153+
use base64::engine::general_purpose::STANDARD;
154+
use base64::Engine;
155+
153156
let mut processor = $processor::default();
154157
let config: $crate::core::config::ProcessorConfig =
155158
$crate::core::config::ProcessorConfig {
@@ -158,7 +161,7 @@ macro_rules! export_c_plugin {
158161
};
159162

160163
let data = std::ffi::CStr::from_ptr(b64img).to_str().unwrap();
161-
let buffer: Vec<u8> = base64::decode(data).unwrap();
164+
let buffer: Vec<u8> = STANDARD.decode(data).unwrap();
162165
let img = $crate::io::read::read_from_data(buffer).unwrap();
163166

164167
let mut lenna_img = Box::new(img);
@@ -169,7 +172,7 @@ macro_rules! export_c_plugin {
169172
$crate::io::write::write_to_data(&lenna_img, image::ImageOutputFormat::Png)
170173
.unwrap();
171174

172-
let b64img = base64::encode(out_data);
175+
let b64img = STANDARD.encode(out_data);
173176

174177
std::ffi::CString::new(b64img).unwrap().into_raw()
175178
}

0 commit comments

Comments
 (0)