Merge pull request #210 from DaniilPoiarkov/bugfix/chart-fonts #99
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Development Container-based Build and deploy to an Azure | |
| env: | |
| AZURE_WEBAPP_NAME: eclipse-prod-app | |
| DOTNET_VERSION: '8.0.*' | |
| DOTNET_CONFIGURATION: 'Release' | |
| REPO: | |
| on: | |
| push: | |
| branches: develop | |
| pull_request: | |
| branches: develop | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up .NET Core | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Set up dependency caching | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore dependencies | |
| run: dotnet restore ./Eclipse.WebAPI.sln | |
| - name: Build | |
| run: dotnet build ./Eclipse.WebAPI.sln | |
| --configuration ${{ env.DOTNET_CONFIGURATION }} | |
| --no-restore | |
| - name: Run tests | |
| run: dotnet test ./Eclipse.WebAPI.sln | |
| --configuration ${{ env.DOTNET_CONFIGURATION }} | |
| --no-build | |
| --logger trx | |
| --results-directory ${{ github.workspace }}/test-results | |
| --collect "XPlat Code Coverage;Format=Cobertura" | |
| - name: Generate code coverage report | |
| uses: danielpalme/ReportGenerator-GitHub-Action@5.2.4 | |
| with: | |
| reports: ${{ github.workspace }}/test-results/**/*.xml | |
| targetdir: ${{ github.workspace }}/coverage-reports | |
| reporttypes: cobertura;Html_Dark;MarkdownSummaryGithub | |
| assemblyfilters: '-*.Tests;-*.Infrastructure;-*.DataAccess' | |
| classfilters: '-*Module;-*Configuration' | |
| verbosity: Info | |
| title: Code Coverage | |
| tag: ${{ github.run_number }}_${{ github.run_id }} | |
| - name: Upload code coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: ${{ github.workspace }}/coverage-reports/Cobertura.xml | |
| retention-days: 3 | |
| - name: Publish code coverage summary | |
| uses: irongut/CodeCoverageSummary@v1.3.0 | |
| with: | |
| filename: 'coverage-reports/Cobertura.xml' | |
| badge: true | |
| format: markdown | |
| hide_branch_rate: false | |
| hide_complexity: false | |
| indicators: true | |
| fail_below_min: false | |
| output: both | |
| thresholds: '10 30' | |
| - name: Add coverage comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| recreate: true | |
| path: code-coverage-results.md | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: ${{ github.workspace }}/test-results/**/* | |
| retention-days: 3 | |
| - name: Publish test results | |
| uses: EnricoMi/publish-unit-test-result-action@v2.16.1 | |
| if: always() | |
| with: | |
| trx_files: ${{ github.workspace }}/**/*.trx | |
| build-image: | |
| if: github.ref_name == 'develop' | |
| runs-on: ubuntu-latest | |
| needs: [ 'build-and-test'] | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
| - name: Log in to GitHub container registry | |
| uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| - name: Lowercase the repo name and username | |
| run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
| - name: Build and push container image to registry | |
| uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | |
| with: | |
| push: true | |
| tags: ghcr.io/${{ env.REPO }}:dev.${{ github.sha }} | |
| file: ./web-api.dockerfile | |
| deploy: | |
| if: github.ref_name == 'develop' | |
| permissions: | |
| contents: none | |
| runs-on: ubuntu-latest | |
| needs: build-image | |
| environment: | |
| name: 'Development' | |
| url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
| steps: | |
| - name: Lowercase the repo name and username | |
| run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} | |
| - name: Login to Azure | |
| uses: azure/login@v1 | |
| with: | |
| creds: ${{ secrets.AZURE_SP_ECLIPSE_DEV_CICD }} | |
| - name: Deploy to Azure Web App | |
| id: deploy-to-webapp | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| images: 'ghcr.io/${{ env.REPO }}:dev.${{ github.sha }}' | |
| - name: Logout from Azure | |
| run: | | |
| az logout |