From ad37e1eb66f555998e13868b2f20b28f49bf80ce Mon Sep 17 00:00:00 2001 From: Paul Delafosse Date: Fri, 27 Oct 2023 17:20:20 +0200 Subject: [PATCH] ci: add build jop --- .github/workflows/ci.yaml | 41 ++++++++++++++++++++++++++++++++++- crates/libs/tagger/src/lib.rs | 36 +++++++++++------------------- 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a18b4309..564c8485 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,7 +51,7 @@ jobs: MIMIR__ELASTICSEARCH__URL: 'http://es1:9200' with: command: llvm-cov - args: --workspace --lcov --output-path lcov.info -- --nocapture + args: --workspace --lcov --output-path lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 @@ -96,3 +96,42 @@ jobs: command: clippy args: -- -D warnings + build: + name: Build + needs: [lints, test] + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + + - name: Get lib postal + run: | + apt-get update && apt-get install -y \ + autoconf automake build-essential curl git libsnappy-dev libtool pkg-config llvm-dev libclang-dev clang + git clone https://github.com/openvenues/libpostal + cd /libpostal + + - name: Install libpostal + run: | + ./bootstrap.sh + mkdir -p /opt/libpostal_data + ./configure --datadir=/opt/libpostal_data + make -j4 + make install + ldconfig + pkg-config --cflags libpostal + + - name: Run cargo build + uses: actions-rs/cargo@v1 + continue-on-error: false + with: + command: build + args: --all-features --release diff --git a/crates/libs/tagger/src/lib.rs b/crates/libs/tagger/src/lib.rs index 14236711..c176ffe7 100644 --- a/crates/libs/tagger/src/lib.rs +++ b/crates/libs/tagger/src/lib.rs @@ -1,25 +1,24 @@ -use crate::tokens::Tokenized; -use once_cell::sync::OnceCell; use std::path::PathBuf; -pub mod errors; -mod tagger; -mod tokens; - -#[cfg(feature = "postal")] -pub use crate::tagger::address::{AddressTag, ADDRESS_TAGGER}; -pub use crate::tokens::normalize_diacritics; +use once_cell::sync::OnceCell; -use crate::tagger::location::{ - CITY_DISTRICT_TAGGER, COUNTRY_TAGGER, DISTRICT_TAGGER, SUBURBS_TAGGER, -}; pub use crate::tagger::{ brand::BRAND_AUTOCOMPLETE_TAGGER, brand::BRAND_TAGGER, category::CATEGORY_AUTOCOMPLETE_TAGGER, category::CATEGORY_TAGGER, location::CITY_TAGGER, location::STATE_TAGGER, Tag, TaggedPart, Tagger, TaggerAutocomplete, }; - +#[cfg(feature = "postal")] +pub use crate::tagger::address::{ADDRESS_TAGGER, AddressTag}; +use crate::tagger::location::{ + CITY_DISTRICT_TAGGER, COUNTRY_TAGGER, DISTRICT_TAGGER, SUBURBS_TAGGER, +}; pub use crate::tokens::{Span, Tokenizer}; +pub use crate::tokens::normalize_diacritics; +use crate::tokens::Tokenized; + +pub mod errors; +mod tagger; +mod tokens; /// Path to the assets directory, if not provided at runtime will default to ./libs/tagger/assets pub static ASSETS_PATH: OnceCell = OnceCell::new(); @@ -319,11 +318,9 @@ fn mark_tagged(tagged: &mut [bool], tokenized: &Tokenized) { #[cfg(test)] mod test { + use crate::TaggerQueryBuilder; use crate::tagger::{Tag, TaggedPart}; use crate::tokens::Span; - use crate::{TaggerQueryBuilder, ASSETS_PATH}; - use std::env; - use std::path::PathBuf; #[test] fn brand_with_accent() { @@ -522,13 +519,6 @@ mod test { ); } - #[test] - fn dummy() { - let x = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("assets"); - println!("{:?}", env::current_dir().unwrap()); - println!("{:?}", x); - assert!(x.exists()); - } #[test] fn three_labels_with_different_span_length() { assert_eq!(