Fix formatting #1989
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: Run Cross Platform Tests | |
on: | |
push: | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.json' | |
- '!.github/dbatools-library-version.json' | |
- 'docs/**' | |
- '.github/FUNDING.yml' | |
- '.github/ISSUE_TEMPLATE/**' | |
- '.github/PULL_REQUEST_TEMPLATE.md' | |
- '.aider/**' | |
- '.devcontainer/**' | |
- '.vscode/**' | |
- 'bin/**' | |
- 'en-us/**' | |
defaults: | |
run: | |
shell: pwsh | |
jobs: | |
linux-tests: | |
env: | |
SMODefaultModuleName: dbatools | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Read dbatools.library version | |
id: get-version | |
shell: pwsh | |
run: | | |
$versionConfig = Get-Content '.github/dbatools-library-version.json' | ConvertFrom-Json | |
$version = $versionConfig.version | |
$isPreview = $version -like "*preview*" | |
Write-Output "version=$version" >> $env:GITHUB_OUTPUT | |
Write-Output "is_preview=$isPreview" >> $env:GITHUB_OUTPUT | |
Write-Output "Using dbatools.library version: $version" | |
Write-Output "Is preview version: $isPreview" | |
- name: Install and cache PowerShell modules (stable versions) | |
if: steps.get-version.outputs.is_preview == 'False' | |
uses: potatoqualitee/[email protected] | |
with: | |
modules-to-cache: dbatools.library:${{ steps.get-version.outputs.version }} | |
- name: Install dbatools.library (preview versions) | |
if: steps.get-version.outputs.is_preview == 'True' | |
shell: pwsh | |
run: | | |
Write-Output "Preview version detected, bypassing PSModuleCache and using install script" | |
./.github/scripts/install-dbatools-library.ps1 | |
- name: Set encryption values | |
run: | | |
Import-Module ./dbatools.psd1 -Force | |
Get-Module dbatools.library | Select-Object -ExpandProperty Path -OutVariable lib | Write-Warning | |
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register | |
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value $false -Register | |
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning | |
mkdir /tmp/DbatoolsExport | |
- name: Setup docker images | |
run: | | |
# create a shared network | |
docker network create localnet | |
# Expose engine and endpoint then setup a shared path for migrations | |
docker run -p 1433:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet -d dbatools/sqlinstance | |
# Expose second engine and endpoint on different port | |
docker run -p 14333:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet -d dbatools/sqlinstance2 | |
- name: 👥 Clone appveyor repo | |
working-directory: /tmp | |
run: | | |
gh repo clone dataplat/appveyor-lab | |
- name: Install SqlPackage | |
shell: pwsh | |
run: | | |
Import-Module ./dbatools.psd1 -Force | |
Install-DbaSqlPackage -Force -Verbose | |
- name: Run tests | |
env: | |
TENANTID: ${{secrets.TENANTID}} | |
CLIENTID: ${{secrets.CLIENTID}} | |
CLIENTSECRET: ${{secrets.CLIENTSECRET}} | |
CLIENT_GUID: ${{secrets.CLIENT_GUID}} | |
CLIENT_GUID_SECRET: ${{secrets.CLIENT_GUID_SECRET}} | |
run: | | |
Import-Module ./dbatools.psd1 -Force | |
Get-DbatoolsConfigValue -FullName sql.connection.trustcert | Write-Warning | |
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning | |
$null = Invoke-Pester .github/scripts/gh-actions.ps1 -Output Detailed -PassThru | |
windows-tests: | |
env: | |
SMODefaultModuleName: dbatools | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
runs-on: windows-latest | |
steps: | |
- name: Checkout dbatools repo | |
uses: actions/checkout@v3 | |
- name: Read dbatools.library version | |
id: get-version | |
shell: pwsh | |
run: | | |
$versionConfig = Get-Content '.github/dbatools-library-version.json' | ConvertFrom-Json | |
$version = $versionConfig.version | |
$isPreview = $version -like "*preview*" | |
Write-Output "version=$version" >> $env:GITHUB_OUTPUT | |
Write-Output "is_preview=$isPreview" >> $env:GITHUB_OUTPUT | |
Write-Output "Using dbatools.library version: $version" | |
Write-Output "Is preview version: $isPreview" | |
- name: Install and cache PowerShell modules (stable versions) | |
if: steps.get-version.outputs.is_preview == 'False' | |
uses: potatoqualitee/[email protected] | |
with: | |
shell: powershell, pwsh | |
modules-to-cache: dbatools.library:${{ steps.get-version.outputs.version }} | |
- name: Install dbatools.library (preview versions) | |
if: steps.get-version.outputs.is_preview == 'True' | |
shell: pwsh | |
run: | | |
Write-Output "Preview version detected, bypassing PSModuleCache and using install script" | |
./.github/scripts/install-dbatools-library.ps1 | |
- name: Install SQL Server engine and localdb | |
uses: potatoqualitee/[email protected] | |
with: | |
install: localdb, sqlengine | |
- name: Connect to localdb instance powershell | |
shell: powershell | |
run: | | |
$env:PSModulePath -split ";" | Write-Warning | |
Import-Module ./dbatools -Force | |
(Get-Module dbatools.library).Path | Write-Warning | |
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -PassThru | Register-DbatoolsConfig -Scope FileUserShared | |
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value $false -PassThru | Register-DbatoolsConfig -Scope FileUserShared | |
Write-Host "Connecting to SQL Server instance (localdb)\MSSQLLocalDB..." | |
Connect-DbaInstance -SqlInstance "(localdb)\MSSQLLocalDB" | |
- name: Connect to SQL Server instance pwsh | |
shell: pwsh | |
run: | | |
Import-Module ./dbatools -Force | |
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -PassThru | Register-DbatoolsConfig -Scope FileUserShared | |
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value $false -PassThru | Register-DbatoolsConfig -Scope FileUserShared | |
$password = ConvertTo-SecureString "dbatools.I0" -AsPlainText -Force | |
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "sa", $password | |
$PSDefaultParameterValues["*:SqlInstance"] = "localhost" | |
$PSDefaultParameterValues["*:SqlCredential"] = $cred | |
Connect-DbaInstance | |
- name: Install SqlPackage | |
shell: pwsh | |
run: | | |
Import-Module ./dbatools.psd1 -Force | |
Install-DbaSqlPackage -Force -Verbose | |
- name: Run PowerShell tests | |
env: | |
TENANTID: ${{secrets.TENANTID}} | |
CLIENTID: ${{secrets.CLIENTID}} | |
CLIENTSECRET: ${{secrets.CLIENTSECRET}} | |
shell: powershell | |
run: $null = Invoke-Pester .github/scripts/gh-winactions.ps1 -Output Detailed -PassThru | |
- name: Run pwsh tests | |
env: | |
TENANTID: ${{secrets.TENANTID}} | |
CLIENTID: ${{secrets.CLIENTID}} | |
CLIENTSECRET: ${{secrets.CLIENTSECRET}} | |
CLIENT_GUID: ${{secrets.CLIENT_GUID}} | |
CLIENT_GUID_SECRET: ${{secrets.CLIENT_GUID_SECRET}} | |
shell: pwsh | |
run: $null = Invoke-Pester .github/scripts/gh-winactions.ps1 -Output Detailed -PassThru | |
macos-tests: | |
env: | |
SMODefaultModuleName: dbatools | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
runs-on: macos-latest | |
steps: | |
- name: Checkout dbatools repo | |
uses: actions/checkout@v3 | |
- name: Read dbatools.library version | |
id: get-version | |
shell: pwsh | |
run: | | |
$versionConfig = Get-Content '.github/dbatools-library-version.json' | ConvertFrom-Json | |
$version = $versionConfig.version | |
$isPreview = $version -like "*preview*" | |
Write-Output "version=$version" >> $env:GITHUB_OUTPUT | |
Write-Output "is_preview=$isPreview" >> $env:GITHUB_OUTPUT | |
Write-Output "Using dbatools.library version: $version" | |
Write-Output "Is preview version: $isPreview" | |
- name: Install and cache PowerShell modules (stable versions) | |
if: steps.get-version.outputs.is_preview == 'False' | |
uses: potatoqualitee/[email protected] | |
with: | |
modules-to-cache: dbatools.library:${{ steps.get-version.outputs.version }} | |
- name: Install dbatools.library (preview versions) | |
if: steps.get-version.outputs.is_preview == 'True' | |
shell: pwsh | |
run: | | |
Write-Output "Preview version detected, bypassing PSModuleCache and using install script" | |
./.github/scripts/install-dbatools-library.ps1 | |
- name: 👥 Clone appveyor repo | |
working-directory: /tmp | |
run: | | |
gh repo clone dataplat/appveyor-lab | |
- name: Install SqlPackage | |
shell: pwsh | |
run: | | |
Import-Module ./dbatools.psd1 -Force | |
Install-DbaSqlPackage -Force -Verbose | |
- name: Run macOS tests | |
env: | |
TENANTID: ${{secrets.TENANTID}} | |
CLIENTID: ${{secrets.CLIENTID}} | |
CLIENTSECRET: ${{secrets.CLIENTSECRET}} | |
CLIENT_GUID: ${{secrets.CLIENT_GUID}} | |
CLIENT_GUID_SECRET: ${{secrets.CLIENT_GUID_SECRET}} | |
shell: pwsh | |
run: | | |
$null = Import-Module ./dbatools.psd1 -Force | |
$null = Set-DbatoolsInsecureConnection | |
$null = Invoke-Pester .github/scripts/gh-macactions.ps1 -Output Detailed -PassThru |