Browse Source

Merge pull request #49 from mdr0id/add_gitlab_ci

Add Gitlab CI/CD
service_pr
Marshall Gaucher 5 years ago
committed by GitHub
parent
commit
a91acdbdec
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 109
      .gitlab-ci.yml
  2. 77
      Makefile

109
.gitlab-ci.yml

@ -0,0 +1,109 @@
# /************************************************************************
# File: .gitlab-ci.yml
# Author: mdr0id
# Date: 7/16/2019
# Description: Used to setup runners/jobs for lightwalletd
# Usage: Commit source and the pipeline will trigger the according jobs.
#
# Known bugs/missing features:
#
# IMPORTANT NOTE: any job with preceeding '.'' is ignored in pipeline
# ************************************************************************/
image: golang:1.11-alpine
stages:
- build
- test
- deploy
- monitor
# ************************************************************************/
# BUILD
# ************************************************************************/
.lint-check:
stage: build
script:
- make lint
.build-docs:
stage: build
script:
- made docs
build-linux:
stage: build
script:
- make
.build-windows:
stage: build
script:
- make
.build-mac:
stage: build
script:
- make
# Build against latest Golang
.build-latest:
stage: build
image: golang:latest-alpine
script:
- make
allow_failure: true
# Likely don't need a nightly in always deployable model; will revisit after requirement gathering
.build-nightly:
stage: build
script:
- make
allow_failure: true
# ************************************************************************/
# TEST
# ************************************************************************/
test-coverage:
stage: test
script:
- make coverage
allow_failure: true
test-coverage-report:
stage: test
script:
- make coverage_report
allow_failure: true
test-coverage-report-html:
stage: test
script:
- make coverage_html
allow_failure: true
# ************************************************************************/
# DEPLOY
# ************************************************************************/
.release-candidate:
stage: deploy
script:
- echo "Generating v0.0.1-rc"
when: manual
.release-production:
stage: deploy
script:
- echo "Generating v0.0.1"
when: manual
# ************************************************************************/
# MONITOR
# ************************************************************************/
.monitor-release:
stage: deploy
script:
- echo "Building docker image for v0.0.0"
- make image
when: manual

77
Makefile

@ -0,0 +1,77 @@
# /************************************************************************
# File: Makefile
# Author: mdr0id
# Date: 7/16/2019
# Description: Used for local and container dev in CI deployments
# Usage: make <target_name>
#
# Known bugs/missing features:
#
# ************************************************************************/
PROJECT_NAME := "lightwalletd"
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v '*_test.go')
GO_TEST_FILES := $(shell find . -name '*_test.go' -type f | rev | cut -d "/" -f2- | rev | sort -u)
GO_BUILD_FILES := $(shell find . -name 'main.go')
#PKG_LIST := $(shell go list | grep -v /vendor/)
#GO_COV_REPORTS :=
.PHONY: all dep build clean test coverage coverhtml lint
all: build
# Lint golang files
lint:
@golint -set_exit_status
show_tests:
@echo ${GO_TEST_FILES}
# Run unittests
test:
@go test -v -short ${GO_TEST_FILES}
# Run data race detector
race: dep
@go test -v -race -short ${GO_TEST_FILES}
# Run memory sanitizer (need to ensure proper build flag is set)
msan: dep
@go test -v -msan -short ${GO_TEST_FILES}
# Generate global code coverage report
coverage:
@go test -coverprofile=coverage.out ${GO_TEST_FILES}
# Generate code coverage report
coverage_report:
@go tool cover -func=coverage.out
# Generate code coverage report in HTML
coverage_html:
@go tool cover -html=coverage.out
# Generate documents
docs:
@echo "Generating docs..."
# Generate docker image
image:
@echo "Building lightwalletd image..."
# Get dependencies
dep:
@go get -v -d ./...
# Build binary
build:
@go build -i -v ./cmd/ingest
@go build -i -v ./cmd/server
# Install binaries into Go path
install:
go install ./...
clean:
@echo "clean project..."
#rm -f $(PROJECT_NAME)
Loading…
Cancel
Save