diff --git a/.deployment/module/argoDeploy.json b/.deployment/module/argoDeploy.json index 6f2e63d..4004bb8 100644 --- a/.deployment/module/argoDeploy.json +++ b/.deployment/module/argoDeploy.json @@ -7,7 +7,7 @@ "deployBranch": "dev", "environmentId": "dev", "environmentName": "Development", - "environmentType": "development", + "environmentType": "staging", "environmentUrl": "https://vcplatform-platform.dev.govirto.com/" }, "qa": { @@ -20,7 +20,7 @@ }, "prod": { "deployAppName": "vcplatform-demo", - "deployBranch": "master", + "deployBranch": "demo", "environmentId": "prod", "environmentName": "Demo", "environmentType": "production", diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..8b003de --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,16 @@ +# Common settings + +.github/* @mvktsk @Vectorfield4 +.gitignore @mvktsk @Vectorfield4 +.dockerignore @mvktsk @Vectorfield4 + +# Main Code and Tests + +src/* @VirtoCommerce/platform +tests/* @VirtoCommerce/platform +.editorconfig @VirtoCommerce/platform +3rd-party-components.md @VirtoCommerce/platform +VirtoCommerce.Platform.sln @VirtoCommerce/platform + +# Docs +docs/* @zashchitnik-kuka diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a85d83..8701847 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -# v1.1.10 +# v1.1.13 name: Module CI on: @@ -42,8 +42,9 @@ jobs: RELEASE_STATUS: 'false' outputs: - artifactUrl: ${{ steps.blobRelease.outputs.packageUrl }} + artifactUrl: ${{ steps.artifactUrl.outputs.download_url }} jira-keys: ${{ steps.jira_keys.outputs.jira-keys }} + moduleId: ${{ steps.artifact_ver.outputs.moduleId }} steps: @@ -52,39 +53,30 @@ jobs: run: | echo "RELEASE_STATUS=true" >> $GITHUB_ENV - - name: Set up JDK 11 for dotnet-sonarscanner #Sonar stop accepting Java versions less than 11 - uses: actions/setup-java@v1 - with: - java-version: 1.11 - - uses: actions/checkout@v2 with: fetch-depth: 0 - - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '6.0.x' - - name: Install VirtoCommerce.GlobalTool - run: dotnet tool install --global VirtoCommerce.GlobalTool --version 2.1.0-alpha.17 + uses: VirtoCommerce/vc-github-actions/setup-vcbuild@master - name: Install dotnet-sonarscanner run: dotnet tool install --global dotnet-sonarscanner - - name: Get changelog + - name: Get Changelog id: changelog uses: VirtoCommerce/vc-github-actions/changelog-generator@master - - name: Get Image Version + - name: Get Artifact Version uses: VirtoCommerce/vc-github-actions/get-image-version@master - id: image + id: artifact_ver - name: Set VERSION_SUFFIX variable run: | if [ '${{ github.event_name }}' = 'workflow_dispatch' ]; then - echo "VERSION_SUFFIX=${{ steps.image.outputs.fullSuffix }}" >> $GITHUB_ENV + echo "VERSION_SUFFIX=${{ steps.artifact_ver.outputs.fullSuffix }}" >> $GITHUB_ENV else - echo "VERSION_SUFFIX=${{ steps.image.outputs.suffix }}" >> $GITHUB_ENV + echo "VERSION_SUFFIX=${{ steps.artifact_ver.outputs.suffix }}" >> $GITHUB_ENV fi; - name: Add version suffix if: ${{ github.ref != 'refs/heads/master' }} @@ -140,9 +132,19 @@ jobs: - name: Publish Github Release if: ${{ github.ref == 'refs/heads/master' }} + id: githubRelease with: changelog: ${{ steps.changelog.outputs.changelog }} uses: VirtoCommerce/vc-github-actions/publish-github-release@master + + - name: Set artifactUrl value + id: artifactUrl + run: | + if [ '${{ github.ref }}' = 'refs/heads/master' ]; then + echo ::set-output name=download_url::${{ steps.githubRelease.outputs.downloadUrl }} + else + echo ::set-output name=download_url::${{ steps.blobRelease.outputs.packageUrl }} + fi; - name: Setup Git Credentials if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name != 'workflow_dispatch' }} @@ -163,10 +165,10 @@ jobs: githubToken: ${{ secrets.REPO_TOKEN }} login: ${{ secrets.VIRTOCOMMERCE_APP_ID }} password: ${{ secrets.VIRTOCOMMERCE_SECRET }} - moduleId: ${{ steps.image.outputs.moduleId }} - moduleDescription: ${{ steps.image.outputs.moduleDescription }} - projectUrl: ${{ steps.image.outputs.projectUrl }} - iconUrl: ${{ steps.image.outputs.iconUrl }} + moduleId: ${{ steps.artifact_ver.outputs.moduleId }} + moduleDescription: ${{ steps.artifact_ver.outputs.moduleDescription }} + projectUrl: ${{ steps.artifact_ver.outputs.projectUrl }} + iconUrl: ${{ steps.artifact_ver.outputs.iconUrl }} - name: Parse Jira Keys from All Commits uses: VirtoCommerce/vc-github-actions/get-jira-keys@master @@ -203,7 +205,7 @@ jobs: echo "Jira Upload Build Info response: ${{ steps.push_build_info_to_jira.outputs.response }}" deploy: - if: ${{ github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch' }} + if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name == 'push' }} needs: ci runs-on: ubuntu-latest env: @@ -212,6 +214,8 @@ jobs: CLIENT_ID: ${{secrets.CLIENT_ID}} CLIENT_SECRET: ${{secrets.CLIENT_SECRET}} DEPLOYMENT_ENV: 'dev' + SLEEP_TIME: '5m' + ARGO_SERVER: 'argo.govirto.com' steps: - name: Set DEPLOYMENT_ENV variable @@ -245,20 +249,19 @@ jobs: forceCommit: 'true' cmPath: ${{ steps.deployConfig.outputs.cmPath }} + - name: Sleep for ${{ env.SLEEP_TIME }} + run: sleep ${{ env.SLEEP_TIME }} + shell: bash + - name: Wait for environment is up - shell: pwsh - timeout-minutes: 15 - run: | - do { - Start-Sleep -s 15 - $statusBage = (Invoke-WebRequest -Uri "https://argo.govirto.com/api/badge?name=${{ steps.deployConfig.outputs.deployAppName }}").Content - - $syncedAndHealthy = $statusBage.Contains('>Healthy<') -and $statusBage.Contains('>Synced<') - if (-not $syncedAndHealthy) { - Write-Host "Sync pending..." - } - } - while (-not $syncedAndHealthy) + uses: VirtoCommerce/vc-github-actions/vc-argocd-cli@master + timeout-minutes: 10 + id: argocd-cli + with: + server: ${{env.ARGO_SERVER}} + username: ${{ secrets.ARGOCD_LOGIN }} + password: ${{ secrets.ARGOCD_PASSWORD }} + command: app wait ${{ steps.deployConfig.outputs.deployAppName }} - name: DEPLOY_STATE::successful if: success() @@ -303,3 +306,19 @@ jobs: environment-id: ${{ steps.deployConfig.outputs.environmentId }} environment-display-name: ${{ steps.deployConfig.outputs.environmentName }} environment-type: ${{ steps.deployConfig.outputs.environmentType }} + + module-katalon-tests: + if: ${{ github.event_name == 'pull_request' }} + needs: 'ci' + uses: VirtoCommerce/.github/.github/workflows/e2e.yml@main + with: + katalonRepo: 'VirtoCommerce/vc-quality-gate-katalon' + katalonRepoBranch: 'dev' + testSuite: 'Test Suites/Modules/Platform_collection' + installModules: 'true' + installCustomModule: 'true' + customModuleId: ${{ needs.ci.outputs.moduleId }} + customModuleUrl: ${{ needs.ci.outputs.artifactUrl }} + secrets: + envPAT: ${{ secrets.REPO_TOKEN }} + katalonApiKey: ${{ secrets.KATALON_API_KEY }} diff --git a/.github/workflows/publish-nugets.yml b/.github/workflows/publish-nugets.yml new file mode 100644 index 0000000..024fb8c --- /dev/null +++ b/.github/workflows/publish-nugets.yml @@ -0,0 +1,37 @@ +# v3.200.13 +name: Publish nuget + +on: + workflow_dispatch: + inputs: + publishAlpha: + description: 'Publish nuget as alpha version.' + required: true + default: true + type: boolean + +jobs: + test: + uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.200.13 + secrets: + sonarToken: ${{ secrets.SONAR_TOKEN }} + + build: + uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.200.13 + with: + uploadPackage: 'true' + uploadDocker: 'false' + forceVersionSuffix: ${{ github.event.inputs.publishAlpha }} + secrets: + envPAT: ${{ secrets.REPO_TOKEN }} + + publish-nuget: + needs: + [build, test] + uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.200.13 + with: + fullKey: ${{ needs.build.outputs.packageFullKey }} + forceGithub: false + secrets: + envPAT: ${{ secrets.GITHUB_TOKEN }} + nugetKey: ${{ secrets.NUGET_KEY }} diff --git a/.github/workflows/publish_nugets.yml b/.github/workflows/publish_nugets.yml deleted file mode 100644 index 64610f1..0000000 --- a/.github/workflows/publish_nugets.yml +++ /dev/null @@ -1,61 +0,0 @@ -# v1.0.0 -name: Module nuget publishing - -on: - workflow_dispatch: - repository_dispatch: - -jobs: - ci: - runs-on: ubuntu-latest - env: - CLIENT_SECRET: ${{secrets.CLIENT_SECRET}} - SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} - GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} - NUGET_KEY: ${{ secrets.NUGET_KEY }} - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '6.0.x' - - - uses: actions/setup-node@v2 - with: - node-version: '14' - - - name: Install VirtoCommerce.GlobalTool - run: dotnet tool install --global VirtoCommerce.GlobalTool --version 2.1.0-alpha.17 - - - name: Install dotnet-sonarscanner - run: dotnet tool install --global dotnet-sonarscanner - - - name: Get Image Version - uses: VirtoCommerce/vc-github-actions/get-image-version@master - id: image - - - name: SonarCloud Begin - uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@master - - - name: Build - run: vc-build Compile - - - name: Unit Tests - run: vc-build Test -skip - - - name: SonarCloud End - uses: VirtoCommerce/vc-github-actions/sonar-scanner-end@master - - - name: Quality Gate - uses: VirtoCommerce/vc-github-actions/sonar-quality-gate@master - with: - login: ${{secrets.SONAR_TOKEN}} - - - name: Packaging - run: vc-build Compress -skip Clean+Restore+Compile+Test - - - name: Publish Nuget - uses: VirtoCommerce/vc-github-actions/publish-nuget@master diff --git a/.github/workflows/release-hotfix.yml b/.github/workflows/release-hotfix.yml new file mode 100644 index 0000000..4db8ab5 --- /dev/null +++ b/.github/workflows/release-hotfix.yml @@ -0,0 +1,78 @@ +# v3.200.12 +name: Release hotfix + +on: + workflow_dispatch: + inputs: + incrementPatch: + description: 'Increment patch version.' + required: true + default: true + type: boolean + +jobs: + test: + uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.200.12 + secrets: + sonarToken: ${{ secrets.SONAR_TOKEN }} + + build: + uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.200.12 + with: + uploadPackage: 'true' + uploadDocker: 'false' + forceVersionSuffix: 'false' + incrementPatch: ${{ github.event.inputs.incrementPatch }} + secrets: + envPAT: ${{ secrets.REPO_TOKEN }} + + get-metadata: + runs-on: ubuntu-latest + outputs: + changelog: ${{ steps.changelog.outputs.changelog }} + steps: + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get Changelog + id: changelog + uses: VirtoCommerce/vc-github-actions/changelog-generator@master + + publish-github-release: + needs: + [build, test, get-metadata] + uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.200.12 + with: + fullKey: ${{ needs.build.outputs.packageFullKey }} + changeLog: '${{ needs.get-metadata.outputs.changeLog }}' + incrementPatch: ${{ github.event.inputs.incrementPatch }} + + secrets: + envPAT: ${{ secrets.GITHUB_TOKEN }} + nugetKey: ${{ secrets.NUGET_KEY }} + + increment-version: + needs: + [publish-github-release] + if: ${{ github.event.inputs.incrementPatch == 'true' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install VirtoCommerce.GlobalTool + uses: VirtoCommerce/vc-github-actions/setup-vcbuild@master + + - name: Setup Git Credentials + uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@master + with: + githubToken: ${{ secrets.REPO_TOKEN }} + + - name: Increment Version + run: | + vc-build IncrementPatch + git add Directory.Build.props *module.manifest + git commit -m "ci: Auto IncrementPatch" + git push diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3771aa5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,11 @@ +# v1.0.0 +name: Release + +on: + workflow_dispatch: + +jobs: + release: + uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.200.12 + secrets: + envPAT: ${{ secrets.REPO_TOKEN }} diff --git a/Directory.Build.props b/Directory.Build.props index c1665f5..863ceda 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 3.200.0 + 3.201.0 $(VersionSuffix)-$(BuildNumber) diff --git a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Core/VirtoCommerce.GoogleEcommerceAnalyticsModule.Core.csproj b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Core/VirtoCommerce.GoogleEcommerceAnalyticsModule.Core.csproj index 409a160..24778f7 100644 --- a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Core/VirtoCommerce.GoogleEcommerceAnalyticsModule.Core.csproj +++ b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Core/VirtoCommerce.GoogleEcommerceAnalyticsModule.Core.csproj @@ -8,6 +8,11 @@ snupkg + + + false + + diff --git a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data/Handlers/OrderChangedHandler.cs b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data/Handlers/OrderChangedHandler.cs index 6e534d2..b28b459 100644 --- a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data/Handlers/OrderChangedHandler.cs +++ b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data/Handlers/OrderChangedHandler.cs @@ -22,7 +22,7 @@ public async Task Handle(OrderChangedEvent @event) { Task.Factory.StartNew(s => ((IGoogleAnalyticsTransactionManager)s).CreateTransactionAsync(changedEntry.NewEntry), _gaTransactionManager, System.Threading.CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } - else if (changedEntry.EntryState == Platform.Core.Common.EntryState.Modified && changedEntry.NewEntry.Status == "Cancelled") + else if (changedEntry.EntryState == Platform.Core.Common.EntryState.Modified && changedEntry.NewEntry.Status != changedEntry.OldEntry.Status && changedEntry.NewEntry.Status == "Cancelled") { Task.Factory.StartNew(s => ((IGoogleAnalyticsTransactionManager)s).RevertTransactionAsync(changedEntry.NewEntry), _gaTransactionManager, System.Threading.CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } diff --git a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data.csproj b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data.csproj index 89a1973..b5c8f75 100644 --- a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data.csproj +++ b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data/VirtoCommerce.GoogleEcommerceAnalyticsModule.Data.csproj @@ -8,6 +8,12 @@ snupkg + + + false + + + diff --git a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web.csproj b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web.csproj index 8e61b44..b1b14cd 100644 --- a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web.csproj +++ b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web.csproj @@ -5,6 +5,11 @@ Library + + + false + + diff --git a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web/module.manifest b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web/module.manifest index 9f124fb..140388a 100644 --- a/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web/module.manifest +++ b/src/VirtoCommerce.GoogleEcommerceAnalyticsModule.Web/module.manifest @@ -1,29 +1 @@ - - - VirtoCommerce.GoogleEcommerceAnalytics - 3.200.0 - - 3.200.0 - Ecommerce Google Analytics module - Provides integration between Ecommerce feature of Google Analytics and VirtoCommerce. - - Alexey Antonov - Egidijus Mažeika - - - Virto Commerce - - https://virtocommerce.com/apps/extensions/google-ecommerce-analytics-module - Modules/$(VirtoCommerce.GoogleEcommerceAnalytics)/Content/logo.png - false - First version. - Copyright © 2011-2021 Virto Commerce. All rights reserved - analytics - VirtoCommerce.GoogleEcommerceAnalyticsModule.Web.dll - VirtoCommerce.GoogleEcommerceAnalyticsModule.Web.Module, VirtoCommerce.GoogleEcommerceAnalyticsModule.Web - - - - - false - \ No newline at end of file +VirtoCommerce.GoogleEcommerceAnalytics3.201.03.200.0Ecommerce Google Analytics moduleProvides integration between Ecommerce feature of Google Analytics and VirtoCommerce.Alexey AntonovEgidijus MažeikaVirto Commercehttps://virtocommerce.com/apps/extensions/google-ecommerce-analytics-moduleModules/$(VirtoCommerce.GoogleEcommerceAnalytics)/Content/logo.pngfalseFirst version.Copyright © 2011-2021 Virto Commerce. All rights reservedanalyticsVirtoCommerce.GoogleEcommerceAnalyticsModule.Web.dllVirtoCommerce.GoogleEcommerceAnalyticsModule.Web.Module, VirtoCommerce.GoogleEcommerceAnalyticsModule.Webfalse \ No newline at end of file