-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Events Handling (#1) #2
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
6697475
Basic project structure with Event and VersionedEvent impls
ilslv a6e1847
Add Makefile, GitHub Actions, PR and Issue templates
ilslv 238058d
Add EventInitialized, EventSourced and InitialEvent
ilslv 83f9911
Fix CI
ilslv f31ca0c
Finally check uniqueness of event_type() and ver() at compile-time!
ilslv 42c5b4d
Add docs explaining unique checks macro shenanigans [skip ci]
ilslv 7dfe985
Add ability to skip uniqueness check for event_type and ver for Event…
ilslv 7df18ef
Add more tests
ilslv d454eaf
Final touches
ilslv c61e8bb
Use nightly toolchain on CI
ilslv 32aec5d
Fix CI
ilslv aa8f2b4
Remove stable and beta toolchains in testing
ilslv e815e60
CHANGELOG
ilslv 11107d1
Merge branch 'master' into 1-event-sourcing
tyranron b048ca1
Introduce EventName and EventVersion and support them in proc-macros
ilslv c6f1ff9
CHANGELOG
ilslv d7647b6
Merge branch 'master' into 1-event-sourcing
ilslv c477378
Some corrections [skip ci]
tyranron 5166708
Merge remote-tracking branch 'origin/1-event-sourcing' into 1-event-s…
tyranron 4bd1c85
Replace event_type() with name() everywhere [skip ci]
ilslv 8bc5e8c
Add es feature-gates [skip ci]
ilslv 418b233
Split derive and es feature-gates [skip ci]
ilslv 683456b
Use arcana-core crate for arcana-codegen-impl docs [skip ci]
ilslv 7a8ceb5
WIP [skip ci]
ilslv 8a9b4ec
Cover Event derive macro with docs [skip ci]
ilslv 32f233f
Cover VersionedEvent derive macro with docs [skip ci]
ilslv 18a0c1a
Move events uniqueness check to arcana_codegen crate [skip ci]
ilslv de5edea
Use only required number of events in uniqueness check [skip ci]
ilslv fb0260a
Add arcana-codegen-shim [skip ci]
ilslv d74ae8e
Add MSRV check
ilslv eff3a0a
Fix CI
ilslv 373d0c1
Remove safety_guard dependency
ilslv 4ad217b
Some corrections [skip ci]
tyranron 088db1a
Corrections
ilslv 8cea01b
Correction
ilslv 0a40645
Disable -Z minimal-versions for now on CI MSRV check
ilslv 8a84f85
Some corrections [skip ci]
tyranron 23306f4
Merge remote-tracking branch 'origin/1-event-sourcing' into 1-event-s…
tyranron 2d2c92d
Try to support generics in internal uniqueness glue code
ilslv 843cae5
Hide docs dependencies behind the feature
ilslv 7685c03
Corrections
ilslv f522fcf
Corrections
tyranron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
tags: ["arcana-*"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
env: | ||
RUST_BACKTRACE: 1 | ||
|
||
jobs: | ||
|
||
########################## | ||
# Linting and formatting # | ||
########################## | ||
|
||
clippy: | ||
if: ${{ github.ref == 'refs/heads/master' | ||
|| startsWith(github.ref, 'refs/tags/arcana-') | ||
|| !contains(github.event.head_commit.message, '[skip ci]') }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
components: clippy | ||
|
||
- run: make cargo.lint | ||
|
||
rustfmt: | ||
if: ${{ github.ref == 'refs/heads/master' | ||
|| startsWith(github.ref, 'refs/tags/arcana-') | ||
|| !contains(github.event.head_commit.message, '[skip ci]') }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
components: rustfmt | ||
|
||
- run: make cargo.fmt check=yes | ||
|
||
|
||
|
||
|
||
########### | ||
# Testing # | ||
########### | ||
|
||
test: | ||
if: ${{ github.ref == 'refs/heads/master' | ||
|| startsWith(github.ref, 'refs/tags/arcana-') | ||
|| !contains(github.event.head_commit.message, '[skip ci]') }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
crate: | ||
- arcana-core | ||
- arcana-codegen-impl | ||
- arcana-codegen-shim | ||
- arcana-codegen | ||
- arcana | ||
os: | ||
- ubuntu | ||
- macOS | ||
- windows | ||
toolchain: | ||
- nightly | ||
runs-on: ${{ matrix.os }}-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.toolchain }} | ||
override: true | ||
|
||
- run: make test crate=${{ matrix.crate }} | ||
|
||
# TODO: MSRV currently has no sense since we sit on nightly Rust. | ||
# Re-enable once again on stable Rust. | ||
# msrv: | ||
# name: MSRV | ||
# if: ${{ github.ref == 'refs/heads/master' | ||
# || startsWith(github.ref, 'refs/tags/v') | ||
# || !contains(github.event.head_commit.message, '[skip ci]') }} | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# msrv: [ '1.54.0' ] | ||
# os: | ||
# - ubuntu | ||
# - macOS | ||
# - windows | ||
# runs-on: ${{ matrix.os }}-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - uses: actions-rs/toolchain@v1 | ||
# with: | ||
# profile: minimal | ||
# toolchain: nightly | ||
# - uses: actions-rs/toolchain@v1 | ||
# with: | ||
# profile: minimal | ||
# toolchain: ${{ matrix.msrv }} | ||
# override: true | ||
# | ||
# - run: cargo +nightly update -Z minimal-versions | ||
# | ||
# - run: make test | ||
|
||
|
||
|
||
|
||
################# | ||
# Documentation # | ||
################# | ||
|
||
rustdoc: | ||
if: ${{ github.ref == 'refs/heads/master' | ||
|| startsWith(github.ref, 'refs/tags/arcana-') | ||
|| !contains(github.event.head_commit.message, '[skip ci]') }} | ||
strategy: | ||
matrix: | ||
crate: | ||
- arcana-core | ||
- arcana-codegen-impl | ||
- arcana-codegen-shim | ||
- arcana-codegen | ||
- arcana | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: nightly | ||
override: true | ||
|
||
- run: make cargo.doc crate=${{ matrix.crate }} open=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Project configuration for rustfmt Rust code formatter. | ||
# See full list of configurations at: | ||
# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md | ||
|
||
max_width = 80 | ||
format_strings = false | ||
imports_granularity = "Crate" | ||
|
||
format_code_in_doc_comments = true | ||
format_macro_matchers = true | ||
use_try_shorthand = true | ||
|
||
error_on_line_overflow = true | ||
error_on_unformatted = true | ||
|
||
unstable_features = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
`arcana` changelog | ||
=================== | ||
|
||
All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0]. | ||
|
||
|
||
|
||
|
||
## [0.1.0] · 2021-06-25 | ||
[0.1.0]: /../../tree/v0.1.0 | ||
|
||
### Initially implemented | ||
|
||
- Events | ||
- Traits | ||
- `Event` | ||
- `VersionedEvent` | ||
- `EventSourced` | ||
- `EventInitialised` | ||
- Structs | ||
- `InitialEvent` wrapper | ||
- `EventVersion` | ||
- Proc macros | ||
- `Event` derive | ||
- `VersionedEvent` derive | ||
|
||
|
||
|
||
|
||
[Semantic Versioning 2.0.0]: https://semver.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[package] | ||
name = "arcana" | ||
version = "0.1.0-dev" | ||
edition = "2018" | ||
resolver = "2" | ||
description = "Opionated CQRS/ES framework with type magic." | ||
authors = [ | ||
"Ilya Solovyiov <[email protected]>", | ||
"Kai Ren <[email protected]>", | ||
] | ||
documentation = "https://docs.rs/arcana-core" | ||
homepage = "https://github.com/arcana-rs/arcana" | ||
repository = "https://github.com/arcana-rs/arcana" | ||
readme = "README.md" | ||
|
||
[features] | ||
doc = ["arcana-codegen/doc"] # only for generating documentation | ||
derive = ["arcana-codegen"] | ||
es = ["arcana-core/es"] | ||
|
||
[dependencies] | ||
arcana-core = { version = "0.1.0-dev", path = "./core" } | ||
arcana-codegen = { version = "0.1.0-dev", path = "./codegen", optional = true } | ||
|
||
[[example]] | ||
name = "event" | ||
required-features = ["derive", "es"] | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
||
[workspace] | ||
members = ["codegen", "codegen/impl", "codegen/shim", "core"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
############################### | ||
# Common defaults/definitions # | ||
############################### | ||
|
||
comma := , | ||
|
||
# Checks two given strings for equality. | ||
eq = $(if $(or $(1),$(2)),$(and $(findstring $(1),$(2)),\ | ||
$(findstring $(2),$(1))),1) | ||
|
||
|
||
|
||
|
||
########### | ||
# Aliases # | ||
########### | ||
|
||
docs: cargo.doc | ||
|
||
|
||
fmt: cargo.fmt | ||
|
||
|
||
lint: cargo.lint | ||
|
||
|
||
|
||
|
||
################## | ||
# Cargo commands # | ||
################## | ||
|
||
# Generate crates documentation from Rust sources. | ||
# | ||
# Usage: | ||
# make cargo.doc [crate=<crate-name>] [open=(yes|no)] [clean=(no|yes)] | ||
|
||
cargo.doc: | ||
ifeq ($(clean),yes) | ||
@rm -rf target/doc/ | ||
endif | ||
cargo +nightly doc $(if $(call eq,$(crate),),--workspace,-p $(crate)) \ | ||
--all-features \ | ||
$(if $(call eq,$(open),no),,--open) | ||
|
||
|
||
# Format Rust sources with rustfmt. | ||
# | ||
# Usage: | ||
# make cargo.fmt [check=(no|yes)] | ||
|
||
cargo.fmt: | ||
cargo +nightly fmt --all $(if $(call eq,$(check),yes),-- --check,) | ||
|
||
|
||
# Lint Rust sources with Clippy. | ||
# | ||
# Usage: | ||
# make cargo.lint | ||
|
||
cargo.lint: | ||
cargo +nightly clippy --workspace -- -D clippy::pedantic -D warnings | ||
|
||
|
||
|
||
|
||
#################### | ||
# Testing commands # | ||
#################### | ||
|
||
# Run Rust tests of project. | ||
# | ||
# Usage: | ||
# make test [crate=<crate-name>] | ||
|
||
test: | ||
cargo +nightly test $(if $(call eq,$(crate),),--workspace,-p $(crate)) \ | ||
--all-features | ||
|
||
|
||
|
||
|
||
################## | ||
# .PHONY section # | ||
################## | ||
|
||
.PHONY: docs fmt lint test \ | ||
cargo.doc cargo.fmt cargo.lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[package] | ||
name = "arcana-codegen" | ||
version = "0.1.0-dev" | ||
edition = "2018" | ||
resolver = "2" | ||
description = "Code generation for `arcana` crate." | ||
authors = [ | ||
"Ilya Solovyiov <[email protected]>", | ||
"Kai Ren <[email protected]>", | ||
] | ||
documentation = "https://docs.rs/arcana-codegen" | ||
homepage = "https://github.com/arcana-rs/arcana/tree/master/codegen" | ||
repository = "https://github.com/arcana-rs/arcana" | ||
readme = "README.md" | ||
|
||
[features] | ||
doc = ["arcana-codegen-shim/doc", "arcana-core"] # only for generating documentation | ||
|
||
[dependencies] | ||
arcana-codegen-shim = { version = "0.1.0-dev", path = "./shim" } | ||
static_assertions = { version = "1.1", default-features = false } | ||
|
||
# `doc` feature | ||
arcana-core = { version = "0.1.0-dev", path = "../core", features = ["es"], optional = true } | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
arcana-codegen | ||
============== | ||
|
||
Code generation for [`arcana`] crate. | ||
|
||
DO NOT use it directly, use [`arcana`] crate instead. | ||
|
||
If you want to reuse [`arcana-codegen`] inner machinery in your own [proc macro][1] crate, then consider to use [`arcana-codegen-impl`] crate also. | ||
|
||
|
||
|
||
|
||
|
||
[`arcana`]: https://docs.rs/arcana | ||
[`arcana-codegen`]: https://docs.rs/arcana-codegen | ||
[`arcana-codegen-impl`]: https://docs.rs/arcana-codegen-impl | ||
|
||
[1]: https://doc.rust-lang.org/reference/procedural-macros.html |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also let's add tests for MSRV (minimum supported Rust version) from the start.