Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero committed Sep 2, 2023
0 parents commit 68bdccf
Show file tree
Hide file tree
Showing 7 changed files with 315 additions and 0 deletions.
266 changes: 266 additions & 0 deletions .github/workflows/wot-directory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
name: wot-directory

on:
push:
branches:
- master
paths:
- 'src/**'
- '.github/**'
- 'Cargo.toml'
pull_request:
branches:
- master
paths:
- 'src/**'
- '.github/**'
- 'Cargo.toml'

jobs:

################################## LEGAL AND FORMAT LAYER ######################

reuse:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3


- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1

clippy-rustfmt:

strategy:
matrix:
platform: [ubuntu-latest]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3

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

- name: Run rustfmt
run:
cargo fmt --all -- --check --verbose

- name: Run cargo clippy
uses: giraffate/clippy-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: --all-targets -- -D warnings
reporter: github-pr-review

################################## BUILD AND DOCS LAYER ########################

build:

needs: [reuse, clippy-rustfmt]

strategy:
matrix:
platform: [ubuntu-latest]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Build
run: cargo build --verbose

docs:

needs: [reuse, clippy-rustfmt]

strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Generate docs
run: cargo doc --verbose --no-deps

################################## CODE COVERAGE LAYER ##################################

code-coverage-ubuntu:

needs: [build, docs]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Install grcov
env:
GRCOV_LINK: https://github.com/mozilla/grcov/releases/download
GRCOV_VERSION: v0.8.13
run: |
curl -L "$GRCOV_LINK/$GRCOV_VERSION/grcov-x86_64-unknown-linux-musl.tar.bz2" |
tar xj -C $HOME/.cargo/bin
- name: Install llvm-tools-preview
run: |
rustup component add llvm-tools-preview
# Not necessary on a newly created image, but strictly advised
- name: Run cargo clean
run: |
cargo clean
- name: Run tests
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "wot-directory-%p-%m.profraw"
run: |
cargo test --verbose
- name: Get coverage data for codecov
run: |
grcov . --binary-path ./target/debug/ -s . -t lcov --branch \
--ignore-not-existing --ignore "/*" --ignore "../*" -o lcov.info
- name: Codecov upload
uses: codecov/codecov-action@v3
with:
files: lcov.info

- name: Get total coverage
run: |
# Remove lcov.info file to avoid function duplications
rm -rf lcov.info
grcov . --binary-path ./target/debug/ -s . -t covdir --branch \
--token YOUR_COVDIR_TOKEN --ignore-not-existing --ignore "/*" \
--ignore "../*" -o covdir.json
################################## DEPENDENCY LAYER ###########################

audit-ubuntu:

needs: [code-coverage-ubuntu]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Check dependencies changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
cargo:
- 'Cargo.toml'
- 'Cargo.lock'
- name: Run cargo-audit
if: steps.changes.outputs.cargo == 'true'
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

deny-ubuntu:

needs: [code-coverage-ubuntu]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Check dependencies changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
cargo:
- 'Cargo.toml'
- 'Cargo.lock'
- name: Install Rust stable
if: steps.changes.outputs.cargo == 'true'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Install cargo-deny
if: steps.changes.outputs.cargo == 'true'
env:
DENY_LINK: https://github.com/EmbarkStudios/cargo-deny/releases/download
DENY_VERSION: 0.13.7
run: |
curl -L "$DENY_LINK/$DENY_VERSION/cargo-deny-$DENY_VERSION-x86_64-unknown-linux-musl.tar.gz" |
tar xz -C $HOME/.cargo/bin --strip-components 1
- name: Run cargo-deny
if: steps.changes.outputs.cargo == 'true'
run: |
cargo deny init
cargo deny check bans
# cargo deny check licenses
udeps-ubuntu:

needs: [code-coverage-ubuntu]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Check dependencies changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
cargo:
- 'Cargo.toml'
- 'Cargo.lock'
- name: Install Rust nightly
if: steps.changes.outputs.cargo == 'true'
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly

- name: Install cargo-udeps
if: steps.changes.outputs.cargo == 'true'
env:
UDEPS_LINK: https://github.com/est31/cargo-udeps/releases/download
UDEPS_VERSION: v0.1.35
run: |
curl -L "$UDEPS_LINK/$UDEPS_VERSION/cargo-udeps-$UDEPS_VERSION-x86_64-unknown-linux-gnu.tar.gz" |
tar xz -C $HOME/.cargo/bin --strip-components 2
- name: Run cargo-udeps
if: steps.changes.outputs.cargo == 'true'
run: |
cargo +nightly udeps --all-targets
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
/Cargo.lock
8 changes: 8 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: wot-directory
Upstream-Contact: Name Surname <mail@example.com>
Source: https://your/project/link

Files: *
Copyright: 2019 Translation Company
License: MIT
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "wot-directory"
version = "0.1.0"
edition = "2021"
license = "MIT"
description = "Web of Things (WoT) Thing Description Directory"
repository = "https://github.com/wot-rust/wot-directory"
keywords = ["wot", "WebofThings"]

[dependencies]

9 changes: 9 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [![logo](https://github.com/sifis-home/wot/raw/master/assets/wot-rust-icon.svg)](https://docs.rs/wot-td) wot-directory

[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSES/MIT.txt)
[![Build Status](https://github.com/wot-rust/wot-directory/workflows/wot-directory/badge.svg)](https://github.com/wot-rust/wot-directory/actions)
[![Crates.io](https://img.shields.io/crates/v/wot-directory.svg)](https://crates.io/crates/wot-directory)
[![dependency status](https://deps.rs/repo/github/wot-rust/wot-directory/status.svg)](https://deps.rs/repo/github/wot-rust/wot-directory)
[![Documentation](https://docs.rs/wot-directory/badge.svg)](https://docs.rs/wot-directory/)
[![wot discord](https://img.shields.io/badge/wot-discord-blue)](https://discord.gg/5zy68ukBrv)

Tiny implementation of WoT [Discovery](https://www.w3.org/TR/wot-discovery/) Directory.

## Status

This is a placeholder

4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//! Implementation of the Directory side of WoT Discovery
//!
//! A Thing Description Directory is a WoT Thing exposing a database
//! of Things.

0 comments on commit 68bdccf

Please sign in to comment.