Skip to content

Commit

Permalink
ci: circleci + windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Mar 24, 2020
1 parent a92dbe3 commit 2009645
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .circleci/config.yml
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
Expand All @@ -12,3 +95,4 @@ workflows:
- ci-go/test:
race: true
name: "ci-go/test/race"
- test-windows

0 comments on commit 2009645

Please sign in to comment.