mirror of
https://github.com/gomods/athens
synced 2026-02-03 12:10:32 +00:00
Set up CI with Azure Pipelines (#862)
* Set up CI with Azure Pipelines * trial & error * use robocopy * fix slash * handle robocopy exit code * rm goroot * build proxy * build & test proxy * Skip Test_checkFilePerms on Win until issue resolved * start minio and mongo * do not create a new network on win 2016 * use win docker img for mongo * download and start minio since there is no win docker img * fix minio download & exec * add minio access key and secret * use new mongodb img * fix docker-compose mongo * trying to fix mongo tests * ipconfig * lets try that * use docker inspect to get the container ip * echo mongo container ip * debuging docker inspect ipaddress * set mongo env var to internal addr * debug * quotation is difficult * without docker * pass db dir * split steps * add some echos to know what takes so long * cleanup * add downloadURL var for minio and mongo * rm windows docker compose file
This commit is contained in:
committed by
Manu Gupta
parent
329c86b843
commit
1984dbdaaf
@@ -0,0 +1,59 @@
|
||||
# Go
|
||||
# Build your Go project.
|
||||
# Add steps that test, save build artifacts, deploy, and more:
|
||||
# https://docs.microsoft.com/azure/devops/pipelines/languages/go
|
||||
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
|
||||
variables:
|
||||
GOBIN: '$(GOPATH)\bin' # Go binaries path
|
||||
GOPATH: '$(system.defaultWorkingDirectory)\gopath' # Go workspace path
|
||||
GO111MODULE: 'on'
|
||||
modulePath: '$(GOPATH)\src\github.com\$(build.repository.name)' # Path to the module's code
|
||||
|
||||
steps:
|
||||
- powershell: |
|
||||
mkdir "$env:GOBIN" | out-null
|
||||
mkdir "$env:GOPATH\pkg" | out-null
|
||||
mkdir "$env:modulePath" | out-null
|
||||
robocopy "$env:system_defaultWorkingDirectory\" "$env:modulePath\" /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XD "$env:GOPATH"
|
||||
exit ($LastExitCode -band 24)
|
||||
displayName: 'set up the Go workspace'
|
||||
|
||||
- powershell: |
|
||||
$downloadURL = "https://dl.minio.io/server/minio/release/windows-amd64/minio.exe"
|
||||
Write-Host "download minio from $downloadURL - start"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
Invoke-WebRequest -Uri $downloadURL -OutFile "minio.exe"
|
||||
Write-Host "download minio - end"
|
||||
Start-Process -NoNewWindow minio.exe 'server --address ":9001" .'
|
||||
env:
|
||||
MINIO_ACCESS_KEY: "minio"
|
||||
MINIO_SECRET_KEY: "minio123"
|
||||
displayName: 'start minio'
|
||||
|
||||
- powershell: |
|
||||
$downloadURL = "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-4.0.4-signed.msi"
|
||||
Write-Host "download mongo from $downloadURL - start"
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
Invoke-WebRequest -Uri $downloadURL -OutFile "mongo.msi"
|
||||
Write-Host "download mongo - end"
|
||||
Write-Host "install mongo - start"
|
||||
Start-Process msiexec -Wait -ArgumentList @('/i', 'mongo.msi', '/quiet', '/qn', 'INSTALLLOCATION=C:\mongodb', 'ADDLOCAL=all')
|
||||
$env:PATH = 'C:\mongodb\bin;' + $env:PATH
|
||||
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)
|
||||
mkdir C:\data\db | out-null
|
||||
mkdir C:\data\configdb | out-null
|
||||
Write-Host "install mongo - end"
|
||||
Start-Process -NoNewWindow mongod.exe '--bind_ip_all --dbpath="C:\data\db"'
|
||||
displayName: 'install & start mongo'
|
||||
|
||||
- powershell: |
|
||||
go test -mod=vendor -race ./...
|
||||
env:
|
||||
ATHENS_MINIO_ENDPOINT: "127.0.0.1:9001"
|
||||
ATHENS_MONGO_STORAGE_URL: "127.0.0.1:27017"
|
||||
workingDirectory: '$(modulePath)'
|
||||
displayName: 'run tests'
|
||||
|
||||
Reference in New Issue
Block a user