-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,89 @@ | ||
version: 2.1 | ||
orbs: | ||
ci-go: ipfs/[email protected] | ||
windows: circleci/[email protected] | ||
|
||
commands: | ||
windows-add-path: | ||
parameters: | ||
directory: | ||
type: string | ||
steps: | ||
- run: | ||
name: Add-To-Path << parameters.directory >> | ||
command: | | ||
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path | ||
$newpath = "$oldpath;<< parameters.directory >>" | ||
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newpath | ||
shell: powershell.exe | ||
setup-windows: | ||
parameters: | ||
version: | ||
type: string | ||
default: "1.14" | ||
testsum-version: | ||
type: string | ||
default: "v0.3.5" | ||
steps: | ||
- run: | ||
name: "Setting GOPATH" | ||
command: | | ||
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name GOPATH -Value c:\go | ||
shell: powershell.exe | ||
- windows-add-path: | ||
directory: c:\go\bin | ||
- run: | ||
name: "Making the go workspace" | ||
command: | | ||
New-Item -ItemType directory -Path C:\Go | ||
shell: powershell.exe | ||
- restore_cache: | ||
name: "Restoring Go Compiler" | ||
keys: | ||
- v1-go-download-<< parameters.version>>-{{ arch }} | ||
- run: | ||
name: "Installing go" | ||
command: | | ||
if (-not (Test-Path -LiteralPath "C:\go-download-cache\go.tar.gz")) { | ||
New-Item -ItemType directory -Path "C:\go-download-cache" | ||
Invoke-WebRequest -OutFile "$env:userprofile\go-download-cache\go.tar.gz" -Uri "https://dl.google.com/go/go<< parameters.version >>.windows-amd64.zip" | ||
} | ||
New-Item -ItemType directory -Path "C:\go-toolchain" | ||
Expand-Archive -LiteralPath "C:\go-download-cache\go.tar.gz" -DestinationFile C:\go-toolchain | ||
- windows-add-path: | ||
directory: C:\go-toolchain\go\bin | ||
- save_cache: | ||
name: "Caching Go Compiler" | ||
key: v1-go-download-<< parameters.version>>-{{ arch }} | ||
paths: | ||
- c:\go-download-cache | ||
- restore_cache: | ||
name: "Restoring Tools" | ||
keys: | ||
- v1-gotools-{{ arch }}-testsum@<< parameters.testsum-version >>:go@<< parameters.version >> | ||
- run: | ||
name: "Installing Tools" | ||
command: | | ||
if ((Get-Command "gotestsum.exe" -ErrorAction SilentlyContinue) -eq $null) { | ||
go get gotest.tools/gotestsum@<< parameters.testsum-version >> | ||
} | ||
# Finally, clean out the gopath so we don't sully the cache. | ||
Remove-Item -Recurse -Force c:\go\cache c:\go\pkg c:\go\src | ||
- save_cache: | ||
name: "Caching Tools" | ||
key: v1-gotools-{{ arch }}-testsum@<< parameters.testsum-version >>:go@<< parameters.version >> | ||
paths: | ||
c:\go\bin | ||
|
||
jobs: | ||
test-windows: | ||
executor: windows/default | ||
steps: | ||
- setup-windows | ||
- checkout | ||
- ci-go/restore-cache | ||
- ci-go/test | ||
- ci-go/save-cache | ||
|
||
workflows: | ||
version: 2 | ||
|
@@ -12,3 +95,4 @@ workflows: | |
- ci-go/test: | ||
race: true | ||
name: "ci-go/test/race" | ||
- test-windows |