Skip to content

Commit

Permalink
feat(all): initial commit (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
martsokha committed Jun 18, 2024
1 parent 3a53323 commit 4a96982
Show file tree
Hide file tree
Showing 64 changed files with 5,958 additions and 11 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:

- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
timezone: "Europe/Warsaw"
day: "friday"
time: "18:00"
60 changes: 60 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build

on:
push:
branches:
- main
pull_request:

jobs:
ci:
name: CI
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
toolchain: [ stable ]
runs-on: ${{ matrix.os }}
steps:

- name: Check out
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}

- name: Set up Cache
uses: Swatinem/rust-cache@v2

- name: Install Tarpaulin
if: matrix.os == 'ubuntu-latest'
continue-on-error: true
run: cargo install cargo-tarpaulin

- name: Install & Run Semver
if: matrix.os == 'ubuntu-latest'
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
rust-toolchain: ${{ matrix.toolchain }}
feature-group: all-features
verbose: true

- name: Run Cargo:fmt
run: cargo fmt --all -- --check

- name: Run Cargo:clippy
run: cargo clippy --all-features -- -D warnings

- name: Run Cargo:test
run: cargo test --verbose --all-features

- name: Run Cargo:tarpaulin
if: matrix.os == 'ubuntu-latest'
run: cargo tarpaulin --verbose --all-features --out Xml --output-dir ./coverage

- name: Upload Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
files: ./coverage/cobertura.xml
23 changes: 23 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish

on:
workflow_dispatch:

jobs:
cd:
name: CD
runs-on: ubuntu-latest
steps:

- name: Check out
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Publish
run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
30 changes: 21 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# Generated by Cargo
# will have compiled files and executables
# OS
Thumbs.db
.DS_Store
*.pdb

# Editors
.vs/
.vscode/
.idea/
.fleet/

# Lang: Rust
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
# Environment
env/
.env
.env*

# Logs
logs/
*.log
*.log*
29 changes: 29 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace]
resolver = "2"
members = [
"./spire",
"./spire-*",
]

default-members = [
"./spire",
"./spire-*",
]

[workspace.package]
version = "0.1.1-rc.1"
edition = "2021"
readme = "./README.md"
license = "MIT"

authors = ["Oleh Martsokha <o.martsokha@gmail.com>"]
repository = "https://github.com/spire-rs/spire"
homepage = "https://github.com/spire-rs/spire"
documentation = "https://docs.rs/spire"

[workspace.dependencies]
spire = { path = "./spire", version = "0.1.1-rc.1" }
spire-core = { path = "./spire-core", version = "0.1.1-rc.1" }
spire-macros = { path = "./spire-macros", version = "0.1.1-rc.1" }
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Ethical Web Scraping with Rust
Copyright (c) 2023 spire-rs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
# spire
## spire

[![Build Status][action-badge]][action-url]
[![Crate Docs][docs-badge]][docs-url]
[![Crate Version][crates-badge]][crates-url]
[![Crate Coverage][coverage-badge]][coverage-url]

**Check out other `spire` projects [here](https://github.com/spire-rs).**

[action-badge]: https://img.shields.io/github/actions/workflow/status/spire-rs/spire/build.yaml?branch=main&label=build&logo=github&style=flat-square
[action-url]: https://github.com/spire-rs/spire/actions/workflows/build.yaml
[crates-badge]: https://img.shields.io/crates/v/spire.svg?logo=rust&style=flat-square
[crates-url]: https://crates.io/crates/spire
[docs-badge]: https://img.shields.io/docsrs/spire?logo=Docs.rs&style=flat-square
[docs-url]: http://docs.rs/spire
[coverage-badge]: https://img.shields.io/codecov/c/github/spire-re/spire?logo=codecov&logoColor=white&style=flat-square
[coverage-url]: https://app.codecov.io/gh/spire-rs/spire

The flexible crawler & scraper framework powered by [tokio][tokio-rs/tokio] and
[tower][tower-rs/tower].

[tokio-rs/tokio]: https://github.com/tokio-rs/tokio/
[tower-rs/tower]: https://github.com/tower-rs/tower/

#### Crates

- [spire](./spire/): extraction and routing utilities.
- [spire-core](./spire-core/): core types and traits.
- [spire-macros](./spire-macros/): procedural macros.
60 changes: 60 additions & 0 deletions spire-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# https://doc.rust-lang.org/cargo/reference/manifest.html

[package]
name = "spire-core"
version = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
readme = "./README.md"

authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
documentation = { workspace = true }

categories = ["asynchronous", "web-programming"]
keywords = ["crawler", "scraper", "web", "framework"]
description = """
Core types and traits for Spire.
"""

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lib]
path = "./lib.rs"

[features]
default = []
full = ["client", "driver", "tracing"]
tracing = ["trace", "dep:tracing"]

metric = ["tower/load"]
trace = ["dep:tracing"]

client = ["dep:hyper", "dep:hyper-util"]
driver = ["dep:fantoccini", "dep:deadpool"]

[dependencies]
tower = { version = "0.4", features = ["util"] }
bytes = { version = "1.6" }
futures = { version = "0.3" }
async-trait = { version = "0.1" }
pin-project-lite = { version = "0.2" }

http = { version = "1.1" }
http-body = { version = "1.0" }
http-body-util = { version = "0.1" }
thiserror = { version = "1.0" }

hyper = { version = "1.3", optional = true, features = ["client"] }
hyper-util = { version = "0.1", optional = true, features = ["service"] }
fantoccini = { version = "0.20.0-rc.7", optional = true }
deadpool = { version = "0.12", optional = true, features = [] }
tracing = { version = "0.1", optional = true }

[dev-dependencies]
tokio = { version = "1.38", features = ["rt-multi-thread", "macros"] }
tracing-test = { version = "0.2", features = [] }
reqwest = { version = "0.12", features = [] }
23 changes: 23 additions & 0 deletions spire-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## spire-core

[![Build Status][action-badge]][action-url]
[![Crate Docs][docs-badge]][docs-url]
[![Crate Version][crates-badge]][crates-url]
[![Crate Coverage][coverage-badge]][coverage-url]

**Check out other `spire` projects [here](https://github.com/spire-rs).**

[action-badge]: https://img.shields.io/github/actions/workflow/status/spire-rs/spire/build.yaml?branch=main&label=build&logo=github&style=flat-square
[action-url]: https://github.com/spire-rs/spire/actions/workflows/build.yaml
[crates-badge]: https://img.shields.io/crates/v/spire.svg?logo=rust&style=flat-square
[crates-url]: https://crates.io/crates/spire
[docs-badge]: https://img.shields.io/docsrs/spire?logo=Docs.rs&style=flat-square
[docs-url]: http://docs.rs/spire
[coverage-badge]: https://img.shields.io/codecov/c/github/spire-rs/spire?logo=codecov&logoColor=white&style=flat-square
[coverage-url]: https://app.codecov.io/gh/spire-rs/spire

The flexible crawler & scraper framework powered by [tokio][tokio-rs/tokio] and
[tower][tower-rs/tower].

[tokio-rs/tokio]: https://github.com/tokio-rs/tokio/
[tower-rs/tower]: https://github.com/tower-rs/tower/
Loading

0 comments on commit 4a96982

Please sign in to comment.