From 1980f43b662619e39902371a5396852e73906a3c Mon Sep 17 00:00:00 2001 From: Andrea Spadaccini Date: Mon, 29 Jul 2019 17:26:22 +0100 Subject: [PATCH] Move tools for ci/cd in the tools directory --- azure-pipelines.yml | 8 ++++---- restore.ps1 => tools/restore.ps1 | 5 +++-- run-tests.ps1 => tools/run-tests.ps1 | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) rename restore.ps1 => tools/restore.ps1 (67%) rename run-tests.ps1 => tools/run-tests.ps1 (63%) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0307cd8..4421fed 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,13 +19,13 @@ jobs: - task: PowerShell@2 displayName: Restore inputs: - filePath: './restore.ps1' + filePath: 'tools/restore.ps1' pwsh: true - task: PowerShell@2 displayName: Test inputs: - filePath: './run-tests.ps1' + filePath: 'tools/run-tests.ps1' pwsh: true - job: WindowsPowershell @@ -35,9 +35,9 @@ jobs: - task: PowerShell@2 displayName: Restore inputs: - filePath: './restore.ps1' + filePath: 'tools/restore.ps1' - task: PowerShell@2 displayName: Test inputs: - filePath: './run-tests.ps1' + filePath: 'tools/run-tests.ps1' diff --git a/restore.ps1 b/tools/restore.ps1 similarity index 67% rename from restore.ps1 rename to tools/restore.ps1 index d58cd16..7551222 100644 --- a/restore.ps1 +++ b/tools/restore.ps1 @@ -2,12 +2,13 @@ param ( [switch] $Clean, [switch] $List = $false ) -$outputDir = "External" +$parentDir = Split-Path -Parent (Split-Path -Parent $PSCommandPath) +$outputDir = Join-Path $parentDir -ChildPath "External" if ($Clean) { Remove-Item -Path $outputDir -Recurse -Force } else { - dotnet restore --packages $outputDir --force + dotnet restore $parentDir --packages $outputDir --force if (-not $?) { Write-Error "Could not install packages." -ErrorAction Stop diff --git a/run-tests.ps1 b/tools/run-tests.ps1 similarity index 63% rename from run-tests.ps1 rename to tools/run-tests.ps1 index 153f2de..908b385 100644 --- a/run-tests.ps1 +++ b/tools/run-tests.ps1 @@ -1,7 +1,8 @@ # Mostly for use of CI/CD. Install Pester and run tests. +$parentDir = Split-Path -Parent (Split-Path -Parent $PSCommandPath) Install-Module Pester -Force -Scope CurrentUser -$FailedTests = Invoke-Pester -EnableExit +$FailedTests = Invoke-Pester $parentDir -EnableExit if ($FailedTests -gt 0) { Write-Error "Error: $FailedTests Pester tests failed." exit $FailedTests