Fixed pipelines #639
Workflow file for this run
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: 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" ] # "--no-default-features --features=rustls,chrono,time,tds73,sql-browser-async-std,sql-browser-tokio,sql-browser-smol,integrated-auth-gssapi,rust_decimal,bigdecimal", | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - name: Install MIT Kerberos headers | |
# 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 | |
# # this is where it runs | |
# - name: Make start_container.sh executable | |
# run: chmod +x start_container.sh | |
# # - name: Run xtask | |
# # run: cargo run --bin xtask | |
# # - name: Start SQL Server (xtask) | |
# # run: cargo xtask container ${{ matrix.engine }} | |
# # - name: Run tests (xtask) | |
# # run: cargo xtask test -- ${{ matrix.features }} | |
# # - name: Stop SQL Server (xtask) | |
# # if: always() | |
# # run: cargo xtask stop ${{ matrix.engine }} | |
# - name: Start SQL Server container | |
# run: ./start_container.sh ${{ matrix.engine }} | |
# - name: Wait for SQL Server to start | |
# run: | | |
# echo "Waiting for SQL Server..." | |
# sleep 25 | |
# - name: Install nightly Rust | |
# run: | | |
# rustup install nightly | |
# rustup override set nightly | |
# rustup component add clippy rustfmt | |
# - name: Run Cargo tests | |
# env: | |
# TIBERIUS_TEST_CONNECTION_STRING: "server=tcp:localhost,1433;user=sa;password=<YourStrong@Passw0rd>;TrustServerCertificate=true" | |
# run: | | |
# echo "Features: ${{ matrix.features }}" | |
# IFS=' ' read -r -a FLAGS <<< "${{ matrix.features }}" | |
# cargo test "${FLAGS[@]}" | |
# - name: Stop SQL container | |
# if: always() | |
# run: docker rm -f mssql-${{ matrix.engine }} || true | |
# 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 ps -a | |
# docker rm -f $(docker ps -aq --filter "ancestor=mcr.microsoft.com/mssql/server:2019-latest" --filter "status=running") || true | |
# docker rm -f mssql-2019 || true | |
# - name: Start SQL Server container | |
# # run: cargo xtask container ${{ matrix.engine }} | |
# working-directory: ./xtask | |
# run: cargo run -p xtask -- container ${{ matrix.engine }} | |
# env: | |
# SA_PASSWORD: "<YourStrong@Passw0rd>" | |
# - name: Wait for SQL Server | |
# run: cargo xtask local 2019 | |
# - name: Run tests | |
# env: | |
# TIBERIUS_TEST_CONNECTION_STRING: "server=tcp:localhost,1433;user=sa;password=<YourStrong@Passw0rd>;TrustServerCertificate=true" | |
# run: cargo xtask test -- ${{ matrix.features }} | |
# - name: Stop SQL Server container | |
# if: always() | |
# run: cargo xtask stop ${{ matrix.engine }} | |
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 | |
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 | |
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 | |
env: | |
TIBERIUS_TEST_CONNECTION_STRING: "server=tcp:localhost,1433;user=sa;password=<YourStrong@Passw0rd>;TrustServerCertificate=true" | |
run: cargo xtask test -- ${{ matrix.features }} | |
- name: Stop SQL Server container | |
if: always() | |
run: cargo 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}} |