Skip to content

Commit 3b0f703

Browse files
committed
ci: add build-rust job (plus build fixes)
* fix trivial rustfmt comment complaint * fix typo in c-API function name
1 parent 9e03476 commit 3b0f703

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,36 @@ jobs:
117117
name: android-artifacts
118118
path: "wrappers/android/zxingcpp/build/outputs/aar/zxingcpp-debug.aar"
119119

120+
build-rust:
121+
runs-on: ${{ matrix.os }}
122+
strategy:
123+
matrix:
124+
os: [ubuntu-latest, macos-latest, windows-latest]
125+
126+
steps:
127+
- uses: actions/checkout@v3
128+
129+
- name: Setup Rust
130+
run: |
131+
rustup update
132+
rustup component add clippy
133+
rustup component add rustfmt
134+
135+
- name: Lint
136+
working-directory: wrappers/rust
137+
run: |
138+
cargo fmt --check
139+
cargo clippy -- -Dwarnings
140+
141+
- name: Build
142+
working-directory: wrappers/rust
143+
run: cargo build --release --verbose --features bundled,image --examples
144+
145+
- name: Package
146+
working-directory: wrappers/rust
147+
# --allow-dirty is required on the windows build (but not the ubuntu build?!)
148+
run: cargo package --verbose --allow-dirty --features bundled,image
149+
120150
build-wasm:
121151
runs-on: ubuntu-latest
122152
steps:

core/src/zxing-c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void zxing_ReaderOptions_setFormats(zxing_ReaderOptions* opts, zxing_BarcodeForm
136136
opts->setFormats(static_cast<BarcodeFormat>(formats));
137137
}
138138

139-
zxing_BarcodeFormats zxing_ReaderOptions_formats(const zxing_ReaderOptions* opts)
139+
zxing_BarcodeFormats zxing_ReaderOptions_getFormats(const zxing_ReaderOptions* opts)
140140
{
141141
auto v = opts->formats();
142142
return *reinterpret_cast<zxing_BarcodeFormats*>(&v);

wrappers/rust/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn main() -> miette::Result<()> {
2525
println!("cargo:rustc-link-search=native={}", lib_dir);
2626
println!("cargo:rustc-link-lib=dylib=ZXing");
2727
} else {
28-
// panic!("ZXing library not found. Use feature 'bundled' or set environment variabale ZXING_CPP_LIB_DIR.")
28+
// panic!("ZXing library not found. Use feature 'bundled' or set environment variabale ZXING_CPP_LIB_DIR.")
2929
}
3030

3131
// manual bindings.rs generation:

0 commit comments

Comments
 (0)