Skip to content

Fixed pipelines

Fixed pipelines #644

Workflow file for this run

name: Cargo Tests
on:
push:
branches: [ main ]
pull_request:
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5 # checkout versions have been updated. previous v1/2
- uses: dtolnay/rust-toolchain@stable # changed to stable
with:
components: rustfmt, clippy
- name: Install dependencies
run: sudo apt install -y openssl libkrb5-dev
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --features=all
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
cargo-test-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
engine: [ 2017, 2019, 2022, "azure" ]
features: [ "--features=all", "--no-default-features", "--no-default-features --features=chrono", "--no-default-features --features=rustls", "--no-default-features --features=time", "--no-default-features --features=vendored-openssl" ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libkrb5-dev krb5-user
sudo ln -s /usr/include/krb5/gssapi /usr/include/gssapi || true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Build xtask
working-directory: xtask
run: cargo build --bin xtask
- name: Clean up any SQL containers
run: |
docker rm -f mssql-${{ matrix.engine }} || true
docker ps -a
- name: Start SQL server container
working-directory: xtask
run: cargo run -p xtask -- container ${{ matrix.engine }}
env:
SA_PASSWORD: "<YourStrong@Passw0rd>"
- name: Wait for SQL Server
run: |
echo "Waiting for SQL server (${{ matrix.engine }}) to be ready..."
sleep 25
- name: Run tests
working-directory: xtask
env:
TIBERIUS_TEST_CONNECTION_STRING: "server=tcp:localhost,1433;user=sa;password=<YourStrong@Passw0rd>;TrustServerCertificate=true"
run: cargo run -p xtask -- test -- ${{ matrix.features }}
- name: Stop SQL server container
working-directory: xtask
if: always()
run: cargo run -p xtask -- stop ${{ matrix.engine }}
- name: Build xtask local
working-directory: xtask
run: cargo build --bin xtask
- name: Clean up any SQL containers
run: |
docker rm -f mssql-${{ matrix.engine }} || true
docker ps -a
- name: Start SQL server local
working-directory: xtask
run: cargo run -p xtask -- local ${{ matrix.engine }}
env:
SA_PASSWORD: "<YourStrong@Passw0rd>"
- name: Wait for SQL server local
run: |
echo "Waiting for SQL server (${{ matrix.engine }}) to be ready..."
sleep 25
- name: Run tests local
working-directory: xtask
env:
TIBERIUS_TEST_CONNECTION_STRING: "server=tcp:localhost,1433;user=sa;password=<YourStrong@Passw0rd>;TrustServerCertificate=true"
run: cargo run -p xtask -- test -- ${{ matrix.features }}
- name: Stop SQL server container
working-directory: xtask
if: always()
run: cargo run -p xtask -- stop ${{ matrix.engine }}
cargo-test-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
database:
- 2019
features:
- "--features=all"
- "--no-default-features --features=rustls,winauth"
- "--no-default-features --features=vendored-openssl,winauth"
env:
TIBERIUS_TEST_INSTANCE: "MSSQLSERVER"
TIBERIUS_TEST_CONNECTION_STRING: "server=tcp:127.0.0.1,1433;IntegratedSecurity=true;TrustServerCertificate=true"
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Set required PowerShell modules
id: psmodulecache
uses: potatoqualitee/psmodulecache@v1
with:
modules-to-cache: SqlServer
- name: Setup PowerShell module cache
id: cacher
uses: actions/cache@v4 # cache updated to v4
with:
path: ${{ steps.psmodulecache.outputs.modulepath }}
key: ${{ steps.psmodulecache.outputs.keygen }}
- name: Setup Chocolatey download cache
id: chococache
uses: actions/cache@v4
with:
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey\
key: chocolatey-install
- name: Setup Cargo build cache
uses: actions/cache@v4
with:
path: |
C:\Users\runneradmin\.cargo\registry
C:\Users\runneradmin\.cargo\git
target
key: ${{ runner.os }}-cargo
- name: Install required PowerShell modules
if: steps.cacher.outputs.cache-hit != 'true'
shell: powershell
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module SqlServer
- name: Install SQL Server ${{matrix.database}}
shell: powershell
run: |
choco feature disable --name="'exitOnRebootDetected'"
$ErrorActionPreference = 'SilentlyContinue'
choco install sql-server-${{matrix.database}} --params="'/IgnorePendingReboot'"
- name: Setup SQL Server ${{matrix.database}}
shell: powershell
run: |
Import-Module 'sqlps'
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null
$serverName = $env:COMPUTERNAME
$instanceName = "MSSQLSERVER"
$smo = 'Microsoft.SqlServer.Management.Smo.'
$wmi = new-object ($smo + 'Wmi.ManagedComputer')
$wmi
# Enable TCP/IP
echo "Enabling TCP/IP"
$Tcp = $wmi.GetSmoObject("ManagedComputer[@Name='$serverName']/ServerInstance[@Name='$instanceName']/ServerProtocol[@Name='Tcp']")
$Tcp.IsEnabled = $true
$Tcp.alter()
$Tcp
# Enable named pipes
echo "Enabling named pipes"
$Np = $wmi.GetSmoObject("ManagedComputer[@Name='$serverName']/ServerInstance[@Name='$instanceName']/ServerProtocol[@Name='Np']")
$Np.IsEnabled = $true
$Np.Alter()
$Np
# Set Alias
echo "Setting the alias"
New-Item HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client -Name ConnectTo | Out-Null
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo -Name '(local)' -Value "DBMSSOCN,$serverName\$instanceName" | Out-Null
# Start services
echo "Starting services"
Set-Service SQLBrowser -StartupType Manual
Start-Service SQLBrowser
net stop MSSQLSERVER
net start MSSQLSERVER
- name: Run normal tests
shell: powershell
run: cargo test ${{matrix.features}}