Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable circleci to run tests on windows #976

Merged
merged 1 commit into from
May 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 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,10 @@ workflows:
filters:
tags:
only: /^v([0-9])+.([0-9])+.([0-9])+.*/
- windows-test:
filters:
tags:
only: /^v([0-9])+.([0-9])+.([0-9])+.*/
- build:
requires:
- setup-and-lint
Expand Down Expand Up @@ -234,3 +249,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 --version=1.14.3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good if I can cache this operation since it takes a while. If anyone knows how, I would be happy to review a followup PR :)

Copy link
Member

@james-bebbington james-bebbington May 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few of the tests are abnormally slow on Windows as well, I'll try to take a look into that if I get a chance later.

Edit: This PR should shave off ~1 min: #1009

- run:
name: Unit tests
shell: powershell.exe
command: go test ./...
- save_module_cache:
os: "windows"