Skip to content

Merge pull request #77 from Icinga/dependabot/go_modules/golang.org/x… #157

Merge pull request #77 from Icinga/dependabot/go_modules/golang.org/x…

Merge pull request #77 from Icinga/dependabot/go_modules/golang.org/x… #157

Workflow file for this run

name: Go Windows
on:
push:
tags:
- v*
branches:
- master
pull_request: {}
jobs:
build:
name: Integration Test
runs-on: windows-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build the program
run: go build
- name: Prepare WinRM on localhost
env:
TEST_USER_NAME: ci-test
TEST_USER_PASSWORD: foobar123.lang! # only used inside the CI run
WINRM_TLS_PORT: 5987
run: |
Write-Output "User name is: $Env:TEST_USER_NAME"
$pw = ConvertTo-SecureString -String $env:TEST_USER_PASSWORD -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $env:TEST_USER_NAME, $pw
New-LocalUser -Name $env:TEST_USER_NAME -Password $pw -Description "GitHub Action Test User"
Add-LocalGroupMember -Group Administrators -Member $env:TEST_USER_NAME
winrm quickconfig -force
winrm set winrm/config/service/Auth '@{Basic="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'
$cert = New-SelfSignedCertificate -TextExtension @("2.5.29.17={text}DNS=localhost&IPAddress=127.0.0.1&IPAddress=::1") -CertStoreLocation "cert:\LocalMachine\My"
# & Export-Certificate -Cert $cert -FilePath C:\cert
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address "IP:::1" -Port $env:WINRM_TLS_PORT -CertificateThumbPrint $cert.Thumbprint -force
winrm enumerate winrm/config/listener
- name: Restart WinRM and test it locally
env:
TEST_USER_NAME: ci-test
TEST_USER_PASSWORD: foobar123.lang! # only used inside the CI run
WINRM_TLS_PORT: 5987
run: |
Restart-Service winrm
$pw = ConvertTo-SecureString -String $env:TEST_USER_PASSWORD -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $env:TEST_USER_NAME, $pw
Test-WSMan -Computername localhost -Credential $cred -Authentication Negotiate
- name: Go Test
env:
WINRM_HOST: ::1
WINRM_USER: ci-test
WINRM_BASIC_USER: ci-test
WINRM_PASSWORD: foobar123.lang! # only used inside the CI run
WINRM_BASIC_PASSWORD: foobar123.lang! # only used inside the CI run
WINRM_INSECURE: 1
WINRM_TLS_PORT: 5987
run: go test -v ./...