Skip to content

Commit

Permalink
Update Github Action workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyshibanov committed Nov 30, 2024
1 parent f8c7453 commit 644ef64
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 33 deletions.
125 changes: 99 additions & 26 deletions .github/workflows/module-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# v3.800.6
# v3.800.10
# https://virtocommerce.atlassian.net/browse/VCST-1738
name: Module CI

on:
Expand All @@ -14,10 +15,10 @@ on:
- '**/cloudDeploy.json'
- samples/**
branches:
[master, dev]
[master, main, dev]
pull_request:
branches:
[master, dev]
[master, main, dev]
paths-ignore:
- 'docs/**'
- 'build/**'
Expand All @@ -30,13 +31,14 @@ on:
jobs:
ci:
if: ${{ github.actor != 'dependabot[bot]' &&
(github.event.pull_request.head.repo.full_name == github.repository ||
github.event.pull_request.head.repo.full_name == '') }} # Check that PR not from forked repo and not from Dependabot
(github.event.pull_request.head.repo.full_name == github.repository ||
github.event.pull_request.head.repo.full_name == '') }} # Check that PR not from forked repo and not from Dependabot
runs-on: ubuntu-20.04
env:
CLOUD_INSTANCE_BASE_URL: ${{secrets.CLOUD_INSTANCE_BASE_URL}}
CLIENT_ID: ${{secrets.CLIENT_ID}}
CLIENT_SECRET: ${{secrets.CLIENT_SECRET}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
NUGET_KEY: ${{ secrets.NUGET_KEY }}
BLOB_SAS: ${{ secrets.BLOB_TOKEN }}
Expand All @@ -51,26 +53,36 @@ jobs:
version: ${{ steps.artifact_ver.outputs.shortVersion }}
moduleId: ${{ steps.artifact_ver.outputs.moduleId }}
matrix: ${{ steps.deployment-matrix.outputs.matrix }}
run-e2e: ${{ steps.run-e2e.outputs.result }}

steps:

- name: Set up Node 18
uses: actions/setup-node@v3
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: Set up Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Set RELEASE_STATUS
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
if: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && github.event_name == 'push' }}
run: |
echo "RELEASE_STATUS=true" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install VirtoCommerce.GlobalTool
uses: VirtoCommerce/vc-github-actions/setup-vcbuild@master

- name: Install dotnet-sonarscanner
run: dotnet tool install --global dotnet-sonarscanner

- name: Get Changelog
id: changelog
uses: VirtoCommerce/vc-github-actions/changelog-generator@master
Expand All @@ -82,73 +94,114 @@ jobs:
- name: Set VERSION_SUFFIX variable
run: |
if [ '${{ github.event_name }}' = 'workflow_dispatch' ]; then
echo "VERSION_SUFFIX=${{ steps.artifact_ver.outputs.fullSuffix }}-${{ steps.artifact_ver.outputs.sha }}" >> $GITHUB_ENV
echo "VERSION_SUFFIX=${{ steps.artifact_ver.outputs.fullSuffix }}" >> $GITHUB_ENV
else
echo "VERSION_SUFFIX=${{ steps.artifact_ver.outputs.suffix }}" >> $GITHUB_ENV
fi;
- name: Add version suffix
if: ${{ github.ref != 'refs/heads/master' }}
if: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
uses: VirtoCommerce/vc-github-actions/add-version-suffix@master
with:
versionSuffix: ${{ env.VERSION_SUFFIX }}

- name: Build Import App
uses: ./.github/actions/build-import-app
- name: SonarCloud Begin
uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@master
with:
githubToken: ${{ secrets.REPO_TOKEN }}
npmToken: ${{ secrets.NPM_TOKEN }}
repoOrg: ${{ github.repository_owner }}
sonarOrg: ${{secrets.SONAR_ORG_KEY}}

- 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
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name != 'workflow_dispatch' }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
uses: VirtoCommerce/vc-github-actions/publish-nuget@master

- name: Publish to Blob
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main') }}
id: blobRelease
uses: VirtoCommerce/vc-github-actions/publish-blob-release@master
with:
blobSAS: ${{ secrets.BLOB_TOKEN }}
blobUrl: ${{ vars.BLOB_URL }}

- name: Add Jira link
if: ${{ github.event_name == 'pull_request' }}
uses: VirtoCommerce/vc-github-actions/publish-jira-link@master
with:
branchName: ${{ github.head_ref }}
repoOrg: ${{ github.repository_owner }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Add link to PR
if: ${{ github.event_name == 'pull_request' }}
uses: VirtoCommerce/vc-github-actions/publish-artifact-link@master
with:
artifactUrl: ${{ steps.blobRelease.outputs.packageUrl }}
repoOrg: ${{ github.repository_owner }}
downloadComment: 'Artifact URL:'

- name: Publish Github Release
if: ${{ github.ref == 'refs/heads/master' }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
id: githubRelease
with:
changelog: ${{ steps.changelog.outputs.changelog }}
organization: ${{ github.repository_owner }}
uses: VirtoCommerce/vc-github-actions/publish-github-release@master

- name: Set artifactUrl value
id: artifactUrl
run: |
if [ '${{ github.ref }}' = 'refs/heads/master' ]; then
if [ '${{ github.ref }}' = 'refs/heads/master' ] || [ '${{ github.ref }}' = 'refs/heads/main' ]; then
echo "download_url=${{ steps.githubRelease.outputs.downloadUrl }}" >> $GITHUB_OUTPUT
else
echo "download_url=${{ steps.blobRelease.outputs.packageUrl }}" >> $GITHUB_OUTPUT
fi;
- name: Create deployment matrix
if: ${{ github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master'}}
if: ${{ github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
uses: VirtoCommerce/vc-github-actions/cloud-create-deploy-matrix@master
id: deployment-matrix
with:
deployConfigPath: '.deployment/module/cloudDeploy.json'
releaseBranch: 'non-existent'
releaseBranch: 'master'

- name: Check commit message for version number
id: run-e2e
run: |
if [[ "${{ github.event.head_commit.message }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]];
then
echo "result=false" >> $GITHUB_OUTPUT
else
echo "result=true" >> $GITHUB_OUTPUT
fi
- name: Setup Git Credentials
if: ${{ (github.ref == 'refs/heads/dev' && github.event_name != 'workflow_dispatch') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@master
with:
githubToken: ${{ secrets.REPO_TOKEN }}

- name: Publish Manifest
if: ${{ (github.ref == 'refs/heads/dev' && github.event_name != 'workflow_dispatch') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
uses: VirtoCommerce/vc-github-actions/publish-manifest@master
with:
packageUrl: ${{ steps.artifactUrl.outputs.download_url }}

- name: Parse Jira Keys from All Commits
uses: VirtoCommerce/vc-github-actions/get-jira-keys@master
Expand All @@ -162,7 +215,7 @@ jobs:
- name: Push Build Info to Jira
if: ${{ env.CLOUD_INSTANCE_BASE_URL != 0 && env.CLIENT_ID != 0 && env.CLIENT_SECRET != 0 && steps.jira_keys.outputs.jira-keys != '' && always() }}
id: push_build_info_to_jira
uses: HighwayThree/jira-upload-build-info@master
uses: VirtoCommerce/jira-upload-build-info@master
with:
cloud-instance-base-url: '${{ secrets.CLOUD_INSTANCE_BASE_URL }}'
client-id: '${{ secrets.CLIENT_ID }}'
Expand All @@ -184,16 +237,36 @@ jobs:
run: |
echo "Jira Upload Build Info response: ${{ steps.push_build_info_to_jira.outputs.response }}"
module-katalon-tests:
if: ${{ ((github.ref == 'refs/heads/dev') && (github.event_name == 'push') && (needs.ci.outputs.run-e2e == 'true')) ||
(github.event_name == 'workflow_dispatch') || (github.base_ref == 'dev') && (github.event_name == 'pull_request') }}
needs: 'ci'
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@v3.800.10

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 }}
platformDockerTag: 'dev-linux-latest'
storefrontDockerTag: 'dev-linux-latest'
secrets:
envPAT: ${{ secrets.REPO_TOKEN }}
katalonApiKey: ${{ secrets.KATALON_API_KEY }}

deploy-cloud:
if: ${{ (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/dev') }}
if: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
needs: ci
uses: VirtoCommerce/.github/.github/workflows/deploy-cloud.yml@VCI-805
uses: VirtoCommerce/.github/.github/workflows/deploy-cloud.yml@v3.800.10
with:
releaseSource: module
moduleId: ${{ needs.ci.outputs.moduleId }}
moduleVer: ${{ needs.ci.outputs.version }}
moduleBlob: ${{ needs.ci.outputs.blobId }}
jiraKeys: ${{ needs.ci.outputs.jira-keys }}
cloudUrl: 'https://portal.virtocommerce.cloud'
argoServer: 'argo.virtocommerce.cloud'
matrix: '{"include":${{ needs.ci.outputs.matrix }}}'
secrets: inherit
14 changes: 10 additions & 4 deletions .github/workflows/publish-nugets.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# v3.200.36
# v3.800.10
# https://virtocommerce.atlassian.net/browse/VCST-1738
name: Publish nuget

on:
Expand All @@ -11,8 +12,13 @@ on:
type: boolean

jobs:
test:
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.10
secrets:
sonarToken: ${{ secrets.SONAR_TOKEN }}

build:
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.200.36
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.10
with:
uploadPackage: 'true'
uploadDocker: 'false'
Expand All @@ -22,8 +28,8 @@ jobs:

publish-nuget:
needs:
[build]
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.200.36
[build, test]
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.10
with:
fullKey: ${{ needs.build.outputs.packageFullKey }}
forceGithub: false
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# v3.200.30
# v3.800.10
# https://virtocommerce.atlassian.net/browse/VCST-1738
name: Release

on:
workflow_dispatch:

jobs:
release:
uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.200.30
uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.800.10
secrets:
envPAT: ${{ secrets.REPO_TOKEN }}
envPAT: ${{ secrets.REPO_TOKEN }}

0 comments on commit 644ef64

Please sign in to comment.