mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 15:26:40 +00:00
test windows 2019
This commit is contained in:
20
.github/workflows/golang-test-windows.yml
vendored
20
.github/workflows/golang-test-windows.yml
vendored
@@ -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
24
testutil/runassystem.go
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user