mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 10:09:07 +00:00
commit
c68ed82f99
55
.circleci/config.yml
Normal file
55
.circleci/config.yml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
version: 2
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
working_directory: /go/src/github.com/linuxkit/linuxkit
|
||||||
|
docker:
|
||||||
|
- image: circleci/golang:1.9-stretch
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: mkdir -p ./bin
|
||||||
|
- run:
|
||||||
|
name: Versions
|
||||||
|
command: |
|
||||||
|
set -x
|
||||||
|
go version
|
||||||
|
cat /etc/os-release
|
||||||
|
- run:
|
||||||
|
name: Dependencies
|
||||||
|
command: |
|
||||||
|
go get -u github.com/golang/lint/golint
|
||||||
|
go get -u github.com/gordonklaus/ineffassign
|
||||||
|
- run:
|
||||||
|
name: Lint
|
||||||
|
command: make local-check
|
||||||
|
- run:
|
||||||
|
name: Build amd64/linux
|
||||||
|
environment:
|
||||||
|
GOOS: linux
|
||||||
|
GOARCH: amd64
|
||||||
|
command: make LOCAL_TARGET=bin/linuxkit-$GOOS-$GOARCH local-build
|
||||||
|
- run:
|
||||||
|
name: Build arm64/linux
|
||||||
|
environment:
|
||||||
|
GOOS: linux
|
||||||
|
GOARCH: arm64
|
||||||
|
command: make LOCAL_TARGET=bin/linuxkit-$GOOS-$GOARCH local-build
|
||||||
|
- run:
|
||||||
|
name: Build amd64/darwin
|
||||||
|
environment:
|
||||||
|
GOOS: darwin
|
||||||
|
GOARCH: amd64
|
||||||
|
command: make LOCAL_TARGET=bin/linuxkit-$GOOS-$GOARCH local-build
|
||||||
|
- run:
|
||||||
|
name: Build amd64/windows
|
||||||
|
environment:
|
||||||
|
GOOS: windows
|
||||||
|
GOARCH: amd64
|
||||||
|
command: make LOCAL_TARGET=bin/linuxkit-$GOOS-$GOARCH local-build
|
||||||
|
- run:
|
||||||
|
name: Test
|
||||||
|
command: make local-test
|
||||||
|
- run:
|
||||||
|
name: Checksum
|
||||||
|
command: cd bin && sha256sum linuxkit-*-* > SHA256SUM
|
||||||
|
- store_artifacts:
|
||||||
|
path: ./bin
|
21
.travis.yml
21
.travis.yml
@ -1,21 +0,0 @@
|
|||||||
language: go
|
|
||||||
|
|
||||||
go:
|
|
||||||
- 1.9.x
|
|
||||||
|
|
||||||
env:
|
|
||||||
- TRAVIS_GOOS=linux
|
|
||||||
- TRAVIS_GOOS=darwin
|
|
||||||
- TRAVIS_GOOS=windows
|
|
||||||
|
|
||||||
script:
|
|
||||||
# We want native versions of the tools.
|
|
||||||
- go get -u github.com/golang/lint/golint
|
|
||||||
- go get -u github.com/gordonklaus/ineffassign
|
|
||||||
- export GOOS=$TRAVIS_GOOS
|
|
||||||
# FIXME: For non-linux GOOS, without running `go build -i`, vet fails with `vet: import failed: can't find import: fmt`...
|
|
||||||
# Note that `go build -i` requires write permission to GOROOT. (So it is not called in Makefile)
|
|
||||||
- go build -i github.com/linuxkit/linuxkit/src/cmd/linuxkit
|
|
||||||
- make local-check
|
|
||||||
- make local-build
|
|
||||||
- if [ "$GOOS" = "linux" ]; then make local-test ; fi
|
|
10
Makefile
10
Makefile
@ -72,6 +72,14 @@ test-cross:
|
|||||||
$(MAKE) -j 3 GOOS=linux tmp_moby_bin.tar tmp_rtf_bin.tar tmp_mt_bin.tar tmp_linuxkit_bin.tar
|
$(MAKE) -j 3 GOOS=linux tmp_moby_bin.tar tmp_rtf_bin.tar tmp_mt_bin.tar tmp_linuxkit_bin.tar
|
||||||
$(MAKE) clean
|
$(MAKE) clean
|
||||||
|
|
||||||
|
ifeq ($(GOARCH)-$(GOOS),amd64-linux)
|
||||||
|
LOCAL_BUILDMODE?=pie
|
||||||
|
endif
|
||||||
|
LOCAL_BUILDMODE?=default
|
||||||
|
|
||||||
|
LOCAL_LDFLAGS += -s -w -extldflags \"-static\" -X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)
|
||||||
|
LOCAL_TARGET ?= bin/linuxkit
|
||||||
|
|
||||||
.PHONY: local-check local-build local-test local
|
.PHONY: local-check local-build local-test local
|
||||||
local-check: $(LINUXKIT_DEPS)
|
local-check: $(LINUXKIT_DEPS)
|
||||||
@echo gofmt... && o=$$(gofmt -s -l $(filter %.go,$(LINUXKIT_DEPS))) && if [ -n "$$o" ] ; then echo $$o ; exit 1 ; fi
|
@echo gofmt... && o=$$(gofmt -s -l $(filter %.go,$(LINUXKIT_DEPS))) && if [ -n "$$o" ] ; then echo $$o ; exit 1 ; fi
|
||||||
@ -80,7 +88,7 @@ local-check: $(LINUXKIT_DEPS)
|
|||||||
@echo ineffassign... && ineffassign $(filter %.go,$(LINUXKIT_DEPS))
|
@echo ineffassign... && ineffassign $(filter %.go,$(LINUXKIT_DEPS))
|
||||||
|
|
||||||
local-build: $(LINUXKIT_DEPS) | bin
|
local-build: $(LINUXKIT_DEPS) | bin
|
||||||
go build -o bin/linuxkit --ldflags "-X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)" github.com/linuxkit/linuxkit/src/cmd/linuxkit
|
go build -o $(LOCAL_TARGET) --buildmode $(LOCAL_BUILDMODE) --ldflags "$(LOCAL_LDFLAGS)" github.com/linuxkit/linuxkit/src/cmd/linuxkit
|
||||||
|
|
||||||
local-test: $(LINUXKIT_DEPS)
|
local-test: $(LINUXKIT_DEPS)
|
||||||
go test $(shell go list github.com/linuxkit/linuxkit/src/cmd/linuxkit/... | grep -v ^github.com/linuxkit/linuxkit/src/cmd/linuxkit/vendor/)
|
go test $(shell go list github.com/linuxkit/linuxkit/src/cmd/linuxkit/... | grep -v ^github.com/linuxkit/linuxkit/src/cmd/linuxkit/vendor/)
|
||||||
|
Loading…
Reference in New Issue
Block a user