Add EF Core 9 support #104
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: SingleStore EntityFramework Core | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| push: | |
| branches: [main] | |
| workflow_call: | |
| workflow_dispatch: | |
| env: | |
| DOTNET_VERSION: 9.0.101 | |
| LICENSE_KEY: ${{ secrets.LICENSE_KEY }} | |
| SQL_USER_PASSWORD: ${{ secrets.SQL_USER_PASSWORD }} | |
| S2MS_API_KEY: ${{ secrets.S2MS_API_KEY }} | |
| jobs: | |
| fetch-s2-versions: | |
| name: Fetch SingleStore supported versions | |
| runs-on: ubuntu-latest | |
| outputs: | |
| versions: ${{ steps.get_versions.outputs.versions }} | |
| steps: | |
| - name: Get supported versions of SingleStore | |
| id: get_versions | |
| uses: singlestore-labs/singlestore-supported-versions@main | |
| with: | |
| include_rc: true | |
| build-matrix: | |
| name: Build test matrix | |
| runs-on: ubuntu-latest | |
| needs: fetch-s2-versions | |
| outputs: | |
| matrix: ${{ steps.compose.outputs.matrix }} | |
| steps: | |
| - name: Install jq | |
| run: sudo apt-get update && sudo apt-get install -y jq | |
| - name: Compose matrix JSON | |
| id: compose | |
| env: | |
| VERSIONS: ${{ needs.fetch-s2-versions.outputs.versions }} | |
| run: | | |
| scripts='[ | |
| ".github/workflows/test_setup/run_functional_tests1.sh", | |
| ".github/workflows/test_setup/run_functional_tests2.sh" | |
| ]' | |
| version_rows=$(jq -cn --argjson versions "$VERSIONS" ' | |
| $versions | map({ | |
| name: ("SingleStore " + . + " connection test"), | |
| singlestore_version: (.) | |
| }) | |
| ') | |
| rows=$(jq -cn --argjson versions "$version_rows" --argjson scripts "$scripts" ' | |
| [ | |
| $versions[] as $v | | |
| $scripts[] as $s | | |
| ($v + { func_test_script: $s }) | |
| ] | |
| ') | |
| matrix=$(jq -cn --argjson rows "$rows" '{ include: $rows }') | |
| echo "matrix=$matrix" >> "$GITHUB_OUTPUT" | |
| test-ubuntu: | |
| name: ${{ matrix.name }} | |
| runs-on: ubuntu-22.04 | |
| needs: build-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Remove unnecessary pre-installed toolchains for free disk spaces | |
| run: ./.github/workflows/test_setup/free_disk_space.sh | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt install snapd | |
| sudo apt-get install -y mariadb-client-core-10.6 | |
| sudo apt-get install -y mariadb-client-10.6 | |
| - name: Install Powershell | |
| run: sudo snap install powershell --classic | |
| - name: Extra Docker cleanup before starting SingleStore | |
| run: | | |
| docker ps -a || true | |
| docker rm -f singlestore-integration || true | |
| docker system prune -af || true | |
| docker volume prune -f || true | |
| df -h | |
| - name: Start SingleStore Cluster | |
| run: | | |
| ./.github/workflows/test_setup/setup_cluster.sh | |
| env: | |
| SINGLESTORE_VERSION: ${{ matrix.singlestore_version }} | |
| - name: Copy test config | |
| run: | | |
| for dir in EFCore.SingleStore.Tests EFCore.SingleStore.IntegrationTests EFCore.SingleStore.FunctionalTests; do | |
| cp ./.github/workflows/test_setup/config.json test/$dir/config.json | |
| sed -i "s|SINGLESTORE_HOST|127.0.0.1|g" test/$dir/config.json | |
| sed -i "s|SQL_USER_PASSWORD|${SQL_USER_PASSWORD}|g" test/$dir/config.json | |
| sed -i "s|SQL_USER_NAME|root|g" test/$dir/config.json | |
| done | |
| - name: Build provider | |
| run: dotnet build SingleStore.EFCore.sln -c Release | |
| - name: Run Unit Tests | |
| run: dotnet test test/EFCore.SingleStore.Tests -f net9.0 -c Release --no-build | |
| - name: Rebuild migrations | |
| run: pwsh ./test/EFCore.SingleStore.IntegrationTests/scripts/rebuild.ps1 | |
| - name: Run Integration Tests | |
| run: dotnet test test/EFCore.SingleStore.IntegrationTests -f net9.0 -c Release --no-build | |
| - name: Run Functional Tests ${{ matrix.singlestore_version }} - ${{ matrix.func_test_script }} | |
| run: ${{ matrix.func_test_script }} | |
| test-windows: | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| func_test_block_path: | |
| - .\.github\workflows\test_setup\run-functional-tests1.ps1 | |
| - .\.github\workflows\test_setup\run-functional-tests2.ps1 | |
| - .\.github\workflows\test_setup\run-functional-tests3.ps1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Python and pip dependencies | |
| run: | | |
| pip install singlestoredb | |
| - name: Start SingleStore Cluster | |
| run: | | |
| python .github\workflows\test_setup\s2ms_cluster.py start singlestoretest | |
| - name: Fill config for tests | |
| run: | | |
| python .github\workflows\test_setup\fill_test_config.py EFCore.SingleStore.Tests | |
| python .github\workflows\test_setup\fill_test_config.py EFCore.SingleStore.IntegrationTests | |
| python .github\workflows\test_setup\fill_test_config.py EFCore.SingleStore.FunctionalTests | |
| - name: Install .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Build binaries | |
| run: dotnet build SingleStore.EFCore.sln -c Release | |
| - name: Run EFCore.SingleStore.Tests | |
| run: .\.github\workflows\test_setup\run-test-windows.ps1 -test_block EFCore.SingleStore.Tests -target_framework net9.0 | |
| - name: Rebuild migrations | |
| run: .\test\EFCore.SingleStore.IntegrationTests\scripts\rebuild.ps1 | |
| - name: Run EFCore.SingleStore.IntegrationTests | |
| run: .\.github\workflows\test_setup\run-test-windows.ps1 -test_block EFCore.SingleStore.IntegrationTests -target_framework net9.0 | |
| - name: Run Functional Test Block | |
| run: ${{ matrix.func_test_block_path }} | |
| - name: Terminate Cluster | |
| if: always() | |
| run: python .github\workflows\test_setup\s2ms_cluster.py terminate | |
| publish: | |
| runs-on: windows-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Build | |
| run: dotnet build .\src\EFCore.SingleStore\EFCore.SingleStore.csproj -c Release | |
| - name: Pack NuGet | |
| run: dotnet pack .\src\EFCore.SingleStore\EFCore.SingleStore.csproj -c Release -o efcore_provider | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: efcore-provider | |
| path: efcore_provider/ |