1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/win_psrepository/tasks/main.yml

42 lines
1.2 KiB
YAML
Raw Normal View History

# This file is part of Ansible
# Copyright: (c) 2018, Wojciech Sciesinski <wojciech[at]sciesinski[dot]net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
---
- name: get PowerShell version
win_shell: '$PSVersionTable.PSVersion.Major'
register: powershell_major_version
- name: Perform integration tests for Powershell 5+
when: powershell_major_version.stdout | int >= 5
block:
- name: update NuGet version
win_shell: |
$nuget_exists = (Get-PackageProvider | Where-Object { $_.Name -eq 'Nuget' } | Measure-Object).Count -eq 1
if ( $nuget_exists ) {
$nuget_outdated = (Get-PackageProvider -Name NuGet -ErrorAction Ignore).Version -lt [Version]"2.8.5.201"
}
if ( -not $nuget_exists -or $nuget_outdated ) {
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
}
- name: ensure test repository is deleted
win_psrepository:
name: '{{ repository_name }}'
state: absent
- name: run all tests
include_tasks: tests.yml
always:
- name: ensure test repository is deleted after tests run
win_psrepository:
name: '{{ repository_name }}'
state: absent