Skip to content

Commit 0eb7245

Browse files
Initial update for dbatools 2.0 (#8633)
1 parent 04c15d5 commit 0eb7245

File tree

81 files changed

+1665
-2267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1665
-2267
lines changed

.github/workflows/ci.yml

-17
This file was deleted.
+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Run Cross Platform Tests
2+
on: [push]
3+
defaults:
4+
run:
5+
shell: pwsh
6+
jobs:
7+
linux-tests:
8+
runs-on: ubuntu-latest
9+
env:
10+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Install and cache PowerShell modules
16+
uses: potatoqualitee/[email protected]
17+
with:
18+
modules-to-cache: dbatools.core.library:2022.11.8
19+
modules-to-cache-prerelease: dbatools.library:2022.11.8-preview
20+
21+
- name: Install and cache dbatools.library
22+
run: |
23+
Import-Module ./dbatools.psd1 -Force
24+
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register
25+
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value Optional -Register
26+
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning
27+
28+
- name: Setup docker images
29+
run: |
30+
# create a shared network
31+
docker network create localnet
32+
# Expose engine and endpoint then setup a shared path for migrations
33+
docker run -p 1433:1433 --volume shared:/shared:z --name mssql1 --hostname mssql1 --network localnet -d dbatools/sqlinstance
34+
# Expose second engine and endpoint on different port
35+
docker run -p 14333:1433 --volume shared:/shared:z --name mssql2 --hostname mssql2 --network localnet -d dbatools/sqlinstance2
36+
37+
- name: 👥 Clone appveyor repo
38+
working-directory: /tmp
39+
run: |
40+
gh repo clone dataplat/appveyor-lab
41+
42+
- name: Run tests
43+
env:
44+
TENANTID: ${{secrets.TENANTID}}
45+
CLIENTID: ${{secrets.CLIENTID}}
46+
CLIENTSECRET: ${{secrets.CLIENTSECRET}}
47+
run: |
48+
Import-Module ./dbatools.psd1 -Force
49+
Get-DbatoolsConfigValue -FullName sql.connection.trustcert | Write-Warning
50+
Get-DbatoolsConfigValue -FullName sql.connection.encrypt | Write-Warning
51+
$null = Invoke-Pester ./tests/gh-actions.ps1 -Output Detailed -PassThru
52+
53+
windows-tests:
54+
runs-on: windows-latest
55+
env:
56+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
57+
58+
steps:
59+
- name: Checkout dbatools repo
60+
uses: actions/checkout@v3
61+
62+
- name: Install and cache PowerShell modules
63+
uses: potatoqualitee/[email protected]
64+
with:
65+
shell: powershell, pwsh
66+
modules-to-cache: dbatools.core.library:2022.11.8
67+
modules-to-cache-prerelease: dbatools.library:2022.11.8-preview
68+
69+
- name: Install SQL Server localdb
70+
uses: potatoqualitee/[email protected]
71+
with:
72+
install: localdb
73+
74+
- name: Connect to localdb instance powershell
75+
shell: powershell
76+
run: |
77+
Import-Module ./dbatools -Force
78+
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -PassThru | Register-DbatoolsConfig -Scope FileUserShared
79+
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value Optional -PassThru | Register-DbatoolsConfig -Scope FileUserShared
80+
Connect-DbaInstance -SqlInstance "(localdb)\MSSQLLocalDB"
81+
82+
- name: Connect to localdb instance pwsh
83+
shell: pwsh
84+
run: |
85+
Import-Module ./dbatools -Force
86+
Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -PassThru | Register-DbatoolsConfig -Scope FileUserShared
87+
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value Optional -PassThru | Register-DbatoolsConfig -Scope FileUserShared
88+
Connect-DbaInstance -SqlInstance "(localdb)\MSSQLLocalDB"
89+
90+
- name: Run pwsh tests
91+
env:
92+
TENANTID: ${{secrets.TENANTID}}
93+
CLIENTID: ${{secrets.CLIENTID}}
94+
CLIENTSECRET: ${{secrets.CLIENTSECRET}}
95+
shell: pwsh
96+
run: $null = Invoke-Pester ./tests/gh-winactions.ps1 -Output Detailed -PassThru
97+
98+
- name: Run PowerShell tests
99+
env:
100+
TENANTID: ${{secrets.TENANTID}}
101+
CLIENTID: ${{secrets.CLIENTID}}
102+
CLIENTSECRET: ${{secrets.CLIENTSECRET}}
103+
shell: powershell
104+
run: $null = Invoke-Pester ./tests/gh-winactions.ps1 -Output Detailed -PassThru

.github/workflows/tests.yml

-69
This file was deleted.

.github/workflows/xplat-import.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Cross Platform Import
2+
on: [push]
3+
4+
jobs:
5+
build:
6+
name: Module imports on all platforms
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ubuntu-latest, windows-latest, macOS-latest]
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Install and cache PowerShell modules
17+
uses: potatoqualitee/[email protected]
18+
with:
19+
modules-to-cache: dbatools.core.library:2022.11.8
20+
modules-to-cache-prerelease: dbatools.library:2022.11.8-preview
21+
22+
- name: Perform the import
23+
shell: pwsh
24+
run: |
25+
Import-Module ./dbatools.psd1 -ErrorAction Stop
26+
(Get-DbaManagementObject).LoadTemplate -ne $null

appveyor.yml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ cache:
1515
- C:\ProgramData\chocolatey\lib -> appveyor.yml
1616
- C:\Program Files\WindowsPowerShell\Modules\PSScriptAnalyzer -> appveyor.yml
1717
- C:\Program Files\WindowsPowerShell\Modules\Pester -> appveyor.yml
18+
- C:\Program Files\WindowsPowerShell\Modules\dbatools.library -> dbatools.psd1
1819

1920
#shallow_clone: true
2021
clone_depth: 100
@@ -79,6 +80,8 @@ clone_folder: c:\github\dbatools
7980
before_test:
8081
# turn tests directory (at least) to CRLF, as it's faster to do this on the zipball rather than checking out the repo
8182
- cmd: pushd C:\github\dbatools\tests & unix2dos -q *.ps1 & popd
83+
# don't clown -- for some reason it's just not installing the library
84+
- ps: if (-not(Test-Path 'C:\Program Files\WindowsPowerShell\Modules\dbatools.library')) { Install-Module -Name dbatools.library -AllowPrerelease -Force | Out-Null }
8285
# grab appveyor lab files and needed requirements for tests in CI
8386
- ps: .\Tests\appveyor.prep.ps1
8487

0 commit comments

Comments
 (0)