Skip to content
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 42 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from 23 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 Aug 13, 2021
a6e1847
Add Makefile, GitHub Actions, PR and Issue templates
ilslv Aug 13, 2021
238058d
Add EventInitialized, EventSourced and InitialEvent
ilslv Aug 13, 2021
83f9911
Fix CI
ilslv Aug 13, 2021
f31ca0c
Finally check uniqueness of event_type() and ver() at compile-time!
ilslv Aug 16, 2021
42c5b4d
Add docs explaining unique checks macro shenanigans [skip ci]
ilslv Aug 16, 2021
7dfe985
Add ability to skip uniqueness check for event_type and ver for Event…
ilslv Aug 17, 2021
7df18ef
Add more tests
ilslv Aug 17, 2021
d454eaf
Final touches
ilslv Aug 17, 2021
c61e8bb
Use nightly toolchain on CI
ilslv Aug 17, 2021
32aec5d
Fix CI
ilslv Aug 17, 2021
aa8f2b4
Remove stable and beta toolchains in testing
ilslv Aug 17, 2021
e815e60
CHANGELOG
ilslv Aug 17, 2021
11107d1
Merge branch 'master' into 1-event-sourcing
tyranron Aug 17, 2021
b048ca1
Introduce EventName and EventVersion and support them in proc-macros
ilslv Aug 17, 2021
c6f1ff9
CHANGELOG
ilslv Aug 17, 2021
d7647b6
Merge branch 'master' into 1-event-sourcing
ilslv Aug 17, 2021
c477378
Some corrections [skip ci]
tyranron Aug 17, 2021
5166708
Merge remote-tracking branch 'origin/1-event-sourcing' into 1-event-s…
tyranron Aug 17, 2021
4bd1c85
Replace event_type() with name() everywhere [skip ci]
ilslv Aug 17, 2021
8bc5e8c
Add es feature-gates [skip ci]
ilslv Aug 17, 2021
418b233
Split derive and es feature-gates [skip ci]
ilslv Aug 17, 2021
683456b
Use arcana-core crate for arcana-codegen-impl docs [skip ci]
ilslv Aug 17, 2021
7a8ceb5
WIP [skip ci]
ilslv Aug 17, 2021
8a9b4ec
Cover Event derive macro with docs [skip ci]
ilslv Aug 17, 2021
32f233f
Cover VersionedEvent derive macro with docs [skip ci]
ilslv Aug 17, 2021
18a0c1a
Move events uniqueness check to arcana_codegen crate [skip ci]
ilslv Aug 18, 2021
de5edea
Use only required number of events in uniqueness check [skip ci]
ilslv Aug 20, 2021
fb0260a
Add arcana-codegen-shim [skip ci]
ilslv Aug 20, 2021
d74ae8e
Add MSRV check
ilslv Aug 23, 2021
eff3a0a
Fix CI
ilslv Aug 23, 2021
373d0c1
Remove safety_guard dependency
ilslv Aug 23, 2021
4ad217b
Some corrections [skip ci]
tyranron Aug 24, 2021
088db1a
Corrections
ilslv Aug 25, 2021
8cea01b
Correction
ilslv Aug 25, 2021
0a40645
Disable -Z minimal-versions for now on CI MSRV check
ilslv Aug 25, 2021
8a84f85
Some corrections [skip ci]
tyranron Aug 25, 2021
23306f4
Merge remote-tracking branch 'origin/1-event-sourcing' into 1-event-s…
tyranron Aug 25, 2021
2d2c92d
Try to support generics in internal uniqueness glue code
ilslv Aug 26, 2021
843cae5
Hide docs dependencies behind the feature
ilslv Aug 26, 2021
7685c03
Corrections
ilslv Aug 26, 2021
f522fcf
Corrections
tyranron Aug 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: CI

on: [push, pull_request]

env:
RUST_BACKTRACE: 1

jobs:

##########################
# Linting and formatting #
##########################

clippy:
if: ${{ github.ref == 'refs/heads/master'
|| startsWith(github.ref, 'refs/tags/v')
|| !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/v')
|| !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:
Copy link
Member

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.

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:
crate:
- arcana
- arcana-core
- arcana-codegen
- arcana-codegen-impl
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 }}




#################
# Documentation #
#################

docs:
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 open=no

- name: Finalize
run: |
CRATE_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]' | cut -f2 -d"/")
echo "<meta http-equiv=\"refresh\" content=\"0; url=${CRATE_NAME/-/_}\">" > target/doc/index.html
touch target/doc/.nojekyll
- name: Upload as artifact
uses: actions/upload-artifact@v2
with:
name: Documentation
path: target/doc
16 changes: 16 additions & 0 deletions .rustfmt.toml
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-nursery/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
30 changes: 30 additions & 0 deletions CHANGELOG.md
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
18 changes: 18 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "arcana"
version = "0.1.0"
edition = "2018"

[features]
default = ["derive", "es"]
derive = []
es = ["arcana-core/es"]

[dependencies]
arcana-core = { version = "0.1.0", path = "./core" }
arcana-codegen = { version = "0.1.0", path = "./codegen" }
static_assertions = "1.1"
once_cell = "1.8"

[workspace]
members = ["codegen", "codegen/impl", "core"]
88 changes: 88 additions & 0 deletions Makefile
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 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 fmt --all $(if $(call eq,$(check),yes),-- --check,)


# Lint Rust sources with Clippy.
#
# Usage:
# make cargo.lint

cargo.lint:
cargo clippy --workspace -- -D clippy::pedantic -D warnings




####################
# Testing commands #
####################

# Run Rust tests of project.
#
# Usage:
# make test [crate=<crate-name>]

test:
cargo test $(if $(call eq,$(crate),),--workspace,-p $(crate)) \
--all-features




##################
# .PHONY section #
##################

.PHONY: docs fmt lint test \
cargo.doc cargo.fmt cargo.lint
7 changes: 7 additions & 0 deletions codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "arcana-codegen"
version = "0.1.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 0.1.0-dev.

edition = "2018"

[dependencies]
arcana-codegen-impl = { version = "0.1.0", path = "./impl"}
2 changes: 2 additions & 0 deletions codegen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
arcana-codegen
==============
15 changes: 15 additions & 0 deletions codegen/impl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "arcana-codegen-impl"
version = "0.1.0"
edition = "2018"

[lib]
proc-macro = true

[dependencies]
arcana-core = { version = "0.1.0", path = "../../core" }
proc-macro2 = "1.0"
quote = "1.0"
strum = { version = "0.21", features = ["derive"] }
syn = "1.0"
synthez = "0.1"
2 changes: 2 additions & 0 deletions codegen/impl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
arcana-codegen-impl
===================
Loading