Add usage and fix dependency problems

This commit is contained in:
Mahmut Bulut 2019-10-06 13:25:44 +02:00
parent b0f0b0de3c
commit 45ae8e642a
No known key found for this signature in database
GPG Key ID: D20F2F5E6DFD6F11
6 changed files with 120 additions and 3 deletions

12
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: bastion
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay:
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

77
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,77 @@
name: CI
on: [push, pull_request]
jobs:
build_and_test_stable:
name: Stable - Build and test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@master
- name: Install stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: check
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests
- name: tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
build_and_test_nightly:
name: Nightly - Build and test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@master
- name: Install nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: check
uses: actions-rs/cargo@v1
with:
command: check
args: --all --benches --bins --examples --tests
- name: tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
check_fmt_and_docs:
name: Checking fmt and docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: setup
run: |
rustup default stable
rustup component add rustfmt
rustc --version
- name: fmt
run: cargo fmt --all -- --check
- name: Docs
run: cargo doc

20
.github/workflows/clippy.yml vendored Normal file
View File

@ -0,0 +1,20 @@
on: pull_request
name: Clippy Check
jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- id: component
uses: actions-rs/components-nightly@v1
with:
component: clippy
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ steps.component.outputs.toolchain }}
override: true
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -34,12 +34,13 @@ maintenance = { status = "actively-developed" }
proc-macro = true
[dependencies]
bastion = "0.2"
syn = { version = "1.0.5", features = ["full"] }
proc-macro2 = { version = "1.0.5", features = ["nightly"] }
quote = "1.0.2"
[dev-dependencies]
bastion = "0.2"
[profile.dev]
panic = "unwind"

View File

@ -2,6 +2,13 @@
Fort is proc macro attribute crate for Bastion.
## Usage
```toml
[dependencies]
fort = "0.1"
bastion = "0.2.*"
```
You can directly use fort to load work onto the root supervisor with:
```rust
#[fort::root]

View File

@ -35,7 +35,7 @@ pub fn root(_attr: TokenStream, item: TokenStream) -> TokenStream {
if name != "main" {
let tokens = quote_spanned! { name.span() =>
compile_error!("only the main function can be tagged with #[fort::main]");
compile_error!("only the main function can be tagged with #[fort::root]");
};
return TokenStream::from(tokens);
}