Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ name: Container

on:
push:
tags-ignore:
- "!v*"
branches:
- "develop"
- "main"
tags:
- "v*"
pull_request:
branches:
- "develop"
Expand All @@ -17,6 +20,10 @@ jobs:
name: Test (Docker)
runs-on: ubuntu-latest

strategy:
matrix:
target: [debug, release]

steps:
- id: setup
name: Setup Toolchain
Expand All @@ -29,9 +36,10 @@ jobs:
file: ./Containerfile
push: false
load: true
target: ${{ matrix.target }}
tags: torrust-tracker:local
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha

- id: inspect
name: Inspect
Expand Down Expand Up @@ -122,4 +130,4 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha
81 changes: 81 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Deployment

on:
push:
tags:
- "v*"

jobs:
secrets:
name: Secrets
needs: context
environment: dockerhub-torrust
if: needs.context.outputs.continue == 'true'
runs-on: ubuntu-latest

outputs:
continue: ${{ steps.check.outputs.continue }}

steps:
- id: check
name: Check
env:
CRATES_TOKEN: "${{ secrets.CRATES_TOKEN }}"
if: "${{ env.CRATES_TOKEN != '' }}"
run: echo "continue=true" >> $GITHUB_OUTPUT

test:
name: Test
needs: secrets
if: needs.secrets.outputs.continue == 'true'
runs-on: ubuntu-latest

strategy:
matrix:
toolchain: [stable, nightly]

steps:
- id: checkout
name: Checkout Repository
uses: actions/checkout@v3

- id: setup
name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}

- id: test
name: Run Unit Tests
run: cargo test --tests --benches --examples --workspace --all-targets --all-features

publish:
name: Publish
environment: crates-io-torrust
needs: test
if: needs.secrets.outputs.continue == 'true'
runs-on: ubuntu-latest

steps:
- id: checkout
name: Checkout Repository
uses: actions/checkout@v3

- id: setup
name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}

- id: publish
name: Publish Crates
run: |
cargo publish -p torrust-tracker-contrib-bencode
cargo publish -p torrust-tracker-located-error
cargo publish -p torrust-tracker-primitives
cargo publish -p torrust-tracker-configuration
cargo publish -p torrust-tracker-test-helpers
cargo publish -p torrust-tracker
57 changes: 0 additions & 57 deletions .github/workflows/publish_crate.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
toolchain: ${{ matrix.toolchain }}
components: clippy

- id: cache
Expand Down
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
[package]
name = "torrust-tracker"
description = "A feature rich BitTorrent tracker."
license-file.workspace = true
readme = "README.md"

authors.workspace = true
description.workspace = true
documentation.workspace = true
edition.workspace = true
homepage.workspace = true
keywords.workspace = true
license-file.workspace = true
publish.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true


[workspace.package]
license-file = "COPYRIGHT"
authors = [
"Nautilus Cyberneering <[email protected]>, Mick van Dijke <[email protected]>",
]
categories = ["network-programming", "web-programming"]
description = "A feature rich BitTorrent tracker."
documentation = "https://docs.rs/crate/torrust-tracker/"
edition = "2021"
homepage = "https://torrust.com/"
keywords = ["bittorrent", "tracker", "file-sharing", "peer-to-peer", "torrent"]
license-file = "COPYRIGHT"
publish = true
repository = "https://github.com/torrust/torrust-tracker"
rust-version = "1.72"
version = "3.0.0-alpha.4"


