Skip to content

Add API Tests

Add API Tests #84

Workflow file for this run

name: Build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
env:
ASPNETCORE_ENVIRONMENT: Test
jobs:
build:
name: Build
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
ports:
- 1433:1433
env:
ACCEPT_EULA: Y
SA_PASSWORD: SqlServer2019!
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install SonarCloud scanner
run: |
dotnet tool install --global dotnet-sonarscanner --version 5.14.0
- name: Install EF Core Tools
run: |
dotnet tool install --global dotnet-ef --version 7.0.14
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet ef database update -p src/Orion.Infra.Data -s src/Orion.Api --verbose
dotnet sonarscanner begin /k:"vanderlan_Orion-Api" /o:"vanderlan-gomes" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="opencover.xml"
dotnet build Orion.sln
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=coverage /p:Exclude=[xunit.*]* Orion.sln
cp tests/Orion.Test/coverage.opencover.xml opencover.xml
dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"