Skip to content

Commit

Permalink
Refactor constants into shared library project (#64)
Browse files Browse the repository at this point in the history
* Refactor SocialMediaMessage to shared Dapr.Test.Common.Models

* #57
Moved class to models folder

* #61
Move hashtag and constants to shared library

* Add docker-compose for CI

* Refactor SocialMediaMessage to shared Dapr.Test.Common.Models

* #57
Moved class to models folder

* #61
Move hashtag and constants to shared library

* Add docker-compose for CI

* Rebase from master

* Cleanup project dependencies

* Align docker-compose with ci build

* Adding non-ci github workflow

* Fix typo

* Downgraded docker-compose schema from 3.8 to 3.3

* fix ci validation-worker

* Add missing MIT licenses

Co-authored-by: lolorol <[email protected]>
  • Loading branch information
LaurentLesle and LaurentLesle authored May 26, 2020
1 parent 383d741 commit 80b3440
Show file tree
Hide file tree
Showing 34 changed files with 473 additions and 297 deletions.
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
3 changes: 2 additions & 1 deletion .github/workflows/feed-generator-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: Build feed-generator app docker image
run: |
docker build -t ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }} ${{ env.APP_DIR }}
docker-compose build ${{ env.APP_IMAGE_NAME }}
docker tag ${{ env.APP_IMAGE_NAME }} ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }}
- name: Push feed-generator app image to dockerhub
if: github.event_name != 'pull_request'
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/hashtag-actor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: Build hashtag app docker image
run: |
docker build -t ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }} ${{ env.APP_DIR }}
docker-compose build ${{ env.APP_IMAGE_NAME }}
docker tag ${{ env.APP_IMAGE_NAME }} ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }}
- name: Push hashtag app image to dockerhub
if: github.event_name != 'pull_request'
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/hashtag-counter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: Build hashtag app docker image
run: |
docker build -t ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }} ${{ env.APP_DIR }}
docker-compose build ${{ env.APP_IMAGE_NAME }}
docker tag ${{ env.APP_IMAGE_NAME }} ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }}
- name: Push hashtag app image to dockerhub
if: github.event_name != 'pull_request'
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/message-analyzer-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: Build message-analyzer app docker image
run: |
docker build -t ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }} ${{ env.APP_DIR }}
docker-compose build ${{ env.APP_IMAGE_NAME }}
docker tag ${{ env.APP_IMAGE_NAME }} ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }}
- name: Push message-analyzer app image to dockerhub
if: github.event_name != 'pull_request'
run: |
Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/non-master-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# ------------------------------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------------------------------

name: integration-ci

on:
push:
branches-ignore:
- master
paths:
- 'feed-generator/**'
- 'hashtag-actor/**'
- 'hashtag-counter/**'
- 'message-analyzer/**'
- 'snapshot/**'
- 'validation-worker/**'
pull_request:
branches-ignore:
- master
paths:
- 'feed-generator/**'
- 'hashtag-actor/**'
- 'hashtag-counter/**'
- 'message-analyzer/**'
- 'snapshot/**'
- 'validation-worker/**'

env:
IMAGES: '"feed-generator" "hashtag-actor" "hashtag-counter" "message-analyzer" "snapshot" "validation-worker"'

