generated from Avanade/avanade-template
-
Notifications
You must be signed in to change notification settings - Fork 7
72 lines (58 loc) · 2.54 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
# ubuntu-18.04 # cosmos emulator doesn't work on ubuntu 20 and 22: https://github.com/Qayme/qayme-action-cosmosdb-emulator
services:
# cosmos: # tests fail when cosmos has less than 4 CPUs assigned, but github free runners have only 2
# image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
# ports:
# - 8081:8081
# - 10251:10251
# - 10252:10252
# - 10253:10253
# - 10254:10254
# env:
# AZURE_COSMOS_EMULATOR_PARTITION_COUNT: 20
# AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE: false
# options: -m 4g --cpus=2.0
sql:
image: mcr.microsoft.com/mssql/server:2019-latest
ports:
- 1433:1433
env:
ACCEPT_EULA: Y
SA_PASSWORD: sAPWD23.^0
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
6.0.x
8.0.x
9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --filter "(TestCategory!=WithDB)&(TestCategory!=WithCosmos)&(TestCategory!=WithSolace)" --no-build --verbosity normal /p:CollectCoverage=true /p:Exclude="[CoreEx.TestFunction]*" /p:CoverletOutputFormat=lcov /p:CoverletOutput=./coverage/lcov.info
- name: Set EnvVar for Test
run: |
echo "ConnectionStrings__Database=Data Source=localhost,1433;Initial Catalog=My.Hr;User id=sa;Password=sAPWD23.^0;TrustServerCertificate=true" >> $GITHUB_ENV
- name: Create/Migrate DB
run: dotnet run all --project ./samples/My.Hr/My.Hr.Database --connection-varname ConnectionStrings__Database
- name: Test With DB
run: dotnet test --filter TestCategory=WithDB --no-build --verbosity normal /p:CollectCoverage=true /p:Exclude="[CoreEx.TestFunction]*" /p:CoverletOutputFormat=lcov /p:CoverletOutput=./coverage/lcov2.info
- name: Test With Cosmos DB TestCategory=WithCosmos
run: dotnet test --filter Category=WithCosmos --no-build --verbosity normal /p:CollectCoverage=true /p:Exclude="[CoreEx.TestFunction]*" /p:CoverletOutputFormat=lcov /p:CoverletOutput=./coverage/lcov3.info
if: ${{ false }}
#- name: Test Docker Build
# run: docker-compose -f docker-compose.myHr.yml -f docker-compose.myHr.override.yml build --build-arg LOCAL=true