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

Projections #46

Merged
merged 63 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
1d91c51
Copy Projections structure from EventHandlers
jakhog Mar 22, 2021
071c7ca
Add state of projections (represented as a JSON string).
jakhog Mar 22, 2021
f4a3593
Add event key selection specification.
jakhog Mar 22, 2021
b8e39a2
Yes we should have support for scoped projections.
jakhog Mar 22, 2021
7e006f7
Format and add projection prerelease
woksin Mar 23, 2021
b8a640c
Don't add to changelog on prereleases
woksin Mar 23, 2021
7830231
Add initial state to registering, letting head know if projection was…
jakhog Mar 24, 2021
605ff3b
Move ProjectionEventKeySelector out to own type (looks nicer)
jakhog Mar 24, 2021
62f1149
rename ProjectionEventSpecification -> ProjectionEventSelector
jakhog Mar 24, 2021
7a8e341
Fix mistake
jakhog Mar 24, 2021
097d314
We haven't added support for "optional" in the build pipelines yet - …
jakhog Mar 24, 2021
2e610c3
Merge pull request #34 from dolittle/projections
woksin Mar 24, 2021
5236e9d
Update Protobuf package reference, and remove "npx ..." from scripts
jakhog Mar 24, 2021
e96693c
Re-set package versions to 0.0.0 (to be set while publishing)
jakhog Mar 24, 2021
f81cadd
Add back JS build and publishing to GitHub workflow
jakhog Mar 24, 2021
d8d242f
Merge pull request #35 from dolittle/fix-js-contracts-release
jakhog Mar 24, 2021
7c01f4d
A little quick on the trigger there - fix workflow syntax.
jakhog Mar 24, 2021
de7e9b5
Only parse semver if we get a version
jakhog Mar 24, 2021
847bec0
Merge pull request #36 from dolittle/fix-bug-in-js-release
woksin Mar 24, 2021
5d478c9
Split out JS-build + add publish token
jakhog Mar 24, 2021
f612456
Simplify publish checks for JS
jakhog Mar 24, 2021
ee25684
Merge pull request #37 from dolittle/fix-the-fix
jakhog Mar 24, 2021
8eae5e5
Fix little typo
jakhog Mar 25, 2021
9e6b037
Add the "calculated" key to the ProjectionRequest
jakhog Mar 25, 2021
69f4666
Merge pull request #38 from dolittle/fix-some-small-things
jakhog Mar 25, 2021
2fc4c00
Move CSharp projects into its own directory
jakhog Mar 27, 2021
504054f
Move JavaScript to its own directory
jakhog Mar 27, 2021
bc6fce4
Fix tsconfig.jsons
jakhog Mar 27, 2021
67ad292
Use right dependencies
jakhog Mar 27, 2021
37a5274
Fix package.json config
jakhog Mar 27, 2021
a01ba91
Update workflow to work with new generated contracts
jakhog Mar 27, 2021
9e14cd7
Fix moved CSharp directories
jakhog Mar 27, 2021
1439989
Try node version 14 for fs/promises
jakhog Mar 27, 2021
b17c6de
Add go_package to protofiles
jakhog Mar 27, 2021
97140f1
Add a Go build job (just to see if we have sed)
jakhog Mar 27, 2021
db5d80e
Add go generate.sh script
jakhog Mar 27, 2021
2f7b939
Allow generation when not publishing
jakhog Mar 27, 2021
3d106af
Bail out on failure
jakhog Mar 27, 2021
788a999
Install protoc
jakhog Mar 27, 2021
8258a5b
Install protoc plugins
jakhog Mar 27, 2021
8eb9a14
Test checking out other repository in workflow
jakhog Mar 27, 2021
b6b4ec1
Add Go release job
jakhog Mar 27, 2021
cf4a9c3
Merge pull request #39 from dolittle/cleanup-generation
jakhog Mar 27, 2021
5765813
Add GitHub token for Go.Contracts
jakhog Mar 27, 2021
1cd9370
Change workflow to only release code if all builds succeeded
jakhog Mar 27, 2021
516dcb7
Merge pull request #40 from dolittle/fix-go-release
jakhog Mar 27, 2021
67a641c
Fix JS release
jakhog Mar 27, 2021
99492b3
Merge pull request #41 from dolittle/fix-js-release
jakhog Mar 27, 2021
ef4174f
Delete directories when cleaning out Go code
jakhog Mar 27, 2021
ec60036
Merge pull request #42 from dolittle/fix-go-release-to-work-more-than…
jakhog Mar 27, 2021
66d97e8
Allow empty commits when releasing Go
jakhog Mar 27, 2021
6632b52
Merge pull request #43 from dolittle/allow-unchanged-go-releases
jakhog Mar 28, 2021
f33cf53
First iteration for getting projections
woksin Mar 29, 2021
db48e82
Add missing import
woksin Mar 29, 2021
f910726
GetOne GetAll
woksin Mar 29, 2021
8f11c80
Merge pull request #44 from dolittle/get-projection
woksin Mar 29, 2021
d74dea1
Move projection Key from Request -> CurrentState
jakhog Apr 7, 2021
4b5132b
It has become somewhat of a convention for the failure to go last.
jakhog Apr 7, 2021
8800f36
Move the CurrentState over to Projections + rename some files
jakhog Apr 7, 2021
2b5b27b
One missing newline forcing me to fix everywhere
jakhog Apr 7, 2021
1a1531a
Merge pull request #45 from dolittle/add-projection-key-to-states
woksin Apr 7, 2021
f6295b5
Changed enums to oneofs
jakhog Apr 8, 2021
b48d8bb
Merge pull request #47 from dolittle/change-enums-to-oneofs
jakhog Apr 8, 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
252 changes: 161 additions & 91 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Contracts CI/CD

