Merge pull request #174 from dotnetprojects/codex/migrator-provider-c… #335
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 Pull Request | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master, "codex/**"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: live-databases-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Test (${{ matrix.database }}) | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 35 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| database: [Unit, SQLite, SQLServer, PostgreSQL, Oracle, MySQL, MariaDB, Firebird, Db2, Informix, Sybase] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Start database | |
| shell: bash | |
| run: | | |
| mkdir -p TestResults | |
| bash .github/scripts/start-database.sh "${{ matrix.database }}" 2>&1 | tee TestResults/startup.log | |
| timeout-minutes: 15 | |
| - name: Build | |
| run: dotnet build Migrator.slnx -p:LiveDatabase=${{ matrix.database }} | |
| - name: Configure native IBM drivers | |
| if: matrix.database == 'Db2' || matrix.database == 'Informix' | |
| shell: bash | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libaio1 libxml2 unixodbc libncurses5 | |
| output="$GITHUB_WORKSPACE/src/Migrator.Tests/bin/Debug/net9.0" | |
| if [ "${{ matrix.database }}" = Db2 ]; then | |
| echo "DB2_CLI_DRIVER_INSTALL_PATH=$output/clidriver" >> "$GITHUB_ENV" | |
| echo "LD_LIBRARY_PATH=$output/clidriver/lib" >> "$GITHUB_ENV" | |
| else | |
| echo "DELIMIDENT=y" >> "$GITHUB_ENV" | |
| echo "INFORMIXDIR=$output/native" >> "$GITHUB_ENV" | |
| echo "LD_LIBRARY_PATH=$output/native/lib:$output/native/lib/cli:$output/native/lib/esql" >> "$GITHUB_ENV" | |
| fi | |
| - name: Test | |
| shell: pwsh | |
| run: ./.github/scripts/test.ps1 -Database ${{ matrix.database }} | |
| - name: Collect database logs | |
| if: always() | |
| run: | | |
| mkdir -p TestResults | |
| if docker inspect migrator-db >/dev/null 2>&1; then | |
| docker logs migrator-db > TestResults/database.log 2>&1 | |
| docker inspect migrator-db > TestResults/container.json | |
| fi | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.database }} | |
| path: TestResults/ | |
| if-no-files-found: error | |
| - name: Remove test container | |
| if: always() | |
| run: | | |
| if docker inspect migrator-db >/dev/null 2>&1; then | |
| docker rm -fv migrator-db | |
| fi | |
| coverage: | |
| name: Verify complete test coverage | |
| needs: test | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: test-results-* | |
| path: TestResults | |
| - run: python3 .github/scripts/verify-test-coverage.py TestResults |