Add win tests to CircleCI; Remove Appveyor (#435)
Add win tests to CircleCI; Remove Appveyor
This commit is contained in:
parent
8045083719
commit
466c0d9ba2
@ -1,25 +1,21 @@
|
|||||||
version: 2.1
|
version: 2.1
|
||||||
|
|
||||||
executors:
|
orbs:
|
||||||
go:
|
win: circleci/windows@2.2.0
|
||||||
docker:
|
|
||||||
- image: circleci/golang:1.14
|
|
||||||
environment:
|
|
||||||
GOMAXPROCS: 4
|
|
||||||
GO111MODULE: "on"
|
|
||||||
GOPROXY: https://proxy.golang.org/
|
|
||||||
TEST_RESULTS_DIR: &TEST_RESULTS_DIR /tmp/test-results
|
|
||||||
|
|
||||||
jobs:
|
references:
|
||||||
go-checks:
|
environment: &ENVIRONMENT
|
||||||
executor:
|
GOMAXPROCS: 4
|
||||||
name: go
|
GO111MODULE: "on"
|
||||||
|
GOPROXY: https://proxy.golang.org/
|
||||||
|
TEST_RESULTS_DIR: &TEST_RESULTS_DIR /tmp/test-results
|
||||||
|
WIN_TEST_RESULTS: &WIN_TEST_RESULTS c:\Users\circleci\AppData\Local\Temp\test-results
|
||||||
|
|
||||||
|
commands:
|
||||||
|
git-verify:
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- run:
|
||||||
- run: go mod verify
|
name: "Verify no code was generated"
|
||||||
- run: make fmt
|
|
||||||
- run:
|
|
||||||
name: verify no code was generated
|
|
||||||
command: |
|
command: |
|
||||||
if [[ -z $(git status --porcelain) ]]; then
|
if [[ -z $(git status --porcelain) ]]; then
|
||||||
echo "Git directory is clean."
|
echo "Git directory is clean."
|
||||||
@ -29,35 +25,153 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
go-test:
|
run-gotests:
|
||||||
executor:
|
parameters:
|
||||||
name: go
|
cmd:
|
||||||
|
type: string
|
||||||
|
platform:
|
||||||
|
type: string
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
name: "Run go tests"
|
||||||
|
command: |
|
||||||
|
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
|
||||||
|
echo "Running $(echo $PACKAGE_NAMES | wc -w) packages"
|
||||||
|
echo $PACKAGE_NAMES
|
||||||
|
<< parameters.cmd >> --format=short-verbose --junitfile $TEST_RESULTS_DIR/hcl2/gotestsum-report.xml -- -p 2 -cover -coverprofile=<< parameters.platform >>_cov_$CIRCLE_NODE_INDEX.part $PACKAGE_NAMES
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
go-checks:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:<< parameters.go-version >>
|
||||||
|
environment:
|
||||||
|
<<: *ENVIRONMENT
|
||||||
|
parameters:
|
||||||
|
go-version:
|
||||||
|
type: string
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: go mod verify
|
||||||
|
- run: make fmt
|
||||||
|
- git-verify
|
||||||
|
|
||||||
|
linux-tests:
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:<< parameters.go-version >>
|
||||||
|
environment:
|
||||||
|
<<: *ENVIRONMENT
|
||||||
|
parameters:
|
||||||
|
go-version:
|
||||||
|
type: string
|
||||||
|
parallelism: 4
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: .
|
at: .
|
||||||
- run: mkdir -p $TEST_RESULTS_DIR
|
- run: mkdir -p $TEST_RESULTS_DIR/hcl2
|
||||||
- run:
|
- run-gotests:
|
||||||
name: Run Go Tests
|
cmd: "gotestsum"
|
||||||
command: |
|
platform: "linux"
|
||||||
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
|
|
||||||
echo "Running $(echo $PACKAGE_NAMES | wc -w) packages"
|
|
||||||
echo $PACKAGE_NAMES
|
|
||||||
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -p 2 -cover -coverprofile=cov_$CIRCLE_NODE_INDEX.part $PACKAGE_NAMES
|
|
||||||
|
|
||||||
# save coverage report parts
|
# save coverage report parts
|
||||||
- persist_to_workspace:
|
- persist_to_workspace:
|
||||||
root: .
|
root: .
|
||||||
paths:
|
paths:
|
||||||
- cov_*.part
|
- linux_cov_*.part
|
||||||
|
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: *TEST_RESULTS_DIR
|
path: *TEST_RESULTS_DIR
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: *TEST_RESULTS_DIR
|
path: *TEST_RESULTS_DIR
|
||||||
|
|
||||||
|
win-tests:
|
||||||
|
executor:
|
||||||
|
name: win/default
|
||||||
|
shell: bash --login -eo pipefail
|
||||||
|
environment:
|
||||||
|
<<: *ENVIRONMENT
|
||||||
|
working_directory: c:\gopath\src\github.com\hashicorp\hcl
|
||||||
|
parameters:
|
||||||
|
go-version:
|
||||||
|
type: string
|
||||||
|
gotestsum-version:
|
||||||
|
type: string
|
||||||
|
steps:
|
||||||
|
- run: git config --global core.autocrlf false
|
||||||
|
- checkout
|
||||||
|
- attach_workspace:
|
||||||
|
at: .
|
||||||
|
# - git-verify
|
||||||
|
- run:
|
||||||
|
name: Setup (remove pre-installed golang version)
|
||||||
|
command: |
|
||||||
|
rm -rf "c:\Go"
|
||||||
|
mkdir -p $TEST_RESULTS_DIR/hcl2
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- win-golang-<< parameters.go-version >>-cache-v1
|
||||||
|
- win-gomod-cache-{{ checksum "go.mod" }}-v1
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: Install go version << parameters.go-version >>
|
||||||
|
command: |
|
||||||
|
if [ ! -d "c:\go" ]; then
|
||||||
|
echo "Cache not found, installing new version of go"
|
||||||
|
curl --fail --location https://dl.google.com/go/go<< parameters.go-version >>.windows-amd64.zip --output go.zip
|
||||||
|
unzip go.zip -d "/c"
|
||||||
|
fi
|
||||||
|
- run:
|
||||||
|
name: Go mod download
|
||||||
|
command: |
|
||||||
|
go mod verify
|
||||||
|
go mod download
|
||||||
|
|
||||||
|
- save_cache:
|
||||||
|
key: win-golang-<< parameters.go-version >>-cache-v1
|
||||||
|
paths:
|
||||||
|
- /go
|
||||||
|
|
||||||
|
- save_cache:
|
||||||
|
key: win-gomod-cache-{{ checksum "go.mod" }}-v1
|
||||||
|
paths:
|
||||||
|
- c:\Windows\system32\config\systemprofile\go\pkg\mod
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: Install gotestsum
|
||||||
|
command: |
|
||||||
|
curl --fail --location https://github.com/gotestyourself/gotestsum/releases/download/v<< parameters.gotestsum-version >>/gotestsum_<< parameters.gotestsum-version >>_windows_amd64.tar.gz --output gotestsum.tar.gz
|
||||||
|
tar -xvzf gotestsum.tar.gz
|
||||||
|
- run-gotests:
|
||||||
|
cmd: "./gotestsum.exe"
|
||||||
|
platform: "win"
|
||||||
|
|
||||||
|
# save coverage report parts
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: .
|
||||||
|
paths:
|
||||||
|
- win_cov_*.part
|
||||||
|
|
||||||
|
- store_test_results:
|
||||||
|
path: *WIN_TEST_RESULTS
|
||||||
|
- store_artifacts:
|
||||||
|
path: *WIN_TEST_RESULTS
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
hcl2:
|
||||||
test:
|
|
||||||
jobs:
|
jobs:
|
||||||
- go-test
|
# - go-checks:
|
||||||
|
# matrix:
|
||||||
|
# parameters:
|
||||||
|
# go-version: ["1.14"]
|
||||||
|
# name: go-checks-<< matrix.go-version >>
|
||||||
|
- linux-tests:
|
||||||
|
matrix:
|
||||||
|
parameters:
|
||||||
|
go-version: ["1.14"]
|
||||||
|
name: linux-test-go-<< matrix.go-version >>
|
||||||
|
- win-tests:
|
||||||
|
matrix:
|
||||||
|
parameters:
|
||||||
|
go-version: ["1.12"]
|
||||||
|
gotestsum-version: ["0.4.1"]
|
||||||
|
name: win-test-go-<< matrix.go-version >>
|
||||||
|
13
appveyor.yml
13
appveyor.yml
@ -1,13 +0,0 @@
|
|||||||
build: off
|
|
||||||
|
|
||||||
clone_folder: c:\gopath\src\github.com\hashicorp\hcl
|
|
||||||
|
|
||||||
environment:
|
|
||||||
GOPATH: c:\gopath
|
|
||||||
GO111MODULE: on
|
|
||||||
GOPROXY: https://goproxy.io
|
|
||||||
|
|
||||||
stack: go 1.12
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
- go test ./...
|
|
Loading…
Reference in New Issue
Block a user