Skip to content

Commit

Permalink
Re-flatten crate structure and get rid of PushService trait (#331)
Browse files Browse the repository at this point in the history
This is a first step to refactor PushService and split the push_service.rs file in many smaller parts.

Co-authored-by: Ruben De Smet <[email protected]>
  • Loading branch information
gferon and rubdos authored Oct 17, 2024
1 parent 65b51db commit ae55eb8
Show file tree
Hide file tree
Showing 74 changed files with 1,550 additions and 3,253 deletions.
60 changes: 16 additions & 44 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: ["libsignal-service-actix", "libsignal-service-hyper", "libsignal-service"]
features: ["", "unsend-futures"]
exclude:
# -actix always has unsend futures, so we don't have that feature flag
- project: "libsignal-service-actix"
features: "unsend-futures"
steps:
- uses: actions/checkout@v3
- name: Install protobuf
Expand All @@ -37,70 +30,49 @@ jobs:
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --features "${{ matrix.features }}" --manifest-path ${{ matrix.project }}/Cargo.toml

build:
name: Build (${{ matrix.project }}, Rust ${{ matrix.toolchain }})
name: Build / Rust ${{ matrix.toolchain }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: ["libsignal-service-actix", "libsignal-service-hyper", "libsignal-service"]
toolchain: ["stable", "beta", "nightly"]
coverage: [false, true]
features: ["", "unsend-futures"]
exclude:
# Coverage related excludes
- toolchain: stable
coverage: true
- toolchain: beta
coverage: true
- toolchain: nightly
coverage: false

# Feature flag related excludes
# Actix like above
- project: "libsignal-service-actix"
features: "unsend-futures"
# We don't need to spawn this many jobs to see that unsend-futures works
- features: "unsend-futures"
toolchain: "beta"
- features: "unsend-futures"
toolchain: "nightly"
include:
- project: "libsignal-service-actix"
toolchain: "1.75"
coverage: false
toolchain: ["stable", "beta", "nightly", "1.75"]
steps:
- uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

- name: Install protobuf
run: |
sudo apt-get update
sudo apt-get install -y libprotobuf-dev libprotobuf-c-dev protobuf-compiler protobuf-c-compiler
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
override: true

- name: Configure CI cache
uses: Swatinem/rust-cache@v2

- name: Run tests
uses: actions-rs/cargo@v1
if: ${{ !matrix.coverage }}
if: matrix.toolchain != 'nightly'
with:
command: test
args: --all-targets --no-fail-fast --features "${{ matrix.features }}" --manifest-path ${{ matrix.project }}/Cargo.toml
args: --all-targets --no-fail-fast

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all-targets --features "${{ matrix.features }}" --manifest-path ${{ matrix.project }}/Cargo.toml
args: --all-targets

- name: Run tests
- name: Run tests with code coverage
uses: actions-rs/cargo@v1
if: ${{ matrix.coverage }}
if: matrix.toolchain == 'nightly'
with:
command: test
args: --all-targets --no-fail-fast --features "${{ matrix.features }}" --manifest-path ${{ matrix.project }}/Cargo.toml
args: --all-targets --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
Expand Down
62 changes: 58 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,62 @@
[workspace]
members = ["libsignal-service", "libsignal-service-actix", "libsignal-service-hyper"]
default-members = ["libsignal-service", "libsignal-service-hyper"]
[package]
name = "libsignal-service"
version = "0.1.0"
authors = ["Ruben De Smet <[email protected]>", "Gabriel Féron <[email protected]>"]
edition = "2021"
license = "AGPL-3.0"
readme = "README.md"

resolver = "2"
[dependencies]
libsignal-protocol = { git = "https://github.com/signalapp/libsignal", tag = "v0.56.1" }
zkgroup = { git = "https://github.com/signalapp/libsignal", tag = "v0.56.1" }

aes = "0.8"
aes-gcm = "0.10"
cbc = "0.1"
ctr = "0.9"
async-trait = "0.1"
base64 = "0.22"
bincode = "1.3"
bytes = "1"
chrono = { version = "0.4", features = ["serde", "clock"], default-features = false }
derivative = "2.2"
futures = "0.3"
hex = "0.4"
hkdf = "0.12"
hmac = "0.12"
phonenumber = "0.3"
prost = "0.13"
rand = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.85"
sha2 = "0.10"
thiserror = "1.0"
url = { version = "2.1", features = ["serde"] }
uuid = { version = "1", features = ["serde"] }

# http
hyper = "1.0"
hyper-util = { version = "0.1", features = ["client", "client-legacy"] }
hyper-rustls = { version = "0.27", default-features = false, features = ["http1", "http2", "ring", "logging"] }
hyper-timeout = "0.5"
headers = "0.4"
http-body-util = "0.1"
mpart-async = "0.7"
async-tungstenite = { version = "0.27", features = ["tokio-rustls-native-certs", "url"] }
tokio = { version = "1.0", features = ["macros"] }
tokio-rustls = { version = "0.26", default-features = false, features = ["logging", "ring"] }

rustls-pemfile = "2.0"

tracing = { version = "0.1", features = ["log"] }
tracing-futures = "0.2"

[build-dependencies]
prost-build = "0.13"

[dev-dependencies]
anyhow = "1.0"
tokio = { version = "1.0", features = ["macros", "rt"] }

[patch.crates-io]
curve25519-dalek = { git = 'https://github.com/signalapp/curve25519-dalek', tag = 'signal-curve25519-4.1.3' }
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,14 @@ We're actively trying to make `libsignal-service-rs` fully functional.

If you're looking to contribute or want to ask a question, you're more than welcome to join our development channel on Matrix (#whisperfish:rubdos.be) or Libera.chat (#whisperfish) to get in touch with us!

## Feature flags for libsignal-service

| Feature flag | Description |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `unsend-futures` | This feature removes the `Send` requirement on returned futures. Enabling this flag may be necessary for interoperability with other libraries that don't support `Send` such as actix. |

## License

Copyright 2015-2019 Open Whisper Systems
Copyright 2020-2023 Signal Messenger, LLC
Copyright 2019-2021 Michael F Bryan
Copyright 2019-2023 Ruben De Smet
Copyright 2019-2023 Gabriel Féron
Copyright 2019-2023 Whisperfish contributors
Copyright 2019-2024 Ruben De Smet
Copyright 2019-2024 Gabriel Féron
Copyright 2019-2024 Whisperfish contributors

Licensed under the AGPLv3: http://www.gnu.org/licenses/agpl-3.0.html

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 0 additions & 42 deletions libsignal-service-actix/Cargo.toml

This file was deleted.

Loading

0 comments on commit ae55eb8

Please sign in to comment.