Skip to content

Commit

Permalink
Merge a4255f9 into cbefbc9
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed May 1, 2021
2 parents cbefbc9 + a4255f9 commit 2de6f79
Show file tree
Hide file tree
Showing 210 changed files with 2,251 additions and 1,996 deletions.
29 changes: 16 additions & 13 deletions .gitattributes
@@ -1,17 +1,20 @@
* text=auto

/.github export-ignore
.php_cs export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
run-tests.sh export-ignore
phpstan.neon export-ignore
phpunit.xml.dist export-ignore
README.md export-ignore
/src/Integration/ export-ignore
/src/CodeGeneration/Fixtures/ export-ignore
**/*Test.php export-ignore
**/*Stub.php export-ignore
**/*Tests export-ignore
/build export-ignore
/.php_cs export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/run-tests.sh export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
/README.md export-ignore
/src/LibraryConsumptionTests/ export-ignore
/src/TestUtilities/ export-ignore
/src/CodeGeneration/ export-ignore
/**/*Test.php export-ignore
/**/*Stub.php export-ignore
/**/Dummy*.php export-ignore
/docs export-ignore
/**/*Tests export-ignore
31 changes: 31 additions & 0 deletions .github/workflows/publish-subsplits.yml
@@ -0,0 +1,31 @@
---
name: Sub-Split Publishing
on:
push:
branches:
- version/1.0.0

jobs:
publish_subsplits:
runs-on: ubuntu-latest
name: Publish package sub-splits
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
persist-credentials: 'false'
- uses: actions/cache@v2
id: splitsh
with:
path: build/splitsh-lite
key: ${{ runner.os }}-splitsh-lite
- name: install split.sh
if: steps.splitsh.outputs.cache-hit != 'true'
run: build/install-split.sh
- uses: frankdejonge/use-github-token@1.0.1
with:
authentication: 'frankdejonge:${{ secrets.PERSONAL_ACCESS_TOKEN }}'
user_name: 'Frank de Jonge'
user_email: 'info@frenky.net'
- name: Publish subsplits
run: build/split.sh
9 changes: 3 additions & 6 deletions .github/workflows/tests.yml
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4, 8.0]
php: [8.0]
stability: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
Expand All @@ -32,11 +32,8 @@ jobs:
- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

# - name: Run PHP CS Fixer
# if: ${{ matrix.php != 8.0 }}
# run: |
# composer require friendsofphp/php-cs-fixer:^2.15 --dev --prefer-dist --no-interaction --no-progress --update-with-all-dependencies
# vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no
- name: Run PHP CS Fixer
run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no

- name: Run PHPStan
run: vendor/bin/phpstan analyze -c phpstan.neon
Expand Down
15 changes: 8 additions & 7 deletions .gitignore
@@ -1,7 +1,8 @@
vendor/
.php_cs.cache
coverage/
coverage.xml
composer.lock
.idea/
.phpunit.result.cache
/vendor/
/.php_cs.cache
/.phpunit.result.cache
/coverage/
/coverage.xml
/composer.lock
/.idea/
/docs/vendor/
6 changes: 6 additions & 0 deletions .php_cs
Expand Up @@ -13,7 +13,13 @@ return PhpCsFixer\Config::create()
'not_operator_with_space' => true,
'return_type_declaration' => true,
'phpdoc_to_return_type' => true,
'binary_operator_spaces' => false,
'php_unit_method_casing' => ['case' => 'snake_case'],
'void_return' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['const', 'class', 'function'],
],
])
->setRiskyAllowed(true)
->setFinder($finder);
1 change: 1 addition & 0 deletions build/.gitignore
@@ -0,0 +1 @@
splitsh-lite
18 changes: 18 additions & 0 deletions build/install-split.sh
@@ -0,0 +1,18 @@
unameOut="$(uname -s)"
version="v1.0.1"

case "${unameOut}" in
Linux*) url="https://github.com/splitsh/lite/releases/download/${version}/lite_linux_amd64.tar.gz";;
Darwin*) url="https://github.com/splitsh/lite/releases/download/${version}/lite_darwin_amd64.tar.gz";;
*) url=unknown
esac

