Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #8 from openSUSE/ci
Browse files Browse the repository at this point in the history
Add CI support
  • Loading branch information
rhatdan authored Jun 25, 2019
2 parents 6e90ba1 + 88bfe42 commit 6a3e951
Show file tree
Hide file tree
Showing 5 changed files with 889 additions and 3 deletions.
97 changes: 97 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
version: 2.1

executors:
container:
docker:
- image: circleci/golang
environment:
GOCACHE: &gocache /tmp/go-build
working_directory: &workdir /go/src/github.com/seccomp/containers-golang
container-base:
docker:
- image: circleci/golang
environment:
GOCACHE: *gocache
working_directory: *workdir

workflows:
version: 2
pipeline:
jobs:
- build
- unit-tests:
requires:
- build
- vendor

prepare-env: &prepare-env
run:
name: Install dependencies
command: |
sudo apt-get update
sudo apt-get install -y \
libseccomp2 \
libseccomp-dev
jobs:
build:
executor: container
steps:
- <<: *prepare-env
- checkout
- restore_cache:
keys:
- v1-build-{{ checksum "vendor.conf" }}
- run:
name: build
command: make
- save_cache:
key: v1-build-{{ checksum "vendor.conf" }}
paths:
- *gocache
- persist_to_workspace:
root: .
paths:
- default.json
- store_artifacts:
path: generate
destination: generate
- store_artifacts:
path: default.json
destination: default.json

unit-tests:
executor: container
steps:
- <<: *prepare-env
- checkout
- attach_workspace:
at: .
- restore_cache:
keys:
- v1-unit-tests-{{ checksum "vendor.conf" }}
- run:
name: unit tests
command: make test-unit
- save_cache:
key: v1-unit-tests-{{ checksum "vendor.conf" }}
paths:
- *gocache

vendor:
executor: container-base
steps:
- checkout
- restore_cache:
keys:
- v1-vendor-{{ checksum "go.sum" }}
- run:
name: check vendoring
command: |
make vendor
hack/tree_status.sh
- save_cache:
key: v1-vendor-{{ checksum "go.sum" }}
paths:
- /go/pkg
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
default.json
fixtures
*.orig
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ all: default.json

.PHONY: test-unit
test-unit:
$(GO) test $(BUILDFLAGS) $(shell $(GO) list ./... | grep -v ^$(PACKAGE)/vendor)
$(GO) test $(shell $(GO) list ./... | grep -v ^$(PACKAGE)/vendor)
$(GO) test -v $(BUILDFLAGS) $(shell $(GO) list ./... | grep -v ^$(PACKAGE)/vendor)
$(GO) test -v $(shell $(GO) list ./... | grep -v ^$(PACKAGE)/vendor)

.PHONY: vendor
vendor:
export GO111MODULE=on \
$(GO) mod tidy && \
$(GO) mod vendor && \
$(GO) mod verify

.PHONY: clean
clean:
rm -f default.json generate
Loading

0 comments on commit 6a3e951

Please sign in to comment.