odbcsv 1.1.1

Query an ODBC data source and print the result as csv.
name: Build and test

on: [push, pull_request]

jobs:
  win64:
    name: Build Win64
    runs-on: windows-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Install latests rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: x86_64-pc-windows-msvc
          default: true
          override: true

      # selecting a toolchain either by action or manual `rustup` calls should happen
      # before the plugin, as the cache uses the current rustc version as its cache key
      - name: Rust build cache
        uses: Swatinem/rust-cache@v2

      - name: Build
        run: cargo build --release

  win32:
    name: Build Win32
    runs-on: windows-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Install latests rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: i686-pc-windows-msvc
          default: true
          override: true

      # selecting a toolchain either by action or manual `rustup` calls should happen
      # before the plugin, as the cache uses the current rustc version as its cache key
      - name: Rust build cache
        uses: Swatinem/rust-cache@v2

      - name: Build
        run: cargo build --release

  osx:
    name: Build OS-X
    runs-on: macos-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Install unixODBC
        run: |
          brew install unixodbc

      - name: Install latests rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          default: true
          override: true

      - name: Build
        run: cargo build --release

  linux:
    name: Build & Test Linux
    runs-on: ubuntu-latest
    # Database services used for testing
    services:
      # Microsoft SQL Server
      sqlserver:
        image: mcr.microsoft.com/mssql/server:2019-latest
        ports:
          - 1433:1433
        env:
          ACCEPT_EULA: Y
          SA_PASSWORD: My@Test@Password1

      mariadb:
        image: mariadb
        ports:
          - 3306:3306
        env:
          MYSQL_ROOT_PASSWORD: my-secret-pw
          MYSQL_DATABASE: test_db

    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Install latest rust toolchain
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: stable
      - name: Install ODBC Drivers
        run: |
          sudo apt-get update
          sudo apt-get install -y unixodbc-dev odbc-mariadb msodbcsql18 devscripts

      - name: Print odbcinst.ini
        run: cat /etc/odbcinst.ini

      - name: Test
        run: cargo test



  dependabot:
    needs: [linux, win64, osx, win32]
    permissions:
      pull-requests: write
      contents: write
    runs-on: ubuntu-latest
    if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
    steps:
      - name: Merge Depenabot Pull Request
        run: gh pr merge --auto --rebase "$PR_URL"
        env:
          PR_URL: ${{github.event.pull_request.html_url}}
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}