if [ "${url}" == "unknown" ]; then
echo "FAILED";
exit 1;
fi

wget -O build/split-lite.tar.gz "${url}"
tar -zxpf build/split-lite.tar.gz --directory ./build/
chmod +x build/splitsh-lite
rm build/split-lite.tar.gz
7 changes: 7 additions & 0 deletions build/readme.md
@@ -0,0 +1,7 @@
If you can't run this file on Catalina, run:

```bash
xattr -d com.apple.quarantine ./build/splitsh-lite
```

For more information, checkout https://github.com/splitsh/lite
72 changes: 72 additions & 0 deletions build/release.sh
@@ -0,0 +1,72 @@
#!/usr/bin/env bash

set -e

# Make sure the release tag is provided.
if (( "$#" != 1 ))
then
echo "Tag has to be provided."
exit 1
fi

RELEASE_BRANCH="master"
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
VERSION=$1

# Make sure current branch and release branch match.
if [[ "$RELEASE_BRANCH" != "$CURRENT_BRANCH" ]]
then
echo "Release branch ($RELEASE_BRANCH) does not match the current active branch ($CURRENT_BRANCH)."
exit 1
fi

# Make sure the working directory is clear.
if [[ ! -z "$(git status --porcelain)" ]]
then
echo "Your working directory is dirty. Did you forget to commit your changes?"
exit 1
fi

# Make sure latest changes are fetched first.
git fetch origin

# Make sure that release branch is in sync with origin.
if [[ $(git rev-parse HEAD) != $(git rev-parse origin/$RELEASE_BRANCH) ]]
then
echo "Your branch is out of date with its upstream. Did you forget to pull or push any changes before releasing?"
exit 1
fi

# Strip prepended "v", if present
if [[ $VERSION == v* || $VERSION == V* ]]
then
VERSION="${VERSION:1}"
fi

# Tag Core
git tag $VERSION
git push origin --tags

# Tag Components
for REMOTE in CodeGeneration TestUtilities
do
echo ""
echo ""
echo "Releasing $REMOTE";

TMP_DIR="/tmp/eventsauce-split"
REMOTE_URL="git@github.com:EventSaucePHP/$REMOTE.git"

rm -rf $TMP_DIR;
mkdir $TMP_DIR;

(
cd $TMP_DIR;

git clone $REMOTE_URL .
git checkout "$RELEASE_BRANCH";

git tag $VERSION
git push origin --tags
)
done
30 changes: 30 additions & 0 deletions build/split.sh
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -e
set -x


if [ ! -f "./build/splitsh-lite" ]; then
bash build/install-split.sh
fi

CURRENT_BRANCH="version/1.0.0"

function split()
{
SHA1=`./build/splitsh-lite --prefix=$1 --origin=origin/$CURRENT_BRANCH`
git push $2 "$SHA1:refs/heads/$CURRENT_BRANCH" -f
}

function remote()
{
git remote add $1 $2 || true
}

git pull origin $CURRENT_BRANCH

remote CodeGeneration git@github.com:EventSaucePHP/CodeGeneration.git
remote TestUtilities git@github.com:EventSaucePHP/TestUtilities.git

