Skip to content

Commit

Permalink
Merge pull request #8 from brunovicenteb/feature_test
Browse files Browse the repository at this point in the history
Feature test
  • Loading branch information
brunovicenteb authored Jul 21, 2023
2 parents 3645b02 + 68c849c commit a7e40ab
Showing 1 changed file with 14 additions and 46 deletions.
60 changes: 14 additions & 46 deletions .github/workflows/Build-Test-Coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,31 @@ name: Build-Test-Coverage

on:
push:
branches: [ main ]
branches: [ main, develop, feature* ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
input:
description: "Execute tests"
required: false
default: "Execute tests manually"

env:
TESTS_PROJECT_PATH: ./src/Test
PROJECT_PATH: ./src/Test/Mttechne.Test.csproj

branches: [ main, develop, feature* ]

jobs:
Build-Test:
runs-on: ubuntu-latest
environment: pipelines
strategy:
matrix:
dotnet-version: ['7.0.x']



steps:
- uses: actions/checkout@v3
- name: Setup .NET 7
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x

- name: Restore Dependencies
run: dotnet restore ${{ env.PROJECT_PATH }}

- name: Build
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore

- name: MSTest+Coverlet

- name: echo
env:
IMDB_API_KEY: ${{ secrets.IMDB_API_KEY }}
run: dotnet test ${{ env.TESTS_PROJECT_PATH }} --logger:"html;LogFileName=resultado-testes.html" --collect:"XPlat Code Coverage"

- name: Install ReportGenerator
if: always()
run: dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.8.4
LATEST_TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || format('latest-{0}', github.ref_name) }}
run: echo "today is ${{env.LATEST_TAG}}"

- name: Generate cover tests reports with ReportGenerator
if: success()
run: |
cd ${{ env.TESTS_PROJECT_PATH }}/TestResults
cd $(ls -d */|head -n 1)
reportgenerator "-reports:coverage.cobertura.xml" "-targetdir:coveragereport" -reporttypes:Html
- name: Upload UnitTest and Cover Reports as Artifacts
uses: actions/[email protected]
- name: test
env:
TESTS_PROJECT_PATH: ${{ env.TESTS_PROJECT_PATH }}/TestResults/
if: always()
with:
name: resultado-testes
path: ${{ env.TESTS_PROJECT_PATH }}
retention-days: 30
LATEST_TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || format('latest-{0}', github.ref_name) }}
if: ${{ success() && (github.ref == 'refs/heads/main' || github.ref_name == 'refs/heads/develop' || startsWith(github.ref_name, 'hotfix') || startsWith(github.ref_name, 'release')) }}
run: |
echo "today is ${{env.LATEST_TAG}}"

0 comments on commit a7e40ab

Please sign in to comment.