Skip to content

Commit

Permalink
ci: Test locally with WinRM on GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lazyfrosch committed Aug 31, 2020
1 parent d773e5b commit d0783e3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/workflows/go-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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@v1

- name: Prepare WinRM on localhost
env:
TEST_USER_NAME: ci-test
TEST_USER_PASSWORD: ${{ secrets.WINDOWS_TEST_USER_RANDOM_PASSWORD }} # only used inside the CI run
run: |
$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"}'
& winrm enumerate winrm/config/listener
Restart-Service winrm
Test-WSMan -Computername localhost -Credential $cred -Authentication Negotiate
- name: Go Test
env:
WINRM_HOST: localhost
WINRM_USER: ci-test
WINRM_PASSWORD: ${{ secrets.WINDOWS_TEST_USER_RANDOM_PASSWORD }} # only used inside the CI run
WINRM_SKIP_TLS: 1 # TODO: enable when HTTPs listener has been properly configured
WINRM_INSECURE: 1

run: go test -v ./...
2 changes: 1 addition & 1 deletion check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"
)

const DefaultTimeout = 5 * time.Second
const DefaultTimeout = 15 * time.Second

func TestConfig_Validate(t *testing.T) {
c := &Config{}
Expand Down

0 comments on commit d0783e3

Please sign in to comment.