env:
PRERELEASE_BRANCHES: alpha,beta,rc,updategrpc # Comma separated list of prerelease branch names. 'alpha,rc, ...'
PRERELEASE_BRANCHES: alpha,beta,rc,projections # Comma separated list of prerelease branch names. 'alpha,rc, ...'

on:
push:
branches:
- '**'
- "**"
pull_request:
types: [closed]

Expand All @@ -19,124 +19,194 @@ jobs:
pr-body: ${{ steps.context.outputs.pr-body }}
pr-url: ${{ steps.context.outputs.pr-url }}
version: ${{ steps.increment-version.outputs.next-version }}

release-type: ${{ steps.context.outputs.release-type }}
steps:
- uses: actions/checkout@v2
- name: Establish context
id: context
uses: dolittle/establish-context-action@v2 # Replace with ./ if used withing dolittle/establish-context-action
with:
prerelease-branches: ${{ env.PRERELEASE_BRANCHES }}
- name: Increment version
id: increment-version
if: ${{ steps.context.outputs.should-publish == 'true' }}
uses: dolittle/increment-version-action@v2 # Replace with ./ if used withing dolittle/increment-version-action
with:
version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}
- uses: actions/checkout@v2
- name: Establish context
id: context
uses: dolittle/establish-context-action@v2
with:
prerelease-branches: ${{ env.PRERELEASE_BRANCHES }}
- name: Increment version
id: increment-version
if: ${{ steps.context.outputs.should-publish == 'true' }}
uses: dolittle/increment-version-action@v2
with:
version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}

dot-net-build:
name: .Net Build
runs-on: ubuntu-latest
needs: context

steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: "3.1.x"
- run: dotnet build -c Release
working-directory: ./Generation/CSharp

release:
name: Release
java-script-build:
name: JavaScript Build
runs-on: ubuntu-latest
needs: [dot-net-build, context]
if: ${{ needs.context.outputs.should-publish == 'true' }}

needs: context
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
working-directory: ./Generation/JavaScript
run: yarn
- name: Build Fundamentals
working-directory: ./Generation/JavaScript/Fundamentals
run: yarn build
- name: Build Runtime
working-directory: ./Generation/JavaScript/Runtime
run: yarn build

