Skip to content

Commit

Permalink
circleci: add test-assets and style jobs
Browse files Browse the repository at this point in the history
Since assets tests can only run on go1.16 and later the matrix style job
list avoinds adding more conditionals to the job spec.

Signed-off-by: Jan Fajerski <jfajersk@redhat.com>
  • Loading branch information
jan--f authored and roidelapluie committed Nov 30, 2021
1 parent 1871a70 commit f57586d
Showing 1 changed file with 61 additions and 18 deletions.
79 changes: 61 additions & 18 deletions .circleci/config.yml
Expand Up @@ -9,9 +9,6 @@ jobs:
parameters:
go_version:
type: string
run_style:
type: boolean
default: false
use_gomod_cache:
type: boolean
default: true
Expand All @@ -28,10 +25,57 @@ jobs:
- run: make test
- run: cd sigv4 && make test
- when:
condition: << parameters.run_style >>
condition: << parameters.use_gomod_cache >>
steps:
- go/save-cache:
key: v1-go<< parameters.go_version >>
- store_test_results:
path: test-results
test-assets:
parameters:
go_version:
type: string
use_gomod_cache:
type: boolean
default: true
docker:
- image: circleci/golang:<< parameters.go_version >>
working_directory: /go/src/github.com/prometheus/common/assets
steps:
- checkout
- when:
condition: << parameters.use_gomod_cache >>
steps:
- run: make style
- run: cd sigv4 && make style
- go/load-cache:
key: v1-go<< parameters.go_version >>
- run: make test
- when:
condition: << parameters.use_gomod_cache >>
steps:
- go/save-cache:
key: v1-go<< parameters.go_version >>
- store_test_results:
path: ../test-results
style:
parameters:
go_version:
type: string
use_gomod_cache:
type: boolean
default: true
docker:
- image: circleci/golang:<< parameters.go_version >>
working_directory: /go/src/github.com/prometheus/common
steps:
- checkout
- when:
condition: << parameters.use_gomod_cache >>
steps:
- go/load-cache:
key: v1-go<< parameters.go_version >>
- run: make style
- run: cd sigv4 && make style
- run: cd assets && make style
- when:
condition: << parameters.use_gomod_cache >>
steps:
Expand All @@ -46,16 +90,15 @@ workflows:
jobs:
# Supported Go versions are synced with github.com/prometheus/client_golang.
- test:
name: go-1-13
go_version: "1.13"
- test:
name: go-1-14
go_version: "1.14"
- test:
name: go-1-15
go_version: "1.15"
- test:
name: go-1-16
name: go-<< matrix.go_version >>
matrix:
parameters:
go_version: ["1.13", "1.14", "1.15", "1.16"]
- test-assets:
name: assets-go-<< matrix.go_version >>
matrix:
parameters:
go_version: ["1.16"]
- style:
name: style
go_version: "1.16"
# Style is only checked against the latest supported Go version.
run_style: true

0 comments on commit f57586d

Please sign in to comment.