jobs:
build:
name: build feed-generator
runs-on: ubuntu-latest
env:
APP_REGISTRY: ${{ secrets.DOCKER_HASHTAG_APP_REGISTRY }}
# TODO: APP_VER needs to be versioned correctly
APP_VER: dev
ARTIFACT_DIR: ./deploy_artifact
steps:
- name: Check out code
uses: actions/checkout@v2
- name: docker login
if: github.event_name != 'pull_request'
run: |
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: Build feed-generator app docker image
run: |
docker-compose build
declare -a arr=(%{{ env.IMAGES }})
for i in "${arr[@]}"
do
echo "Tagging docker image ${i}"
docker tag $i ${{ env.APP_REGISTRY }}/${i}:${{ env.APP_VER }}
docker push ${{ env.APP_REGISTRY }}/${i}:${{ env.APP_VER }}
done
- name: Copy deployment yaml to archieve
run: |
mkdir -p ${{ env.ARTIFACT_DIR }}
cp ./longhaul-test/*.yml ${{ env.ARTIFACT_DIR }}
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: longhaul-test
path: ${{ env.ARTIFACT_DIR }}
deploy:
name: deploy longhaul applications to test cluster
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
env:
APP_NAMESPACE: longhaul-test
TEST_CLUSTER_NAME: dapr-seattle
TEST_RESOURCE_GROUP: dapr-test
ARTIFACT_DIR: ./deploy_artifact
steps:
- name: download artifacts
uses: actions/download-artifact@master
with:
name: longhaul-test
path: ${{ env.ARTIFACT_DIR }}
- name: Login Azure
run: |
az login --service-principal -u ${{ secrets.AZURE_LOGIN_USER }} -p ${{ secrets.AZURE_LOGIN_PASS }} --tenant ${{ secrets.AZURE_TENANT }} --output none
- name: Set up kubeconf for longhaul test environment
run: |
az aks get-credentials -n ${{ env.TEST_CLUSTER_NAME }} -g ${{ env.TEST_RESOURCE_GROUP }}
- name: Deploy apps to longhaul test environment
run: |
declare -a arr=(%{{ env.IMAGES }})
for i in "${arr[@]}"
do
echo "Deploy image ${i}"
kubectl apply -n ${{ env.APP_NAMESPACE }} -f ${{ env.ARTIFACT_DIR }}/${i}-deploy.yml & kubectl rollout restart -n ${{ env.APP_NAMESPACE }} deploy/${i}-app
done
3 changes: 2 additions & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: Build hashtag app docker image
run: |
docker build -t ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }} ${{ env.APP_DIR }}
docker-compose build ${{ env.APP_IMAGE_NAME }}
docker tag ${{ env.APP_IMAGE_NAME }} ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }}
- name: Push hashtag app image to dockerhub
if: github.event_name != 'pull_request'
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/validation-worker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
docker login -u ${{ secrets.DOCKER_REGISTRY_ID }} -p ${{ secrets.DOCKER_REGISTRY_PASS }}
- name: Build hashtag app docker image
run: |
docker build -t ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }} ${{ env.APP_DIR }}
docker-compose build ${{ env.APP_IMAGE_NAME }}
docker tag ${{ env.APP_IMAGE_NAME }} ${{ env.APP_REGISTRY }}/${{ env.APP_IMAGE_NAME }}:${{ env.APP_VER }}
- name: Push hashtag app image to dockerhub
if: github.event_name != 'pull_request'
run: |
Expand Down
122 changes: 67 additions & 55 deletions all.sln
Original file line number Diff line number Diff line change
@@ -1,55 +1,67 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29911.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "feed-generator", "feed-generator\feed-generator.csproj", "{C0633154-38FD-4A00-A056-D7180DD3E7C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hashtag-actor", "hashtag-actor\hashtag-actor.csproj", "{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hashtag-counter", "hashtag-counter\hashtag-counter.csproj", "{519E9AB5-36F3-4634-BEC0-ED418D930F10}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "message-analyzer", "message-analyzer\message-analyzer.csproj", "{FC4E27C0-F752-4D60-8D5D-9207353F6862}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "snapshot", "snapshot\snapshot.csproj", "{17C23853-30F3-4900-9D41-A68CAE4F9070}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "validation-worker", "validation-worker\validation-worker.csproj", "{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C0633154-38FD-4A00-A056-D7180DD3E7C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0633154-38FD-4A00-A056-D7180DD3E7C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0633154-38FD-4A00-A056-D7180DD3E7C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0633154-38FD-4A00-A056-D7180DD3E7C9}.Release|Any CPU.Build.0 = Release|Any CPU
{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}.Release|Any CPU.Build.0 = Release|Any CPU
{519E9AB5-36F3-4634-BEC0-ED418D930F10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{519E9AB5-36F3-4634-BEC0-ED418D930F10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{519E9AB5-36F3-4634-BEC0-ED418D930F10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{519E9AB5-36F3-4634-BEC0-ED418D930F10}.Release|Any CPU.Build.0 = Release|Any CPU
{FC4E27C0-F752-4D60-8D5D-9207353F6862}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC4E27C0-F752-4D60-8D5D-9207353F6862}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC4E27C0-F752-4D60-8D5D-9207353F6862}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC4E27C0-F752-4D60-8D5D-9207353F6862}.Release|Any CPU.Build.0 = Release|Any CPU
{17C23853-30F3-4900-9D41-A68CAE4F9070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17C23853-30F3-4900-9D41-A68CAE4F9070}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17C23853-30F3-4900-9D41-A68CAE4F9070}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17C23853-30F3-4900-9D41-A68CAE4F9070}.Release|Any CPU.Build.0 = Release|Any CPU
{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3FFC3845-6C77-4D6B-8134-1B206EA07D2A}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29911.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "feed-generator", "feed-generator\feed-generator.csproj", "{C0633154-38FD-4A00-A056-D7180DD3E7C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hashtag-actor", "hashtag-actor\hashtag-actor.csproj", "{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "hashtag-counter", "hashtag-counter\hashtag-counter.csproj", "{519E9AB5-36F3-4634-BEC0-ED418D930F10}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "message-analyzer", "message-analyzer\message-analyzer.csproj", "{FC4E27C0-F752-4D60-8D5D-9207353F6862}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "snapshot", "snapshot\snapshot.csproj", "{17C23853-30F3-4900-9D41-A68CAE4F9070}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "validation-worker", "validation-worker\validation-worker.csproj", "{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "common", "common\common.csproj", "{A1A42AD4-6C96-4A56-87E9-7AED724C536C}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{73242B78-3C8C-4A5B-B312-9056A1167DBC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C0633154-38FD-4A00-A056-D7180DD3E7C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0633154-38FD-4A00-A056-D7180DD3E7C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0633154-38FD-4A00-A056-D7180DD3E7C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0633154-38FD-4A00-A056-D7180DD3E7C9}.Release|Any CPU.Build.0 = Release|Any CPU
{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3D32756-7C1C-44C4-9C15-62FFCBFA9682}.Release|Any CPU.Build.0 = Release|Any CPU
{519E9AB5-36F3-4634-BEC0-ED418D930F10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{519E9AB5-36F3-4634-BEC0-ED418D930F10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{519E9AB5-36F3-4634-BEC0-ED418D930F10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{519E9AB5-36F3-4634-BEC0-ED418D930F10}.Release|Any CPU.Build.0 = Release|Any CPU
{FC4E27C0-F752-4D60-8D5D-9207353F6862}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC4E27C0-F752-4D60-8D5D-9207353F6862}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC4E27C0-F752-4D60-8D5D-9207353F6862}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC4E27C0-F752-4D60-8D5D-9207353F6862}.Release|Any CPU.Build.0 = Release|Any CPU
{17C23853-30F3-4900-9D41-A68CAE4F9070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17C23853-30F3-4900-9D41-A68CAE4F9070}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17C23853-30F3-4900-9D41-A68CAE4F9070}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17C23853-30F3-4900-9D41-A68CAE4F9070}.Release|Any CPU.Build.0 = Release|Any CPU
{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD3BE10A-6338-4B00-BBB1-6FB8BB4AB149}.Release|Any CPU.Build.0 = Release|Any CPU
{A1A42AD4-6C96-4A56-87E9-7AED724C536C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1A42AD4-6C96-4A56-87E9-7AED724C536C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1A42AD4-6C96-4A56-87E9-7AED724C536C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1A42AD4-6C96-4A56-87E9-7AED724C536C}.Release|Any CPU.Build.0 = Release|Any CPU
{73242B78-3C8C-4A5B-B312-9056A1167DBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73242B78-3C8C-4A5B-B312-9056A1167DBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73242B78-3C8C-4A5B-B312-9056A1167DBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73242B78-3C8C-4A5B-B312-9056A1167DBC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3FFC3845-6C77-4D6B-8134-1B206EA07D2A}
EndGlobalSection
EndGlobal
33 changes: 33 additions & 0 deletions common/Models/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// ------------------------------------------------------------

namespace Dapr.Tests.Common.Models
{
public static class Constants
{
public static string[] HashTags = new string[]
{
"circle",
"ellipse",
"square",
"rectangle",
"triangle",
"star",
"cardioid",
"epicycloid",
"limocon",
"hypocycoid"
};

public static string[] Sentiments = new string[]
{
"verynegative",
"negative",
"neutral",
"positive",
"verypositive"
};
}
}
Loading

0 comments on commit 80b3440

Please sign in to comment.