golang-build:
name: Go Build
runs-on: ubuntu-latest
needs: context
steps:
- uses: actions/checkout@v2
- name: Prepend to Changelog
uses: dolittle/add-to-changelog-action@v2
- uses: actions/setup-go@v2
with:
version: ${{ needs.context.outputs.version }}
body: ${{ needs.context.outputs.pr-body }}
pr-url: ${{ needs.context.outputs.pr-url }}
changelog-path: CHANGELOG.md
user-email: build@dolittle.com
user-name: dolittle-build
- name: Create GitHub Release
uses: dolittle/github-release-action@v2 # Replace with ./ if used withing dolittle/github-release-action
go-version: '1.16.2'
- uses: arduino/setup-protoc@v1
with:
version: ${{ needs.context.outputs.version }}
body: ${{ needs.context.outputs.pr-body }}
version: '3.15.6'
- run: go get google.golang.org/protobuf/cmd/protoc-gen-go google.golang.org/grpc/cmd/protoc-gen-go-grpc
- name: Generate code
working-directory: ./Generation/Go
run: ./generate.sh ${{ needs.context.outputs.version }}

release:
name: Release
runs-on: ubuntu-latest
needs: [context, dot-net-build, java-script-build, golang-build]
if: ${{ needs.context.outputs.should-publish == 'true' }}
steps:
- uses: actions/checkout@v2
- name: Prepend to Changelog
if: ${{ needs.context.outputs.should-publish == 'true' && needs.context.outputs.release-type != 'prerelease' }}
uses: dolittle/add-to-changelog-action@v2
with:
version: ${{ needs.context.outputs.version }}
body: ${{ needs.context.outputs.pr-body }}
pr-url: ${{ needs.context.outputs.pr-url }}
changelog-path: CHANGELOG.md
user-email: build@dolittle.com
user-name: dolittle-build
- name: Create GitHub Release
uses: dolittle/github-release-action@v2
with:
version: ${{ needs.context.outputs.version }}
body: ${{ needs.context.outputs.pr-body }}

