|
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | build: |
11 | | - runs-on: windows-latest |
| 11 | + runs-on: ubuntu-latest |
| 12 | + services: |
| 13 | + sqlserver: |
| 14 | + image: mcr.microsoft.com/mssql/server:2022-latest |
| 15 | + env: |
| 16 | + SA_PASSWORD: "P@ssw0rd12345!" |
| 17 | + ACCEPT_EULA: "Y" |
| 18 | + ports: |
| 19 | + - 1433:1433 |
12 | 20 | steps: |
13 | 21 | - uses: actions/checkout@v4 |
14 | 22 |
|
15 | | - - name: Setup NuGet |
16 | | - uses: nuget/setup-nuget@v2 |
17 | | - |
18 | | - - name: Restore NuGet packages |
19 | | - run: nuget restore PosInformatique.Database.Updater.sln |
20 | | - |
21 | | - - name: Add msbuild to PATH |
22 | | - uses: microsoft/setup-msbuild@v2 |
23 | | - |
24 | | - - name: Build |
25 | | - run: msbuild "PosInformatique.Database.Updater.sln" /p:Configuration=Debug |
| 23 | + - name: Setup .NET |
| 24 | + uses: actions/setup-dotnet@v4 |
| 25 | + with: |
| 26 | + dotnet-version: 8.0.x |
26 | 27 |
|
27 | | - - name: Creates the LocalDB for the tests |
28 | | - shell: cmd |
29 | | - run: SqlLocalDB create posinfo-tests |
| 28 | + - name: Restore dependencies |
| 29 | + run: dotnet restore PosInformatique.Database.Updater.sln |
30 | 30 |
|
31 | | - - name: Creates the SQL Login service accounts for the tests |
32 | | - shell: cmd |
33 | | - run: sqlcmd -S "(localDB)\posinfo-tests" -Q "IF NOT EXISTS (SELECT 1 FROM [sys].[server_principals] WHERE [Name] = 'ServiceAccountLogin') CREATE LOGIN [ServiceAccountLogin] WITH PASSWORD = 'P@ssw0rd'" |
| 31 | + - name: Build solution |
| 32 | + run: dotnet build PosInformatique.Database.Updater.sln --configuration Release --no-restore |
34 | 33 |
|
35 | 34 | - name: Run tests |
36 | | - run: dotnet test --no-build --verbosity normal |
37 | | - |
38 | | - # Use this fix https://github.com/microsoft/vstest-action/issues/31#issuecomment-2159463764 |
39 | | - - name: Test with the dotnet CLI |
40 | | - uses: rusty-bender/vstest-action@main |
| 35 | + run: | |
| 36 | + dotnet test PosInformatique.Database.Updater.sln \ |
| 37 | + --configuration Release \ |
| 38 | + --no-build \ |
| 39 | + --logger "trx;LogFileName=test_results.trx" \ |
| 40 | + --results-directory ./TestResults |
| 41 | + env: |
| 42 | + DATABASE_UPDATER_UNIT_TESTS_CONNECTION_STRING: "Data Source=localhost,1433;Database=master;User Id=sa;Password=P@ssw0rd12345!;TrustServerCertificate=True;" |
| 43 | + |
| 44 | + - name: Publish Test Results |
| 45 | + uses: EnricoMi/publish-unit-test-result-action@v2 |
| 46 | + if: (!cancelled()) |
41 | 47 | with: |
42 | | - searchFolder: .\ |
43 | | - testAssembly: | |
44 | | - /tests/**/*.tests.dll |
45 | | - !./**/*TestAdapter.dll |
46 | | - !./**/obj/** |
| 48 | + files: | |
| 49 | + TestResults/**/*.trx |
0 commit comments