Skip to content

Commit

Permalink
use cargo workspaces (openmls#1090)
Browse files Browse the repository at this point in the history
  • Loading branch information
beltram authored Dec 12, 2022
1 parent a22f782 commit 65083d4
Show file tree
Hide file tree
Showing 31 changed files with 81 additions and 108 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/benches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ on:
env:
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: openmls

jobs:
benchmarks:
strategy:
Expand All @@ -35,4 +31,4 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Benchmarks
run: cargo bench --verbose
run: cargo bench -p openmls --verbose
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ on:
env:
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: openmls

jobs:
build:
strategy:
Expand Down Expand Up @@ -62,6 +58,6 @@ jobs:
override: true
target: ${{ matrix.arch }}
- name: Build debug
run: cargo build --verbose --target ${{ matrix.arch }}
run: cargo build --verbose --target ${{ matrix.arch }} -p openmls
- name: Build release
run: cargo build --release --verbose --target ${{ matrix.arch }}
run: cargo build --release --verbose --target ${{ matrix.arch }} -p openmls
4 changes: 0 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ concurrency:
env:
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: openmls

name: Cargo format check
jobs:
checks:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ concurrency:
env:
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: cli

jobs:
tests:
strategy:
Expand All @@ -34,4 +30,4 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Build cli
run: cargo build --verbose
run: cargo build --verbose -p cli
6 changes: 1 addition & 5 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
- push
- pull_request_target

defaults:
run:
working-directory: openmls

jobs:
clippy_check:
runs-on: ubuntu-latest
Expand All @@ -17,4 +13,4 @@ jobs:
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path openmls/Cargo.toml --tests
args: -p openmls --tests -- -D warnings
6 changes: 1 addition & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
- push
- pull_request_target

defaults:
run:
working-directory: openmls

jobs:
check:
name: coverage
Expand All @@ -30,7 +26,7 @@ jobs:
uses: actions-rs/[email protected]
with:
timeout: "500"
args: "--manifest-path openmls/Cargo.toml --force-clean"
args: "--force-clean"

- name: Upload to codecov.io
uses: codecov/codecov-action@v2
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: doc
args: --manifest-path openmls/Cargo.toml --message-format json
args: -p openmls --message-format json
8 changes: 2 additions & 6 deletions .github/workflows/ds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Test DS lib
run: |
cd delivery-service/ds-lib
cargo test --verbose
run: cargo test --verbose -p ds-lib
- name: Test DS
run: |
cd delivery-service/ds
cargo test --verbose
run: cargo test --verbose -p mls-ds
4 changes: 0 additions & 4 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ concurrency:
env:
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: openmls

jobs:
fuzz:
strategy:
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/interop_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ defaults:

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Run interop client test script
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ concurrency:
env:
CARGO_TERM_COLOR: always

defaults:
run:
working-directory: openmls

jobs:
tests:
strategy:
Expand All @@ -35,11 +31,9 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Tests debug build
run: |
cargo test --verbose
run: cargo test -p openmls --verbose
- name: Tests release build
run: |
cargo test --verbose --release
run: cargo test -p openmls --verbose --release
# Test 32 bit builds on windows
- name: Install rust target
if: matrix.os == 'windows-latest'
Expand All @@ -52,8 +46,8 @@ jobs:
- name: Tests 32bit windows debug & release build
if: matrix.os == 'windows-latest'
run: |
cargo test --verbose --target i686-pc-windows-msvc
cargo test --verbose --release --target i686-pc-windows-msvc
cargo test -p openmls --verbose --target i686-pc-windows-msvc
cargo test -p openmls --verbose --release --target i686-pc-windows-msvc
# Test 32 bit builds on linux
- name: Install rust target
if: matrix.os == 'ubuntu-latest'
Expand All @@ -67,5 +61,5 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update && sudo apt install gcc-multilib
cargo test --verbose --target i686-unknown-linux-gnu
cargo test --verbose --release --target i686-unknown-linux-gnu
cargo test -p openmls --verbose --target i686-unknown-linux-gnu
cargo test -p openmls --verbose --release --target i686-unknown-linux-gnu
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ delivery-service/ds/target
**/Cargo.lock
*.code-workspace
/test_vectors/
fuzz/corpus
fuzz/artifacts
.cargo/

# CLion IDE
.idea
*.iws
*.iml
*.ipr
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Before contributing, please read the [Code of Conduct](https://github.com/openml

- [Working with this repository](#working-with-this-repository)
- [Prioritisation](#prioritisation)
- [Patches](#patches)
- [Pull Requests](#pull-requests)
- [PR & Commit Guidelines](#pr--commit-guidelines)
- [PR Template](#pr-template)
Expand Down Expand Up @@ -44,6 +45,23 @@ Issue priorities are reflected with labels.
| P3 | low-priority item |
| P4 | wontfix unless someone contributes a fix |

### Patches

Sometimes, you have to work on another crate (e.g. [hpke-rs](https://crates.io/crates/hpke-rs)) alongside openmls. The
recommended way to proceed while developing locally is to patch openmls by adding the following to the root [Cargo.toml](./Cargo.toml):
```toml
[patch.crates-io.hpke-rs]
path = "../hpke-rs" # local path to the project
```
Once you are done with your changes and feel it's ready to be submitted, you will have to make your patch point to a
remote branch in order for the CI to succeed:
```toml
[patch.crates-io.hpke-rs]
git = "https://github.com/my-fork/hpke-rs"
branch = "fix/123"
package = "hpke-rs"
```

## Pull Requests

We use the Github based PR workflow.
Expand Down
18 changes: 18 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[workspace]
members = [
"openmls",
"traits",
"openmls_rust_crypto",
"fuzz",
"cli",
"interop_client",
"memory_keystore",
"evercrypt_backend",
"delivery-service/ds",
"delivery-service/ds-lib"
]
resolver = "2"

# Patching unreleased crates
[patch.crates-io.tls_codec]
git = "https://github.com/RustCrypto/formats.git"
10 changes: 5 additions & 5 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ reqwest = { version = "0.11", features = ["blocking", "json"] }
base64 = "0.13"
log = "0.4"
pretty_env_logger = "0.4"
termion = "1.5"
tls_codec = "0.2.0"
tls_codec = { version = "0.2.0", features = ["derive", "serde_serialize"] }

openmls = { path = "../openmls", features = ["test-utils"] }
ds-lib = { path = "../delivery-service/ds-lib" }
openmls_traits = { path = "../traits" }
openmls_rust_crypto = { path = "../openmls_rust_crypto" }
openmls_memory_keystore = { path = "../memory_keystore" }

# Patching unreleased crates
[patch.crates-io]
tls_codec = { git = "https://github.com/RustCrypto/formats.git", features = ["derive", "serde_serialize"] }
[dependencies.termion]
version = "1.5"
git = "https://gitlab.redox-os.org/Jezza/termion.git"
branch = "windows-support"
6 changes: 1 addition & 5 deletions delivery-service/ds-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ edition = "2018"
description = "Types to interact with the OpenMLS DS."

[dependencies]
tls_codec = "0.2.0"
tls_codec = { version = "0.2.0", features = ["derive", "serde_serialize"] }
openmls = { path = "../../openmls", features = ["test-utils"] }
openmls_traits = { path = "../../traits" }
openmls_rust_crypto = { path = "../../openmls_rust_crypto" }
openmls_memory_keystore = { path = "../../memory_keystore" }

# Patching unreleased crates
[patch.crates-io]
tls_codec = { git = "https://github.com/RustCrypto/formats.git", features = ["derive", "serde_serialize"] }
6 changes: 1 addition & 5 deletions delivery-service/ds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ serde = {version = "1.0", features = ["derive"]}
uuid = { version = "0.8", features = ["serde", "v4"] }
clap = "2.33"
base64 = "0.13"
tls_codec = "0.2.0"
tls_codec = { version = "0.2.0", features = ["derive", "serde_serialize"] }

openmls = { path = "../../openmls" }

ds-lib = { path = "../ds-lib/" }
openmls_rust_crypto = { path = "../../openmls_rust_crypto" }
openmls_traits = { path = "../../traits" }

# Patching unreleased crates
[patch.crates-io]
tls_codec = { git = "https://github.com/RustCrypto/formats.git", features = ["derive", "serde_serialize"] }
18 changes: 9 additions & 9 deletions openmls/fuzz/Cargo.toml → fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@ cargo-fuzz = true
libfuzzer-sys = "0.4"

[dependencies.openmls]
path = ".."

# Prevent this from interfering with workspaces
[workspace]
members = ["."]
path = "../openmls"

[[bin]]
name = "welcome_decode"
path = "fuzz_targets/welcome_decode.rs"
test = false
doc = false
harness = false
bench = false

[[bin]]
name = "key_package_decode"
path = "fuzz_targets/key_package_decode.rs"
test = false
doc = false
harness = false
bench = false

[[bin]]
name = "mls_message_decode"
path = "fuzz_targets/mls_message_decode.rs"
test = false
doc = false
harness = false
bench = false

[[bin]]
name = "proposal_decode"
path = "fuzz_targets/proposal_decode.rs"
test = false
doc = false

# Patching unreleased crates
[patch.crates-io]
tls_codec = { git = "https://github.com/RustCrypto/formats.git", features = ["derive", "serde_serialize", "mls"] }
harness = false
bench = false
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions interop_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,3 @@ pretty_env_logger = "0.4"

[build-dependencies]
tonic-build = "0.7"

# Patching unreleased crates
[patch.crates-io]
tls_codec = { git = "https://github.com/RustCrypto/formats.git", features = ["derive", "serde_serialize"] }
4 changes: 0 additions & 4 deletions openmls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,3 @@ features = ["test-utils", "evercrypt"]
[[bench]]
name = "benchmark"
harness = false

# Patching unreleased crates
[patch.crates-io]
tls_codec = { git = "https://github.com/RustCrypto/formats.git", features = ["derive", "serde_serialize", "mls"] }
4 changes: 0 additions & 4 deletions openmls/fuzz/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion openmls/src/extensions/test_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
fn capabilities() {
// A capabilities extension with the default values for openmls.
let extension_bytes = [
0xff, 0x00, 0, 0, 0, 29, 1, 1, 6, 0, 1, 0, 2, 0, 3, 6, 0xff, 00, 0xff, 01, 0, 1, 12, 0, 1,
0xff, 0x00, 0, 0, 0, 29, 1, 1, 6, 0, 1, 0, 2, 0, 3, 6, 0xff, 00, 0xff, 1, 0, 1, 12, 0, 1,
0, 2, 0, 3, 0, 4, 0, 5, 0, 8,
];
let mut extension_bytes_mut = &extension_bytes[..];
Expand Down
2 changes: 1 addition & 1 deletion openmls/src/group/tests/test_proposal_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ fn test_valsem109(ciphersuite: Ciphersuite, backend: &impl OpenMlsCryptoProvider

// We first go the manual route
let update_proposal = bob_group
.propose_self_update(backend, Some(update_kpb.clone()))
.propose_self_update(backend, Some(update_kpb))
.expect("error while creating remove proposal");

// Have Alice process this proposal.
Expand Down
Loading

0 comments on commit 65083d4

Please sign in to comment.