Skip to content

Commit

Permalink
chore(circleci): use matrix (#698)
Browse files Browse the repository at this point in the history
| 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
  • Loading branch information
samouss authored Aug 26, 2022
1 parent 1bf23d1 commit b2e3617
Showing 1 changed file with 21 additions and 69 deletions.
90 changes: 21 additions & 69 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ commands:
if [ -z "ALGOLIA_ADMIN_KEY_MCM" ]; then
curl -s https://algoliasearch-client-keygen.herokuapp.com | sh >> $BASH_ENV
fi
test:
description: "Run the test for Go << parameters.go_version >>"
parameters:
Expand All @@ -34,95 +35,46 @@ commands:
jobs:
format:
docker:
- image: circleci/golang:1.14
- image: cimg/go:1.14
steps:
- checkout
- restore_cache:
key: go-cache-1-14
key: go-cache-1.14
- run:
name: Install golangci-lint linter
command: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.25.0
- run:
name: Check formatting
command: make lint
test-1-13:
docker:
- image: circleci/golang:1.13
steps:
- checkout
- restore_cache:
key: go-cache-1-13
- credentials
- test:
go_version: "1.13"
- save_cache:
key: go-cache-1-13
paths:
- "~/go/pkg"
test-1-14:
docker:
- image: circleci/golang:1.14
steps:
- checkout
- restore_cache:
key: go-cache-1-14
- credentials
- test:
go_version: "1.14"
- save_cache:
key: go-cache-1-14
paths:
- "~/go/pkg"
test-1-15:
docker:
- image: circleci/golang:1.15
steps:
- checkout
- restore_cache:
key: go-cache-1-15
- credentials
- test:
go_version: "1.15"
- save_cache:
key: go-cache-1-15
paths:
- "~/go/pkg"
test-1-16:
docker:
- image: circleci/golang:1.16
steps:
- checkout
- restore_cache:
key: go-cache-1-16
- credentials
- test:
go_version: "1.16"
- save_cache:
key: go-cache-1-16
paths:
- "~/go/pkg"
test-1-17:

test:
parameters:
go_version:
type: string
docker:
- image: circleci/golang:1.17
- image: cimg/go:<< parameters.go_version >>
steps:
- checkout
- restore_cache:
key: go-cache-1-17
key: go-cache-<< parameters.go_version >>
- credentials
- test:
go_version: "1.17"
go_version: "<< parameters.go_version >>"
- save_cache:
key: go-cache-1-17
key: go-cache-<< parameters.go_version >>
paths:
- "~/go/pkg"

workflows:
version: 2
build:
jobs:
- format
- test-1-13
- test-1-14
- test-1-15
- test-1-16
- test-1-17
- test:
matrix:
parameters:
go_version:
- "1.13"
- "1.14"
- "1.15"
- "1.16"
- "1.17"

0 comments on commit b2e3617

Please sign in to comment.