split 'src/CodeGeneration' CodeGeneration
split 'src/TestUtilities' TestUtilities
19 changes: 13 additions & 6 deletions composer.json
@@ -1,22 +1,29 @@
{
"name": "eventsauce/eventsauce",
"type": "library",
"description": "Event sourcing library.",
"description": "A pragmatic event sourcing library for PHP with a focus on developer experience.",
"license": "MIT",
"authors": [
{
"name": "Frank de Jonge",
"email": "info@frenky.net"
}
],
"suggest": {
"eventsauce/code-generation": "Code generation for EventSauce",
"eventsauce/test-utilities": "Base test tooling for testing aggregates",
"eventsauce/doctrine-message-repository": "Doctrine implementation of the message repository"
},
"require": {
"php": "^7.2|^8.0",
"ramsey/uuid": "^3|^4",
"symfony/yaml": "^4.0|^5.0"
"php": "^8.0",
"eventsauce/clock": "^1.0"
},
"require-dev": {
"phpstan/phpstan": "^0.12.52",
"phpunit/phpunit": "^8.5|^9.4"
"phpstan/phpstan": "^0.12.83",
"phpunit/phpunit": "^9.4",
"symfony/yaml": "^5.0",
"friendsofphp/php-cs-fixer": "^2.18.4",
"ramsey/uuid": "^4.1"
},
"autoload": {
"psr-4": {
Expand Down
23 changes: 12 additions & 11 deletions docs/_layouts/leader.html
Expand Up @@ -86,10 +86,15 @@ <h2 class="text-3xl text-white leading-tight mb-2">
<h2 class="text-3xl text-black mb-2">
Expressive Testing
</h2>
<p class="text-grey-darker text-lg mx-auto max-w-sm">
<p class="text-grey-darker text-lg mb-2 mx-auto max-w-sm">
Scenario based testing provides an expressive way to
ensure business requirements are met.
</p>
<p class="text-grey-darker text-lg mx-auto max-w-sm">
An event-driven modeling technique allows for a BDD-style
test setup. This technique allows you to use events to
setup your aggregate and assert desired outcome.
</p>
</div>
</section>
<section class="md:w-1/2 lg:w-3/5 border-b border-t md:border-l border-grey-light md:rounded-l-lg bg-white">
Expand All @@ -100,20 +105,16 @@ <h2 class="text-3xl text-black mb-2">

class MyEventSourcedTest extends AggregateRootTestCase
{
public function test_event_sourcing()
public function submitting_a_bank_account_for_approval()
{
$iban = 'NL91ABCD0123123400';

$this->given(
new DeveloperLikesEventSourcing(),
new DeveloperLearnedAboutEventSauce(),
new OnboardingHasStarted()
)->when(
new StartsUsingEventSauce(
$this->aggregateRootId()
)
new SubmitBankAccountForApproval($iban)
)->then(
new UsingEventSauceWasVeryEffective(),
new DeveloperAcquiredNewSkill(
AcquiredSkill::eventSourcing()
)
new BankAccountWasSubmittedForApproval($iban)
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/advanced/custom-dispatcher.md
Expand Up @@ -15,7 +15,7 @@ namespace EventSauce\EventSourcing;

interface MessageDispatcher
{
public function dispatch(Message ... $messages);
public function dispatch(Message ... $messages): void;
}
```

Expand Down
7 changes: 4 additions & 3 deletions docs/docs/advanced/custom-repository.md
Expand Up @@ -2,7 +2,7 @@
permalink: /docs/advanced/custom-repository/
title: Custom Message Repository
published_at: 2018-03-07
updated_at: 2019-11-09
updated_at: 2019-12-21
---

You can create a custom implementation of the message repository if needed. Your
Expand All @@ -17,8 +17,9 @@ use Generator;

interface MessageRepository
{
public function persist(Message ... $messages);
public function persist(Message ... $messages): void;
public function retrieveAll(AggregateRootId $id): Generator;
public function retrieveAllAfterVersion(AggregateRootId $id, int $aggregateRootVersion): Generator;
}
```

Expand All @@ -44,7 +45,7 @@ class FilesystemMessageRepository implements MessageRepository
$this->serializer = $serializer ?: new ConstructingMessageSerializer();
}

public function persist(Message ... $messages)
public function persist(Message ... $messages): void
{
foreach ($messages as $message) {
$aggregateRootId = $message->header(Header::AGGREGATE_ROOT_ID);
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/advanced/database-structure.md
Expand Up @@ -2,7 +2,7 @@
permalink: /docs/advanced/database-structure/
title: Database Structure
published_at: 2019-08-01
updated_at: 2019-11-09
updated_at: 2019-12-21
---

Storing events for reconstitution should be done in any type queryable data store. It needs
Expand Down

0 comments on commit 2de6f79

Please sign in to comment.