[dependencies]
tokio = { version = "1.29", features = [
"rt-multi-thread",
Expand Down Expand Up @@ -50,7 +66,7 @@ axum = "0.6.20"
axum-server = { version = "0.5", features = ["tls-rustls"] }
axum-client-ip = "0.4.1"
tower-http = { version = "0.4.3", features = ["compression-full"] }
bencode = { version = "1.0.0-alpha.1", path = "contrib/bencode" }
torrust-tracker-contrib-bencode = { version = "3.0.0-alpha.4", path = "contrib/bencode"}
torrust-tracker-primitives = { version = "3.0.0-alpha.4", path = "packages/primitives" }
torrust-tracker-configuration = { version = "3.0.0-alpha.4", path = "packages/configuration" }
torrust-tracker-located-error = { version = "3.0.0-alpha.4", path = "packages/located-error" }
Expand Down
3 changes: 2 additions & 1 deletion cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"curr",
"Cyberneering",
"datetime",
"Dijke",
"distroless",
"dockerhub",
"downloadedi",
Expand Down Expand Up @@ -133,4 +134,4 @@
"shellscript",
"toml"
]
}
}
25 changes: 12 additions & 13 deletions contrib/bencode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
[package]
name = "bencode"
description = "Efficient decoding and encoding for bencode."
keywords = ["bencode"]
name = "torrust-tracker-contrib-bencode"
description = "(contrib) Efficient decoding and encoding for bencode."
keywords = ["library", "contrib", "bencode"]
readme = "README.md"


authors = [
"Nautilus Cyberneering <[email protected]>, Andrew <[email protected]>",
]
categories = ["network-programming", "web-programming"]
documentation = "https://github.com/torrust/bittorrent-infrastructure-project"
edition = "2021"
homepage = "https://github.com/torrust/bittorrent-infrastructure-project"
license = "Apache-2.0"
publish = false # until we decide where to publish.
repository = "https://github.com/torrust/bittorrent-infrastructure-project"
rust-version = "1.71"
version = "1.0.0-alpha.1"
license = "Apache-2.0"

documentation.workspace = true
edition.workspace = true
homepage.workspace = true
publish.workspace = true
rust-version.workspace = true
version.workspace = true


[dependencies]
Expand All @@ -31,4 +30,4 @@ path = "test/mod.rs"

[[bench]]
name = "bencode_benchmark"
harness = false
harness = false
2 changes: 1 addition & 1 deletion contrib/bencode/benches/bencode_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use bencode::{BDecodeOpt, BencodeRef};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use torrust_tracker_contrib_bencode::{BDecodeOpt, BencodeRef};

const B_NESTED_LISTS: &[u8; 100] =
b"lllllllllllllllllllllllllllllllllllllllllllllllllleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; // cspell:disable-line
Expand Down
12 changes: 6 additions & 6 deletions contrib/bencode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ const BYTE_LEN_END: u8 = b':';
macro_rules! ben_map {
( $($key:expr => $val:expr),* ) => {
{
use bencode::{BMutAccess, BencodeMut};
use bencode::inner::BCowConvert;
use $crate::{BMutAccess, BencodeMut};
use $crate::inner::BCowConvert;

let mut bencode_map = BencodeMut::new_dict();
{
Expand All @@ -106,7 +106,7 @@ macro_rules! ben_map {
macro_rules! ben_list {
( $($ben:expr),* ) => {
{
use bencode::{BencodeMut, BMutAccess};
use $crate::{BencodeMut, BMutAccess};

let mut bencode_list = BencodeMut::new_list();
{
Expand All @@ -125,8 +125,8 @@ macro_rules! ben_list {
#[macro_export]
macro_rules! ben_bytes {
( $ben:expr ) => {{
use bencode::inner::BCowConvert;
use bencode::BencodeMut;
use $crate::inner::BCowConvert;
use $crate::BencodeMut;

BencodeMut::new_bytes(BCowConvert::convert($ben))
}};
Expand All @@ -136,7 +136,7 @@ macro_rules! ben_bytes {
#[macro_export]
macro_rules! ben_int {
( $ben:expr ) => {{
use bencode::BencodeMut;
use $crate::BencodeMut;

BencodeMut::new_int($ben)
}};
Expand Down
2 changes: 0 additions & 2 deletions contrib/bencode/src/reference/decode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::should_panic_without_expect)]

use std::collections::btree_map::Entry;
use std::collections::BTreeMap;
use std::str::{self};
Expand Down
Loading