Skip to content

Commit b2e3617

Browse files
authored
chore(circleci): use matrix (#698)
| Q | A | ----------------- | ---------- | Bug fix? | no | New feature? | no | BC breaks? | no | Related Issue | no | Need Doc update | no ## Describe your change This PR uses a matrix for the different go version we want to build. It avoids copy/paste the entire job for each version. The idea behind this change is to eventually split the unit from the integration tests. We will be able to run the unit tests on forked PRs. We have change the required checks from `test-1-XX` to `test-1.XX`. ## What problem is this fixing? N/A
1 parent 1bf23d1 commit b2e3617

File tree

1 file changed

+21
-69
lines changed

1 file changed

+21
-69
lines changed

.circleci/config.yml

Lines changed: 21 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ commands:
1010
if [ -z "ALGOLIA_ADMIN_KEY_MCM" ]; then
1111
curl -s https://algoliasearch-client-keygen.herokuapp.com | sh >> $BASH_ENV
1212
fi
13+
1314
test:
1415
description: "Run the test for Go << parameters.go_version >>"
1516
parameters:
@@ -34,95 +35,46 @@ commands:
3435
jobs:
3536
format:
3637
docker:
37-
- image: circleci/golang:1.14
38+
- image: cimg/go:1.14
3839
steps:
3940
- checkout
4041
- restore_cache:
41-
key: go-cache-1-14
42+
key: go-cache-1.14
4243
- run:
4344
name: Install golangci-lint linter
4445
command: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.25.0
4546
- run:
4647
name: Check formatting
4748
command: make lint
48-
test-1-13:
49-
docker:
50-
- image: circleci/golang:1.13
51-
steps:
52-
- checkout
53-
- restore_cache:
54-
key: go-cache-1-13
55-
- credentials
56-
- test:
57-
go_version: "1.13"
58-
- save_cache:
59-
key: go-cache-1-13
60-
paths:
61-
- "~/go/pkg"
62-
test-1-14:
63-
docker:
64-
- image: circleci/golang:1.14
65-
steps:
66-
- checkout
67-
- restore_cache:
68-
key: go-cache-1-14
69-
- credentials
70-
- test:
71-
go_version: "1.14"
72-
- save_cache:
73-
key: go-cache-1-14
74-
paths:
75-
- "~/go/pkg"
76-
test-1-15:
77-
docker:
78-
- image: circleci/golang:1.15
79-
steps:
80-
- checkout
81-
- restore_cache:
82-
key: go-cache-1-15
83-
- credentials
84-
- test:
85-
go_version: "1.15"
86-
- save_cache:
87-
key: go-cache-1-15
88-
paths:
89-
- "~/go/pkg"
90-
test-1-16:
91-
docker:
92-
- image: circleci/golang:1.16
93-
steps:
94-
- checkout
95-
- restore_cache:
96-
key: go-cache-1-16
97-
- credentials
98-
- test:
99-
go_version: "1.16"
100-
- save_cache:
101-
key: go-cache-1-16
102-
paths:
103-
- "~/go/pkg"
104-
test-1-17:
49+
50+
test:
51+
parameters:
52+
go_version:
53+
type: string
10554
docker:
106-
- image: circleci/golang:1.17
55+
- image: cimg/go:<< parameters.go_version >>
10756
steps:
10857
- checkout
10958
- restore_cache:
110-
key: go-cache-1-17
59+
key: go-cache-<< parameters.go_version >>
11160
- credentials
11261
- test:
113-
go_version: "1.17"
62+
go_version: "<< parameters.go_version >>"
11463
- save_cache:
115-
key: go-cache-1-17
64+
key: go-cache-<< parameters.go_version >>
11665
paths:
11766
- "~/go/pkg"
11867

11968
workflows:
120-
version: 2
12169
build:
12270
jobs:
12371
- format
124-
- test-1-13
125-
- test-1-14
126-
- test-1-15
127-
- test-1-16
128-
- test-1-17
72+
- test:
73+
matrix:
74+
parameters:
75+
go_version:
76+
- "1.13"
77+
- "1.14"
78+
- "1.15"
79+
- "1.16"
80+
- "1.17"

0 commit comments

Comments
 (0)