Skip to content

no test on iodbc

no test on iodbc #84

Workflow file for this run

name: Tests
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run formatter
run: cargo fmt
- name: Commit changes
run: |
if [[ `git status --porcelain` ]]; then
git config user.name "github-actions[bot]"
# Make formatting commits look lie they'r authored by the official github-actions[bot]
# instead of an anonymous user account.
# For the id see: https://api.github.com/users/github-actions%5Bbot%5D
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "style: formattig"
git push
fi
test:
needs: [format]
name: ${{ matrix.features || 'dynamic unixodbc' }} on ${{ matrix.target }}
runs-on: ${{ contains(matrix.target, 'windows') && 'windows-latest' || contains(matrix.target, 'darwin') && 'macos-latest' || 'ubuntu-latest' }}
strategy:
matrix:
target: ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin"]
features: ["", "iodbc", "vendored-unix-odbc"]
include: # windows always links dynamically to the system's driver manager
- target: "x86_64-pc-windows-msvc"
features: ""
- target: "i686-pc-windows-msvc"
features: ""
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
submodules: "recursive"
- if: ${{ contains(matrix.target, 'linux') }}
run: sudo apt-get update && sudo apt-get install -y libsqliteodbc ${{ matrix.features == '' && 'unixodbc-dev' || matrix.features == 'iodbc' && 'libiodbc2-dev' || '' }}
- if: ${{ contains(matrix.target, 'darwin') }}
run: |
brew install sqliteodbc ${{ matrix.features == '' && 'unixodbc' || matrix.features == 'iodbc' && 'libiodbc' || '' }}
cat > /tmp/sqlite3_driver.ini << 'EOF'
[SQLITE3]
Description=SQLite ODBC Driver
Driver=/opt/homebrew/lib/libsqlite3odbc.dylib
Setup=/opt/homebrew/lib/libsqlite3odbc.dylib
EOF
odbcinst -i -d -f /tmp/sqlite3_driver.ini
- if: ${{ contains(matrix.target, 'windows') && matrix.target == 'x86_64-pc-windows-msvc' }}
run: curl -L -o sqliteodbc.exe http://www.ch-werner.de/sqliteodbc/sqliteodbc${{ contains(matrix.target, 'x86_64') && '_w64' || '' }}.exe && ./sqliteodbc.exe /S
shell: bash
- run: cargo clippy --all-targets --features "${{ matrix.features }}" -- -D warnings
- run: cargo test -p odbc-sys
--target "${{ matrix.target }}"
--features "${{ matrix.features }}"
-- ${{ matrix.features != 'vendored-unix-odbc' && matrix.features != 'iodbc' && '--include-ignored' || '' }} # ignored tests depend on the sqlite driver
# Verify that the build script does nothing nasty, which would prevent publishing to crates.io
test_publish_unix_odbc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Test publish to crates.io
run: cargo publish -p unix-odbc --dry-run