mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
Merge pull request #62 from anchore/add-simple-pipeline
Add basic pipeline
This commit is contained in:
commit
778754dd59
109
.circleci/config.yml
Normal file
109
.circleci/config.yml
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
version: 2.1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-static-analysis:
|
||||||
|
parameters:
|
||||||
|
version:
|
||||||
|
type: string
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:<< parameters.version >>
|
||||||
|
environment:
|
||||||
|
GO111MODULE: "on"
|
||||||
|
# 1CPU / 2GB RAM
|
||||||
|
resource_class: small
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- checkout
|
||||||
|
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- go-<< parameters.version >>-{{ checksum "go.sum" }}-{{ checksum "Makefile" }}
|
||||||
|
|
||||||
|
- run: make bootstrap
|
||||||
|
|
||||||
|
- save_cache:
|
||||||
|
key: go-<< parameters.version >>-{{ checksum "go.sum" }}-{{ checksum "Makefile" }}
|
||||||
|
paths:
|
||||||
|
- "/go/pkg/mod"
|
||||||
|
- ".tmp"
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: run static analysis
|
||||||
|
command: make lint
|
||||||
|
|
||||||
|
run-tests:
|
||||||
|
parameters:
|
||||||
|
version:
|
||||||
|
type: string
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:<< parameters.version >>
|
||||||
|
environment:
|
||||||
|
GO111MODULE: "on"
|
||||||
|
# 1CPU / 2GB RAM
|
||||||
|
resource_class: small
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- checkout
|
||||||
|
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- go-<< parameters.version >>-{{ checksum "go.sum" }}-{{ checksum "Makefile" }}
|
||||||
|
|
||||||
|
- run: make 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 tar cache
|
||||||
|
command: find integration/test-fixtures/image-* -type f -exec md5sum {} + | awk '{print $1}' | sort | md5sum | tee integration/test-fixtures/tar-cache.key
|
||||||
|
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- integration-test-tar-cache-{{ checksum "integration/test-fixtures/tar-cache.key" }}
|
||||||
|
- run:
|
||||||
|
name: run integration tests
|
||||||
|
command: |
|
||||||
|
docker version
|
||||||
|
make integration
|
||||||
|
|
||||||
|
- save_cache:
|
||||||
|
key: integration-test-tar-cache-{{ checksum "integration/test-fixtures/tar-cache.key" }}
|
||||||
|
paths:
|
||||||
|
- "integration/test-fixtures/tar-cache"
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
"Static Analysis & All Tests":
|
||||||
|
jobs:
|
||||||
|
- run-static-analysis:
|
||||||
|
name: "Static Analysis"
|
||||||
|
version: "1.14"
|
||||||
|
- run-tests:
|
||||||
|
name: "Unit & Integration Tests (go-1.13)"
|
||||||
|
version: "1.13"
|
||||||
|
- run-tests:
|
||||||
|
name: "Unit & Integration Tests (go-latest)"
|
||||||
|
version: "latest"
|
||||||
@ -1,4 +1,6 @@
|
|||||||
linter-settings:
|
linters-settings:
|
||||||
|
funlen:
|
||||||
|
lines: 70
|
||||||
linters:
|
linters:
|
||||||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
||||||
disable-all: true
|
disable-all: true
|
||||||
|
|||||||
@ -38,5 +38,5 @@ func (d Distro) String() string {
|
|||||||
|
|
||||||
// Name provides a string repr of the distro
|
// Name provides a string repr of the distro
|
||||||
func (d Distro) Name() string {
|
func (d Distro) Name() string {
|
||||||
return fmt.Sprintf("%s", d.Type)
|
return d.Type.String()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user