mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
113 lines
No EOL
3.3 KiB
YAML
113 lines
No EOL
3.3 KiB
YAML
version: 2.1
|
|
|
|
jobs:
|
|
run-static-analysis:
|
|
parameters:
|
|
version:
|
|
type: string
|
|
docker:
|
|
- image: circleci/golang:<< parameters.version >>
|
|
environment:
|
|
GO111MODULE: "on"
|
|
# work around for recent circle CI breaking change
|
|
# Error: "Error response from daemon: client version 1.39 is too new. Maximum supported API version is 1.38"
|
|
DOCKER_API_VERSION: "1.38"
|
|
# 2CPU / 4GB RAM
|
|
resource_class: medium
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- go-<< parameters.version >>-{{ checksum "go.sum" }}-{{ checksum "Makefile" }}
|
|
|
|
- run: make ci-bootstrap
|
|
|
|
- save_cache:
|
|
key: go-<< parameters.version >>-{{ checksum "go.sum" }}-{{ checksum "Makefile" }}
|
|
paths:
|
|
- "/go/pkg/mod"
|
|
- ".tmp"
|
|
|
|
- run:
|
|
name: run static analysis
|
|
command: make static-analysis
|
|
|
|
run-tests:
|
|
parameters:
|
|
version:
|
|
type: string
|
|
docker:
|
|
- image: circleci/golang:<< parameters.version >>
|
|
environment:
|
|
GO111MODULE: "on"
|
|
# work around for recent circle CI breaking change
|
|
# Error: "Error response from daemon: client version 1.39 is too new. Maximum supported API version is 1.38"
|
|
DOCKER_API_VERSION: "1.38"
|
|
# 2CPU / 4GB RAM
|
|
resource_class: medium
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- go-<< parameters.version >>-{{ checksum "go.sum" }}-{{ checksum "Makefile" }}
|
|
|
|
- run: make ci-bootstrap
|
|
|
|
- save_cache:
|
|
key: go-<< parameters.version >>-{{ checksum "go.sum" }}-{{ checksum "Makefile" }}
|
|
paths:
|
|
- "/go/pkg/mod"
|
|
- ".tmp"
|
|
|
|
- setup_remote_docker:
|
|
version: 18.06.0-ce
|
|
|
|
- run:
|
|
name: enable docker client
|
|
command: |
|
|
# all of this to enable "circleci local execute ..." cli commands for /var/run/docker.sock
|
|
mkdir -p ${HOME}/.local/bin
|
|
cat \<< EOF > ${HOME}/.local/bin/docker
|
|
#!/bin/bash
|
|
set -xue
|
|
sudo -E ${HOME}/.local/bin/docker.bin \$@
|
|
EOF
|
|
sudo mv /usr/bin/docker ${HOME}/.local/bin/docker.bin
|
|
chmod 755 ${HOME}/.local/bin/docker
|
|
|
|
- run:
|
|
name: run unit tests
|
|
command: make unit
|
|
|
|
- run:
|
|
name: build hash key for integration test-fixtures blobs
|
|
command: make integration-fingerprint
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- integration-test-tar-cache-{{ checksum "test/integration/test-fixtures/tar-cache.fingerprint" }}
|
|
- run:
|
|
name: run integration tests
|
|
command: make integration
|
|
|
|
- save_cache:
|
|
key: integration-test-tar-cache-{{ checksum "test/integration/test-fixtures/tar-cache.fingerprint" }}
|
|
paths:
|
|
- "test/integration/test-fixtures/tar-cache"
|
|
|
|
workflows:
|
|
"Static Analysis + Unit + Integration":
|
|
jobs:
|
|
- run-static-analysis:
|
|
name: "Static Analysis"
|
|
version: "latest"
|
|
- run-tests:
|
|
name: "Unit & Integration Tests (go-1.13)"
|
|
version: "1.13"
|
|
- run-tests:
|
|
name: "Unit & Integration Tests (go-latest)"
|
|
version: "latest" |