-
Notifications
You must be signed in to change notification settings - Fork 9
151 lines (127 loc) · 5.49 KB
/
dotnet.yml
File metadata and controls
151 lines (127 loc) · 5.49 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: .NET Tests
on:
push:
branches: [ master ]
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Run tests
env:
BACKUP_AWS_REGION: ${{ secrets.BACKUP_AWS_REGION }}
BACKUP_AWS_BUCKET: ${{ secrets.BACKUP_AWS_BUCKET }}
BACKUP_AWS_ACCESS_KEY: ${{ secrets.BACKUP_AWS_ACCESS_KEY }}
BACKUP_AWS_SECRET_KEY: ${{ secrets.BACKUP_AWS_SECRET_KEY }}
BACKUP_AZURE_CONNECTION_STRING: ${{ secrets.BACKUP_AZURE_CONNECTION_STRING }}
BACKUP_AZURE_CONTAINER: ${{ secrets.BACKUP_AZURE_CONTAINER }}
BACKUP_MEGA_EMAIL: ${{ secrets.BACKUP_MEGA_EMAIL }}
BACKUP_MEGA_PASSWORD: ${{ secrets.BACKUP_MEGA_PASSWORD }}
BACKUP_YANDEX_TOKEN: ${{ secrets.BACKUP_YANDEX_TOKEN }}
NUGET_PRIVATE_URL: ${{ secrets.NUGET_PRIVATE_URL }}
NUGET_PRIVATE_API_KEY: ${{ secrets.NUGET_PRIVATE_API_KEY }}
NUGET_PRIVATE_PACKAGE_ID: ${{ secrets.NUGET_PRIVATE_PACKAGE_ID }}
NUGET_PRIVATE_PACKAGE_VERSION: ${{ secrets.NUGET_PRIVATE_PACKAGE_VERSION }}
run: dotnet test Ecng.slnx --no-build --configuration Release --settings Tests/test.runsettings --filter "FullyQualifiedName!~Azure&TestCategory!=Integration"
database:
name: Database Integration
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: ecng
POSTGRES_PASSWORD: ecng_test_ci
POSTGRES_DB: ecng_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U ecng"
--health-interval 10s
--health-timeout 5s
--health-retries 5
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: EcngTest_CI_2024!
ports:
- 1433:1433
options: >-
--health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'EcngTest_CI_2024!' -C -Q 'SELECT 1' || /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'EcngTest_CI_2024!' -Q 'SELECT 1'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
10.0.x
- name: Wait for SQL Server and create test database
run: |
# Install sqlcmd
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc > /dev/null
echo "$(curl -sSL https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list)" | sudo tee /etc/apt/sources.list.d/mssql-release.list > /dev/null
sudo apt-get update -qq
sudo ACCEPT_EULA=Y apt-get install -y -qq mssql-tools18 > /dev/null 2>&1 || true
# Wait for SQL Server to be ready and create database
for i in $(seq 1 30); do
/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'EcngTest_CI_2024!' -C -Q "CREATE DATABASE ecng_test" 2>/dev/null && echo "Database created" && break
echo "Waiting for SQL Server... ($i)"
sleep 2
done
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Run database integration tests
env:
PG_CONNECTION_STRING: "Host=localhost;Port=5432;Database=ecng_test;Username=ecng;Password=ecng_test_ci"
SQLSERVER_CONNECTION_STRING: "Server=localhost,1433;Database=ecng_test;User Id=sa;Password=EcngTest_CI_2024!;TrustServerCertificate=True"
run: dotnet test Tests/Tests.csproj --no-build --configuration Release --settings Tests/test.runsettings --filter "TestCategory=Database" -f net10.0
azurite:
name: Azure (Azurite)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
10.0.x
- name: Install and start Azurite
run: |
npm install -g azurite
azurite --skipApiVersionCheck --silent &
sleep 3
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Run Azure test (Azurite)
env:
BACKUP_AZURE_CONTAINER: ecng-ci-${{ github.run_id }}-${{ github.run_attempt }}
BACKUP_AZURE_CONNECTION_STRING: "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;"
run: dotnet test Tests/Tests.csproj --no-build --configuration Release --settings Tests/test.runsettings --filter "FullyQualifiedName~Azure"