diff --git a/.github/workflows/smoketest-windows.yaml b/.github/workflows/smoketest-windows.yaml new file mode 100644 index 000000000..4b56c70bf --- /dev/null +++ b/.github/workflows/smoketest-windows.yaml @@ -0,0 +1,21 @@ +name: Go package +run-name: windows test +on: + workflow_dispatch: {} + push: {} + pull_request: {} + +jobs: + build: + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + cache: false + - name: Build + run: go run mage.go -v xbuildall + - name: SmokeTest + run: go run mage.go -v testsmoke diff --git a/build/azure-pipelines.pr-automatic.yml b/build/azure-pipelines.pr-automatic.yml index d93500334..4d85b8c3f 100644 --- a/build/azure-pipelines.pr-automatic.yml +++ b/build/azure-pipelines.pr-automatic.yml @@ -174,10 +174,10 @@ stages: strategy: matrix: # Skip windows smoke tests until we fix the windows agent - #windows: - # poolName: "windows" - # vmImage: "" - # GOMODCACHE: "C:/Users/porterci/go/pkg/mod" + windows: + poolName: "windows" + vmImage: "windows-latest" + GOMODCACHE: "C:/Users/porterci/go/pkg/mod" linux: poolName: "Azure Pipelines" vmImage: "ubuntu-latest" @@ -207,6 +207,28 @@ stages: key: "$(GOMODCACHE_KEY)" restoreKeys: $(GOMODCACHE_RESTOREKEYS) path: $(GOMODCACHE) + - task: DockerInstaller@0 + displayName: Docker Installer + inputs: + dockerVersion: 24.0.5 + releaseType: stable + - task: CmdLine@2 + displayName: Validate docker + condition: eq(variables.poolName, 'windows') + inputs: + script: | + docker info + docker -v + docker ps + - task: PowerShell@2 + displayName: Validate docker PS + condition: eq(variables.poolName, 'windows') + inputs: + targetType: 'inline' + script: | + docker info + docker -v + docker ps - task: Cache@2 displayName: Cache Go Build inputs: @@ -215,5 +237,7 @@ stages: path: $(GOCACHE) - script: go run mage.go ConfigureAgent UseXBuildBinaries displayName: "Configure Agent" - - script: mage -v TestSmoke + - script: | + mage -v startdocker + mage -v TestSmoke displayName: "Run Smoke Tests" diff --git a/build/azure-pipelines.release-template.yml b/build/azure-pipelines.release-template.yml index 69cc16ccb..77a85dc15 100644 --- a/build/azure-pipelines.release-template.yml +++ b/build/azure-pipelines.release-template.yml @@ -202,10 +202,10 @@ stages: strategy: matrix: # Skip windows smoke tests until we can fix the windows agent - #windows: - # poolName: "windows" - # vmImage: "" - # GOMODCACHE: "C:/Users/porterci/go/pkg/mod" + windows: + poolName: "windows" + vmImage: "windows-latest" + GOMODCACHE: "C:/Users/porterci/go/pkg/mod" linux: poolName: "Azure Pipelines" vmImage: "ubuntu-latest" @@ -229,16 +229,28 @@ stages: key: "$(GOMODCACHE_KEY)" restoreKeys: $(GOMODCACHE_RESTOREKEYS) path: $(GOMODCACHE) - - task: Cache@2 - displayName: Cache Go Build - inputs: - key: "$(GOCACHE_KEY)" - restoreKeys: $(GOCACHE_RESTOREKEYS) - path: $(GOCACHE) - - script: go run mage.go ConfigureAgent UseXBuildBinaries - displayName: "Setup Bin" - - script: mage -v TestSmoke - displayName: "Run Smoke Tests" + - task: DockerInstaller@0 + displayName: Docker Installer + inputs: + dockerVersion: 24.0.5 + releaseType: stable + - task: CmdLine@2 + displayName: Validate docker + condition: eq(variables.poolName, 'windows') + inputs: + script: | + docker info + docker -v + docker ps + - task: PowerShell@2 + displayName: Validate docker PS + condition: eq(variables.poolName, 'windows') + inputs: + targetType: 'inline' + script: | + docker info + docker -v + docker ps - stage: Publish dependsOn: Validate diff --git a/go.mod b/go.mod index cea222830..6d3434dc6 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,8 @@ module get.porter.sh/porter go 1.20 replace ( + // testing for windows + get.porter.sh/magefiles v0.6.0 => github.com/ludfjig/magefiles v0.0.0-20230818183235-007f40840672 // See https://github.com/hashicorp/go-plugin/pull/127 and // https://github.com/hashicorp/go-plugin/pull/163 // Also includes branches we haven't PR'd yet: capture-yamux-logs, context-cancellation diff --git a/go.sum b/go.sum index cd00560fc..dbb1fda00 100644 --- a/go.sum +++ b/go.sum @@ -41,8 +41,6 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -get.porter.sh/magefiles v0.6.0 h1:6F28fuPGBAG9iiXjWzzEIoGG6M29lUEfj6l7Fe/wmv0= -get.porter.sh/magefiles v0.6.0/go.mod h1:KzKenKVauKKDhZ5FERVhqSz8m/xVSsRzOPseDA4UDIE= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 h1:EKPd1INOIyr5hWOWhvpmQpY6tKjeG0hT1s3AMC/9fic= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1/go.mod h1:VzwV+t+dZ9j/H867F1M2ziD+yLHtB46oM35FxxMJ4d0= github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 h1:59MxjQVfjXsBpLy+dbd2/ELV5ofnUkUZBvWSC85sheA= @@ -562,6 +560,8 @@ github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgx github.com/lib/pq v0.0.0-20150723085316-0dad96c0b94f/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/ludfjig/magefiles v0.0.0-20230818183235-007f40840672 h1:iiVjppfnmxhXFWFOnpFEK9LYXhYKNazRie7qiVHOjzM= +github.com/ludfjig/magefiles v0.0.0-20230818183235-007f40840672/go.mod h1:YsSlQWtGoXCGC4pdD7NxPpvh/FryM1bM0wzMWlJC+Bg= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magefile/mage v1.13.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= diff --git a/magefile.go b/magefile.go index 039261c4d..a8b346d65 100644 --- a/magefile.go +++ b/magefile.go @@ -606,6 +606,10 @@ func TryRegisterLocalHostAlias() { } err := shx.RunV("sudo", "bash", "-c", "echo 127.0.0.1 porter-test-registry >> /etc/hosts") + if runtime.GOOS == "windows" { + err = shx.RunV("cmd.exe", "/c", "echo 127.0.0.1 porter-test-registry >> c:\\Windows\\System32\\drivers\\etc\\hosts") + } + if err != nil { fmt.Println("skipping registering the porter-test-registry hostname alias: could not write to /etc/hosts") return