Add Ecng_ prefix to all test DB table names and wire Entity attribute… #436
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: .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" |