Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
102 changes: 52 additions & 50 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,68 @@
name: ✅ Checks
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# No long run pushes on main since it will be called by the release workflow
# push:
# branches: [ "main" ]
pull_request:
branches: ["main"]
workflow_call:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C target-cpu=native"
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
RUSTFLAGS: "-C target-cpu=native"
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
build_and_test:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4

- name: 🦀 Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt
- name: 🦀 Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt

- name: 💾 Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "build-cache"
- name: 💾 Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "build-cache"

- name: 🔨 Build
run: cargo build --verbose
- name: 🔨 Build
run: cargo build --verbose

- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Install latest nextest release
uses: taiki-e/install-action@nextest

- name: 🧪 Run tests
uses: actions-rs/cargo@v1
with:
command: nextest
args: run --nocapture --no-fail-fast
- name: 🧪 Run tests
uses: actions-rs/cargo@v1
with:
command: nextest
args: run --nocapture --no-fail-fast

lint:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
lint:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4

- name: 🦀 Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt
- name: 🦀 Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt

- name: 💾 Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "lint-cache"
- name: 💾 Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "lint-cache"

- name: 🔍 Run linter
run: cargo clippy --all-targets --all-features -- -D warnings
- name: 🔍 Run linter
run: cargo clippy --all-targets --all-features -- -D warnings

- name: 💅 Run format checker
run: cargo fmt --check
- name: 📖 Run doc linter
run: cargo doc --no-deps --document-private-items
- name: 💅 Run format checker
run: cargo fmt --check

- name: 📖 Run doc linter
run: cargo doc --no-deps --document-private-items
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish Prerelease

on:
push:
paths:
# Only run if these files are changed
- "**/Cargo.toml"
- "**/Cargo.lock"
- "**/*.rs"
branches:
- main

jobs:
checks:
uses: ./.github/workflows/checks.yml
publish-crates-io:
name: Publish prerelease to crates.io
runs-on: ubuntu-latest
needs: checks
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@nightly

- name: Install cargo-edit
run: cargo install cargo-edit --locked

- name: Compute prerelease version
id: version
run: |
BASE_VERSION=$(cargo pkgid -p libtortillas | sed 's/.*#//')
PRERELEASE_VERSION="${BASE_VERSION}-alpha.${GITHUB_SHA::7}"
echo "prerelease_version=$PRERELEASE_VERSION" >> $GITHUB_OUTPUT

- name: Set prerelease version
run: |
cargo set-version -p libtortillas --no-workspace ${{ steps.version.outputs.prerelease_version }}

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p libtortillas --allow-dirty --no-verify
6 changes: 6 additions & 0 deletions crates/libtortillas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name = "libtortillas"
license = "MPL-2.0"
version = "0.0.0"
edition = "2024"
description = "A asynchronous library based on the actor model for interacting with the bittorrent protocol"
repository = "https://github.com/artrixdotdev/tortillas"
keywords = ["bittorrent", "p2p", "torrent"]
categories = ["network-programming", "concurrency"]
readme = "../../README.md"


[dependencies]
serde = { workspace = true }
Expand Down
Loading