Skip to content

Commit

Permalink
Enable circleci to run tests on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu committed May 21, 2020
1 parent 1076b51 commit 6c2cb4c
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version: 2.1

orbs:
win: circleci/windows@2.4.0

executors:
golang:
docker:
Expand All @@ -12,20 +15,28 @@ commands:
at: ~/

save_module_cache:
parameters:
os:
type: string
default: "linux"
steps:
- save_cache:
key: cimg-go-pkg-mod-{{ checksum "go.sum" }}
key: cimg-go-pkg-mod-<<parameters.os>>-{{ checksum "go.sum" }}
paths:
- "/home/circleci/go/pkg/mod"

restore_module_cache:
parameters:
os:
type: string
default: "linux"
steps:
- run:
name: create modules dir
command: mkdir -p ~/go/pkg/mod
- restore_cache: # restores saved cache if no changes are detected since last run
keys:
- cimg-go-pkg-mod-{{ checksum "go.sum" }}
- cimg-go-pkg-mod-<<parameters.os>>-{{ checksum "go.sum" }}
- persist_to_workspace:
root: ~/
paths: go/pkg/mod
Expand Down Expand Up @@ -61,6 +72,12 @@ workflows:
filters:
tags:
only: /^v([0-9])+.([0-9])+.([0-9])+.*/
- windows-test:
requires:
- setup-and-lint
filters:
tags:
only: /^v([0-9])+.([0-9])+.([0-9])+.*/
- build:
requires:
- setup-and-lint
Expand Down Expand Up @@ -234,3 +251,22 @@ jobs:
- publish_docker_images:
repo: opentelemetry-collector-dev
tag: ${CIRCLE_SHA1}

windows-test:
executor:
name: win/default
shell: powershell.exe
steps:
- checkout
- restore_module_cache:
os: "windows"
- run:
name: Upgrade golang
shell: powershell.exe
command: choco upgrade golang
- run:
name: Unit tests
shell: powershell.exe
command: go test ./...
- save_module_cache:
os: "windows"

0 comments on commit 6c2cb4c

Please sign in to comment.