diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 83e2740..6ee1406 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,8 @@ jobs: os: ubuntu-latest - target: x86_64-unknown-linux-musl os: ubuntu-latest + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest - target: x86_64-apple-darwin os: macos-latest - target: x86_64-pc-windows-msvc @@ -55,7 +57,6 @@ jobs: - name: Install musl-tools (Linux musl only) if: matrix.target == 'x86_64-unknown-linux-musl' run: sudo apt-get update && sudo apt-get install -y musl-tools - - name: Build Rust backend run: cargo build --release --features vendored-openssl --target=${{ matrix.target }} @@ -144,15 +145,24 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Download Linux musl artifact + - name: Download Linux musl artifact (amd64) uses: actions/download-artifact@v4 with: name: x86_64-unknown-linux-musl - path: artifacts + path: artifacts/amd64 + + - name: Download Linux artifact (arm64) + uses: actions/download-artifact@v4 + with: + name: aarch64-unknown-linux-gnu + path: artifacts/arm64 - name: Prepare Docker context run: | - tar -xzf artifacts/${{ env.BINARY_NAME }}-*.tar.gz -C docker + mkdir -p docker/amd64 docker/arm64 + tar -xzf artifacts/amd64/${{ env.BINARY_NAME }}-*.tar.gz -C docker/amd64 + tar -xzf artifacts/arm64/${{ env.BINARY_NAME }}-*.tar.gz -C docker/arm64 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -167,6 +177,7 @@ jobs: uses: docker/build-push-action@v5 with: context: ./docker + platforms: linux/amd64,linux/arm64 push: true tags: | rustmailer/bichon:${{ github.ref_name }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 17c7b18..74624aa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,7 @@ # Use Debian bullseye-slim as the base image for newer OpenSSL FROM ubuntu:24.04 ARG CRATE_VERSION +ARG TARGETARCH # Set maintainer metadata LABEL maintainer="rustmailer " @@ -11,15 +12,13 @@ LABEL description="Dockerized Bichon service" WORKDIR /opt/bichon # Copy compiled binary (ensure it's statically linked or compatible with bullseye) -COPY bichon /opt/bichon/bichon +COPY ${TARGETARCH}/bichon /opt/bichon/bichon COPY LICENSE /opt/bichon/ # Set proper permissions RUN chmod +x /opt/bichon/bichon # Install ca-certificates to ensure HTTPS certificate verification works correctly -RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/* RUN apt update && apt install -y ca-certificates curl && rm -rf /var/lib/apt/lists/* - # Create data directory RUN mkdir -p /data diff --git a/src/modules/indexer/tests.rs b/src/modules/indexer/tests.rs index 1577d92..f8a574d 100644 --- a/src/modules/indexer/tests.rs +++ b/src/modules/indexer/tests.rs @@ -16,7 +16,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - use std::{path::PathBuf, time::Duration}; use chrono::Utc; @@ -145,20 +144,20 @@ async fn test2() { let delete_term3 = Term::from_field_u64(a, 3u64); let operations = vec![ - //UserOperation::Delete(delete_term1), + UserOperation::Delete(delete_term1), UserOperation::Add(doc!( a => 1u64, - b => "test1" + b => "v1" )), - //UserOperation::Delete(delete_term2), + UserOperation::Delete(delete_term2), UserOperation::Add(doc!( a => 2u64, - b => "test1" + b => "v1" )), - //UserOperation::Delete(delete_term3), + UserOperation::Delete(delete_term3), UserOperation::Add(doc!( a => 3u64, - b => "test1" + b => "v1" )), ]; @@ -166,13 +165,10 @@ async fn test2() { index_writer.commit().unwrap(); let reader = index.reader().unwrap(); - let searcher = reader.searcher(); - let tq = TermQuery::new(Term::from_field_u64(a, 3), IndexRecordOption::Basic); - let docs = searcher.search(&tq, &TopDocs::with_limit(1)).unwrap(); - + assert!(docs.first().is_some()); if let Some((_, doc_address)) = docs.first() { let old_doc: TantivyDocument = searcher.doc_async(*doc_address).await.unwrap(); @@ -181,12 +177,14 @@ async fn test2() { if field == a { new_doc.add_field_value(a, value); } + if field == b { + assert_eq!(Some("v1"), value.as_str()) + } } - new_doc.add_text(b, "test2"); + new_doc.add_text(b, "v2"); let delete_term = Term::from_field_u64(a, 3); index_writer.delete_term(delete_term); - index_writer.commit().unwrap(); index_writer.add_document(new_doc).unwrap(); index_writer.commit().unwrap(); } @@ -194,17 +192,14 @@ async fn test2() { reader.reload().unwrap(); let searcher = reader.searcher(); let docs = searcher.search(&tq, &TopDocs::with_limit(1)).unwrap(); - + assert!(docs.first().is_some()); if let Some((_, doc_address)) = docs.first() { let doc: TantivyDocument = searcher.doc_async(*doc_address).await.unwrap(); for (field, value) in doc.field_values() { if field == b { - let value = value.as_str(); - println!("{:#?}", value); + assert_eq!(Some("v2"), value.as_str()) } } - } else { - println!("not found") } let delete_term = Term::from_field_u64(a, 3); @@ -214,7 +209,7 @@ async fn test2() { reader.reload().unwrap(); let searcher = reader.searcher(); let docs = searcher.search(&tq, &TopDocs::with_limit(1)).unwrap(); - + assert!(docs.first().is_none()); if let Some((_, doc_address)) = docs.first() { let doc: TantivyDocument = searcher.doc_async(*doc_address).await.unwrap(); for (field, value) in doc.field_values() { @@ -223,7 +218,5 @@ async fn test2() { println!("{:#?}", value); } } - } else { - println!("not found") } }