Skip to content

Commit

Permalink
[ci] Add derive crate #658 (#659)
Browse files Browse the repository at this point in the history
* remove agdb subdir

* move agdb to workspace member

* move tests to agdb

* fix publish

* fix release flow

* add agdb_derive

* add agdb_derive to workflows

* Update Cargo.toml

* Delete README.md

* Update README.md

* fix coverage
  • Loading branch information
michaelvlach authored Aug 10, 2023
1 parent d540501 commit e3676b6
Show file tree
Hide file tree
Showing 107 changed files with 75 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@cargo-llvm-cov
- run: rustup component add llvm-tools-preview
- run: cargo llvm-cov --workspace --lcov --output-path lcov.info
- run: cargo llvm-cov --workspace --ignore-filename-regex agdb_derive --lcov --output-path lcov.info
- uses: codecov/codecov-action@v3
with:
files: lcov.info
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- uses: actions/checkout@v3
- uses: taiki-e/install-action@cargo-llvm-cov
- run: rustup component add llvm-tools-preview
- run: cargo llvm-cov --workspace --fail-uncovered-functions 0
- run: cargo llvm-cov --workspace --ignore-filename-regex agdb_derive --fail-uncovered-functions 0
- run: |
REPORT=$(cargo llvm-cov report --show-missing-lines)
if [[ "$REPORT" =~ "Uncovered Lines:" ]]; then
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cargo publish --dry-run
- run: |
cargo publish -p agdb_derive --dry-run
cargo publish -p agdb --dry-run
new_version:
runs-on: ubuntu-latest
Expand All @@ -23,7 +25,7 @@ jobs:
- id: new_version
run: |
PUBLISHED_VERSION=$(cargo search ^agdb$ --limit 1 -q | head -n 1 | cut -d '"' -f 2)
CURRENT_VERSION=$(cat Cargo.toml | grep version | head -n 1 | cut -d '"' -f 2)
CURRENT_VERSION=$(cat agdb/Cargo.toml | grep version | head -n 1 | cut -d '"' -f 2)
if [[ "${PUBLISHED_VERSION}" != "${CURRENT_VERSION}" ]]; then echo "new_version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT; fi
echo "Published version: ${PUBLISHED_VERSION}"
echo "Current version: ${CURRENT_VERSION}"
Expand All @@ -50,6 +52,8 @@ jobs:
if: needs.new_version.outputs.new_version != ''
steps:
- uses: actions/checkout@v3
- run: cargo publish --token ${CRATES_IO_TOKEN}
- run: |
cargo publish -p agdb_derive --token ${CRATES_IO_TOKEN}
cargo publish -p agdb --token ${CRATES_IO_TOKEN}
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
db.agdb
.db.agdb
.db.agdb

lcov.info
4 changes: 4 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"command": "llvm-cov",
"args": [
"--workspace",
"--ignore-filename-regex",
"agdb_derive",
"--show-missing-lines"
],
"problemMatcher": [
Expand All @@ -44,6 +46,8 @@
"command": "llvm-cov",
"args": [
"--workspace",
"--ignore-filename-regex",
"agdb_derive",
"--html",
"--open"
],
Expand Down
21 changes: 5 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
[package]
name = "agdb"
version = "0.3.1"
edition = "2021"
license = "Apache-2.0"
homepage = "https://github.com/agnesoft/agdb"
repository = "https://github.com/agnesoft/agdb"
documentation = "https://github.com/agnesoft/agdb"
readme = "README.md"
description = "Agnesoft Graph Database"
keywords = ["graph", "database"]
categories = ["database", "database-implementations"]

[lib]
name = "agdb"
path = "src/agdb/lib.rs"
[workspace]
members = [
"agdb",
"agdb_derive",
]
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ The Agnesoft Graph Database (aka _agdb_) is persistent memory mapped graph datab
- ACID compliant
- [Object queries](docs/queries.md) with builder pattern (no text, no query language)
- Memory mapped for fast querying
- _No dependencies_

# Quickstart

Expand Down
17 changes: 17 additions & 0 deletions agdb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "agdb"
version = "0.3.1"
edition = "2021"
license = "Apache-2.0"
homepage = "https://github.com/agnesoft/agdb"
repository = "https://github.com/agnesoft/agdb"
documentation = "https://github.com/agnesoft/agdb"
readme = "../README.md"
description = "Agnesoft Graph Database"
keywords = ["graph", "database"]
categories = ["database", "database-implementations"]

[lib]

[dependencies]
agdb_derive = { version = "0.3.1", path = "../agdb_derive" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/agdb/lib.rs → agdb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mod utilities;
#[cfg(test)]
pub mod test_utilities;

pub use agdb_derive::DbUserValue;
pub use db::db_element::DbElement;
pub use db::db_error::DbError;
pub use db::db_id::DbId;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions tests/db_test.rs → agdb/tests/db_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod test_db;
use agdb::Db;
use agdb::DbElement;
use agdb::DbId;
use agdb::DbUserValue;
use agdb::QueryBuilder;
use agdb::QueryId;
use std::sync::Arc;
Expand All @@ -21,6 +22,7 @@ fn public_types() {
use agdb::DbKey;
use agdb::DbKeyOrder;
use agdb::DbKeyValue;
use agdb::DbUserValue;
use agdb::DbValue;
use agdb::InsertAliasesQuery;
use agdb::InsertEdgesQuery;
Expand Down Expand Up @@ -48,6 +50,14 @@ fn public_types() {
use agdb::TransactionMut;
}

#[test]
fn db_user_value() {
#[derive(DbUserValue)]
struct MyData {}

let _ = MyData {};
}

#[test]
fn data_persistence() {
let test_file = TestFile::new();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_db/mod.rs → agdb/tests/test_db/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[path = "../../src/agdb/test_utilities/test_file.rs"]
#[path = "../../src/test_utilities/test_file.rs"]
pub mod test_file;

use agdb::Db;
Expand Down
19 changes: 19 additions & 0 deletions agdb_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "agdb_derive"
version = "0.3.1"
edition = "2021"
license = "Apache-2.0"
homepage = "https://github.com/agnesoft/agdb"
repository = "https://github.com/agnesoft/agdb"
documentation = "https://github.com/agnesoft/agdb"
readme = "../README.md"
description = "Agnesoft Graph Database - derive macros"
keywords = ["graph", "database"]
categories = ["database", "database-implementations"]

[lib]
proc-macro = true

[dependencies]
quote = "1.0.32"
syn = "2.0.28"
6 changes: 6 additions & 0 deletions agdb_derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use proc_macro::TokenStream;

#[proc_macro_derive(DbUserValue)]
pub fn db_user_value_derive(_item: TokenStream) -> TokenStream {
TokenStream::new()
}

0 comments on commit e3676b6

Please sign in to comment.