Migrate from AppVeyor to GitHub Actions #3
Workflow file for this run
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: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| tests: | |
| name: Tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| services: | |
| sqlserver: | |
| image: mcr.microsoft.com/mssql/server:2022-latest | |
| env: | |
| ACCEPT_EULA: Y | |
| MSSQL_SA_PASSWORD: Your_strong_password123 | |
| ports: | |
| - 1433:1433 | |
| options: >- | |
| --health-cmd "bash -c '(/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P Your_strong_password123 -Q "SELECT 1" || exit 1)'" | |
| --health-interval 10s --health-timeout 5s --health-retries 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # need for GitVersion to work properly | |
| - name: Setup .NET SDK (global.json) | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| global-json-file: global.json | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Build Release | |
| run: dotnet build --no-restore -c Release DelegateDecompiler.sln | |
| - name: Patch App.config for SQL (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sed -i "s|Data Source=.;Initial Catalog=DelegateDecompilerEfTestDb;MultipleActiveResultSets=True;Trusted_Connection=True;TrustServerCertificate=True|Data Source=localhost,1433;Initial Catalog=DelegateDecompilerEfTestDb;User ID=sa;Password=Your_strong_password123;TrustServerCertificate=True;MultipleActiveResultSets=True|" src/DelegateDecompiler.EntityFramework.Tests/App.config | |
| - name: Patch App.config for SQL (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| (Get-Content src/DelegateDecompiler.EntityFramework.Tests/App.config) -replace 'Data Source=.;Initial Catalog=DelegateDecompilerEfTestDb;MultipleActiveResultSets=True;Trusted_Connection=True;TrustServerCertificate=True','Data Source=localhost,1433;Initial Catalog=DelegateDecompilerEfTestDb;User ID=sa;Password=Your_strong_password123;TrustServerCertificate=True;MultipleActiveResultSets=True' | Set-Content src/DelegateDecompiler.EntityFramework.Tests/App.config | |
| shell: powershell | |
| - name: Prepare database (create if not exists) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: >- | |
| /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P Your_strong_password123 -Q "IF DB_ID('DelegateDecompilerEfTestDb') IS NULL CREATE DATABASE DelegateDecompilerEfTestDb;" | |
| - name: Prepare database (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: >- | |
| sqlcmd -S localhost -U sa -P Your_strong_password123 -Q "IF DB_ID('DelegateDecompilerEfTestDb') IS NULL CREATE DATABASE DelegateDecompilerEfTestDb;" | |
| - name: Run tests (net8 & net9) | |
| run: | | |
| dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests | |
| dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.Tests.VB | |
| dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFramework.Tests | |
| dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore6.Tests | |
| dotnet test --no-build -c Release -f net8.0 src/DelegateDecompiler.EntityFrameworkCore8.Tests | |
| dotnet test --no-build -c Release -f net9.0 src/DelegateDecompiler.EntityFrameworkCore9.Tests |