Skip to content

build: set timeout

build: set timeout #73

Workflow file for this run

name: Build and run tests (dev)
on:
pull_request:
branches: [ dev ]
jobs:
frontend-develop:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: |
cd $PWD/TokanPages.ClientApp
npm install --global yarn
yarn global add sonarqube-scanner
yarn install
- name: Test client application
run: |
cd $PWD/TokanPages.ClientApp
yarn app-test --ci --coverage
yarn sonar \
-Dsonar.login=${{ secrets.SONARQUBE_TOKEN_FE }} \
-Dsonar.projectKey=${{ secrets.SONARQUBE_PROJECT_KEY_FE }} \
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
backend-develop:
runs-on: ubuntu-latest
env:
TARGET_DIRECTORY: $PWD/sonarqubecoverage
COVERAGE_REPORT: $PWD/*/*/TestResults/*/coverage.cobertura.xml
SONAR_REPORT: SonarQube.xml
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log to Azure Cloud
uses: Azure/login@v2.1.0
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Get Azure Key Vault secrets
uses: TomaszKandula/get-keyvault-secrets@v1.0.3
with:
keyvault: ${{ secrets.AZURE_KEY_VAULT }}
secrets: ${{ secrets.AZURE_KEY_VAULT_LIST_TEST }}
id: vault
- name: Variable substitution appsettings file for Testing (.NET)
uses: TomaszKandula/variable-substitution@v1.0.2
with:
files: ${{ github.workspace }}/TokanPages.Configuration/appsettings.Testing.json
env:
Email_PrivateKey: "${{ steps.vault.outputs.TestEmailPrivateKey }}"
Email_HealthUrl: "${{ steps.vault.outputs.TestEmailHealthUrl }}"
Email_BaseUrl: "${{ steps.vault.outputs.TestEmailBaseUrl }}"
Email_Address_Admin: "${{ steps.vault.outputs.TestEmailAddressesAdmin }}"
Email_Address_Contact: "${{ steps.vault.outputs.TestEmailAddressesContact }}"
Email_Address_Support: "${{ steps.vault.outputs.TestEmailAddressesItSupport }}"
Db_DatabaseContext: "${{ steps.vault.outputs.TestDbConnect }}"
Db_DatabaseContext_Migrator: "${{ steps.vault.outputs.TestDbMigrator }}"
AZ_Bus_ConnectionString: "${{ steps.vault.outputs.TestAzBusConnectionString }}"
AZ_Storage_BaseUrl: "${{ steps.vault.outputs.TestAzStorageBaseUrl }}"
AZ_Storage_ContainerName: "${{ steps.vault.outputs.TestAzStorageContainerName }}"
AZ_Storage_ConnectionString: "${{ steps.vault.outputs.TestAzStorageConnectionString }}"
AZ_Storage_MaxFileSizeUserMedia: "${{ steps.vault.outputs.TestAzStorageMaxFileSizeUserMedia }}"
AZ_Storage_MaxFileSizeSingleAsset: "${{ steps.vault.outputs.TestAzStorageMaxFileSizeSingleAsset }}"
AZ_Redis_InstanceName: "${{ steps.vault.outputs.TestAzRedisInstanceName }}"
AZ_Redis_ConnectionString: "${{ steps.vault.outputs.TestAzRedisConnectionString }}"
AZ_Redis_ExpirationMinute: "${{ steps.vault.outputs.TestAzRedisExpirationMinute }}"
AZ_Redis_ExpirationSecond: "${{ steps.vault.outputs.TestAzRedisExpirationSecond }}"
Paths_UpdateSubscriber: "${{ steps.vault.outputs.TestPathsUpdateSubscriber }}"
Paths_Unsubscribe: "${{ steps.vault.outputs.TestPathsUnsubscribe }}"
Paths_UpdatePassword: "${{ steps.vault.outputs.TestPathsUpdatePassword }}"
Paths_Activation: "${{ steps.vault.outputs.TestPathsActivation }}"
Paths_DevelopmentOrigin: "${{ steps.vault.outputs.TestPathsDevelopmentOrigin }}"
Paths_DeploymentOrigin: "${{ steps.vault.outputs.TestPathsDeploymentOrigin }}"
Paths_Templates_Newsletter: "${{ steps.vault.outputs.TestPathsNewsletter }}"
Paths_Templates_ContactForm: "${{ steps.vault.outputs.TestPathsContactForm }}"
Paths_Templates_ResetPassword: "${{ steps.vault.outputs.TestPathsResetPassword }}"
Paths_Templates_RegisterForm: "${{ steps.vault.outputs.TestPathsRegisterForm }}"
Ids_Issuer: "${{ steps.vault.outputs.TestIdsIssuer }}"
Ids_Audience: "${{ steps.vault.outputs.TestIdsAudience }}"
Ids_WebSecret: "${{ steps.vault.outputs.TestIdsWebSecret }}"
Ids_RequireHttps: "${{ steps.vault.outputs.TestIdsRequireHttps }}"
Ids_WebToken_Maturity: "${{ steps.vault.outputs.TestIdsWebTokenMaturity }}"
Ids_RefreshToken_Maturity: "${{ steps.vault.outputs.TestIdsRefreshTokenMaturity }}"
Limit_Reset_Maturity: "${{ steps.vault.outputs.TestLimitsResetMaturity }}"
Limit_Activation_Maturity: "${{ steps.vault.outputs.TestLimitsActivationMaturity }}"
Limit_Likes_Anonymous: "${{ steps.vault.outputs.TestLimitsLikesAnonymous }}"
Limit_Likes_User: "${{ steps.vault.outputs.TestLimitsLikesUser }}"
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Install dependencies
run: dotnet restore
- name: SonarQube begin scan dotnet
run: |
dotnet tool install --global dotnet-sonarscanner --version 5.15.0
dotnet tool update dotnet-reportgenerator-globaltool -g
dotnet sonarscanner begin \
/k:${{ secrets.SONARQUBE_PROJECT_KEY_BE }} \
/d:sonar.login=${{ secrets.SONARQUBE_TOKEN_BE }} \
/d:sonar.host.url=${{ secrets.SONARQUBE_HOST }} \
/d:sonar.coverageReportPaths="${{ env.TARGET_DIRECTORY }}/${{ env.SONAR_REPORT }}"
- name: Build .NET
run: dotnet build
- name: Test with the dotnet CLI
run: |
ASPNETCORE_ENVIRONMENT=Testing dotnet test --no-build --collect:"XPlat Code Coverage"
mkdir "${{ env.TARGET_DIRECTORY }}"
reportgenerator "-reports:${{ env.COVERAGE_REPORT }}" "-targetdir:${{ env.TARGET_DIRECTORY }}" "-reporttypes:SonarQube"
env:
ASPNETCORE_ENVIRONMENT: Testing
- name: SonarQube end scan dotnet
run: dotnet sonarscanner end /d:sonar.login=${{ secrets.SONARQUBE_TOKEN_BE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}