dot-net-release:
name: .Net Release
runs-on: ubuntu-latest
needs: [context, dot-net-build]
needs: [context, release]
if: ${{ needs.context.outputs.should-publish == 'true' }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: "3.1.x"
- run: dotnet build
working-directory: ./Generation/CSharp
- name: Create packages
working-directory: ./Generation/CSharp
run: dotnet pack --configuration Release -o Artifacts/NuGet /p:PackageVersion=${{ needs.context.outputs.version }} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:NoDefaultExcludes=true
- name: Push NuGet packages
working-directory: ./Generation/CSharp
run: dotnet nuget push 'Artifacts/NuGet/*.nupkg' --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

# java-script:
# name: JavaScript
# runs-on: ubuntu-latest
# needs: context

# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 12.x
# - uses: arduino/setup-protoc@master
# with:
# version: '3.11.2'

# - name: Install dependencies
# working-directory: ./Generation
# run: yarn

# - name: Build Fundamentals
# working-directory: ./Generation/Fundamentals/JavaScript
# run: yarn build
# - name: Build Fundamentals Web
# working-directory: ./Generation/Fundamentals/JavaScript.Web
# run: yarn build
# - name: Build Runtime
# working-directory: ./Generation/Runtime/JavaScript
# run: yarn build
# - name: Build Runtime Web
# working-directory: ./Generation/Runtime/JavaScript.Web
# run: yarn build

# - name: Publish Fundamentals
# if: ${{ success() && needs.context.outputs.should-publish == 'true' }}
# working-directory: ./Generation/Fundamentals/JavaScript
# run: yarn publish --new-version ${{ needs.context.outputs.version }} --no-git-tag-version
# - name: Publish Fundamentals Web
# if: ${{ success() && needs.context.outputs.should-publish == 'true' }}
# working-directory: ./Generation/Fundamentals/JavaScript.Web
# run: yarn publish --new-version ${{ needs.context.outputs.version }} --no-git-tag-version
# - name: Publish Runtime
# if: ${{ success() && needs.context.outputs.should-publish == 'true' }}
# working-directory: ./Generation/Runtime/JavaScript
# run: yarn publish --new-version ${{ needs.context.outputs.version }} --no-git-tag-version
# - name: Publish Runtime Web
# if: ${{ success() && needs.context.outputs.should-publish == 'true' }}
# working-directory: ./Generation/Runtime/JavaScript.Web
# run: yarn publish --new-version ${{ needs.context.outputs.version }} --no-git-tag-version

# - name: Create Pull Request
# if: ${{ success() && needs.context.outputs.should-publish == 'true' }}
# uses: peter-evans/create-pull-request@v2
# with:
# title: Bump package.json versions to ${{ needs.context.outputs.version }}
java-script-release:
name: JavaScript Release
runs-on: ubuntu-latest
needs: [context, release]
if: ${{ needs.context.outputs.should-publish == 'true' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
working-directory: ./Generation/JavaScript
run: yarn
- name: Build Fundamentals
working-directory: ./Generation/JavaScript/Fundamentals
run: yarn build
- name: Update Fundamentals version
working-directory: ./Generation/JavaScript/Fundamentals
run: npm version ${{ needs.context.outputs.version }}
- name: Build Runtime
working-directory: ./Generation/JavaScript/Runtime
run: yarn build
- name: Add Fundamentals as dependency of Runtime
working-directory: ./Generation/JavaScript/Runtime
run: jq '.dependencies["@dolittle/contracts"] = "${{ needs.context.outputs.version }}"' package.json > package.json.tmp && mv package.json.tmp package.json
- name: Update Runtime version
working-directory: ./Generation/JavaScript/Runtime
run: npm version ${{ needs.context.outputs.version }}
- name: Extract tag from version
uses: actions-ecosystem/action-regex-match@v2
id: tag_regex
with:
text: ${{ needs.context.outputs.version }}
regex: '^\d+\.\d+.\d+-([^.]+)\.\d+$'
- name: Publish Fundamentals
working-directory: ./Generation/JavaScript/Fundamentals
run: npm publish --tag ${{ needs.context.outputs.release-type == 'prerelease' && steps.tag_regex.outputs.group1 || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Runtime
working-directory: ./Generation/JavaScript/Runtime
run: npm publish --tag ${{ needs.context.outputs.release-type == 'prerelease' && steps.tag_regex.outputs.group1 || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

golang-release:
name: Go Release
runs-on: ubuntu-latest
needs: [context, release]
if: ${{ needs.context.outputs.should-publish == 'true' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.2'
- uses: arduino/setup-protoc@v1
with:
version: '3.15.6'
- run: go get google.golang.org/protobuf/cmd/protoc-gen-go google.golang.org/grpc/cmd/protoc-gen-go-grpc
- name: Generate code
working-directory: ./Generation/Go
run: ./generate.sh ${{ needs.context.outputs.version }}
- uses: actions/checkout@v2
with:
repository: dolittle/Go.Contracts
token: ${{ secrets.BUILD_PAT }}
path: ./Generation/Go/output
- name: Cleanout old released code
working-directory: ./Generation/Go/output
run: rm -r * && git checkout -- README.md LICENSE
- name: Copy new generated code
working-directory: ./Generation/Go/
run: cp -r generated/* output
- name: Commit new generated code and tag as release
working-directory: ./Generation/Go/output
run: |
git config user.name "Contracts Release GitHub Actions"
git config user.email "contracts-release@dolittle.com"
git add .
git commit --allow-empty -m "Generated code for ${{ needs.context.outputs.version }}"
git tag "v${{ needs.context.outputs.version }}"
git push
git push --tags
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,12 @@ package-json.lock
*.cs
*.ts

Generation/**/*.js
Generation/**/*.ts
Generation/**/*.d.ts
!Source/**/Artifacts

!Source/**/Artifacts
Generation/JavaScript/Fundamentals/**
Generation/JavaScript/Runtime/**
!Generation/JavaScript/**/package.json
!Generation/JavaScript/**/tsconfig.json

Generation/Go/*
!Generation/Go/generate.sh
60 changes: 0 additions & 60 deletions Contracts.sln

This file was deleted.

Loading