test windows 2019

This commit is contained in:
Maycon Santos
2023-04-08 20:51:38 +02:00
parent b556736b31
commit f9f8cbdcaa
2 changed files with 35 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ concurrency:
jobs:
test:
runs-on: windows-latest
runs-on: windows-2019
steps:
- name: Checkout code
uses: actions/checkout@v3
@@ -47,15 +47,17 @@ jobs:
- name: Generate Iface Test bin
run: go mod tidy
- name: Build helper
run:
# run: go test -c -o ${{ github.workspace }}/iface-testing.bin.exe ./iface/
# - name: Test
# if: ${{ always() }}
# run: |
# Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force
# Import-Module PSScheduledJob -UseWindowsPowerShell
# Import-Module ".\Invoke-ScheduledTask.ps1"
# Import-Module ".\Invoke-CommandAs.ps1"
# Invoke-CommandAs -ScriptBlock { whoami } -AsSystem
- name: Test
if: ${{ always() }}
run: |
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force
Import-Module PSScheduledJob -UseWindowsPowerShell
Import-Module ".\Invoke-ScheduledTask.ps1"
Import-Module ".\Invoke-CommandAs.ps1"
Invoke-CommandAs -ScriptBlock { whoami } -AsSystem
# Invoke-CommandAs -ScriptBlock { ${{ github.workspace }}/iface-testing.bin.exe } -AsSystem

24
testutil/runassystem.go Normal file
View File

@@ -0,0 +1,24 @@
package main
import (
"fmt"
"os"
"os/exec"
"golang.zx2c4.com/wireguard/windows/elevate"
)
func main() {
argsWithoutProg := os.Args[1:]
op := func() error {
cmd := exec.Command(argsWithoutProg[0], argsWithoutProg[1:]...)
out, err := cmd.Output()
fmt.Println("")
fmt.Printf(string(out))
if err != nil {
return err
}
return nil
}
fmt.Println(elevate.DoAsService("netbird", op))
}