ci: add initial config for gitlab CI
Just checks linting, and build/test.
This commit is contained in:
43
.gitlab-ci.yml
Normal file
43
.gitlab-ci.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
|
||||
# global settings
|
||||
image: alpine:latest
|
||||
|
||||
stages:
|
||||
- lint
|
||||
- build
|
||||
|
||||
# defaults for "only"
|
||||
# We need to run the CI jobs in a "merge request specific context", if CI is
|
||||
# running in a merge request. Otherwise the environment variable that holds the
|
||||
# merge request ID is not available. This means, we must set the "only"
|
||||
# variable accordingly - and if we only do it for one job, all other jobs will
|
||||
# not get executed. So have the defaults here, and use them in all jobs that
|
||||
# should run on both the master branch, and in merge requests.
|
||||
# https://docs.gitlab.com/ee/ci/merge_request_pipelines/index.html#excluding-certain-jobs
|
||||
.only-default: &only-default
|
||||
only:
|
||||
- master
|
||||
- merge_requests
|
||||
- tags
|
||||
|
||||
# device documentation
|
||||
gofmt linting:
|
||||
stage: lint
|
||||
allow_failure: true
|
||||
<<: *only-default
|
||||
before_script:
|
||||
- apk -q add go
|
||||
script:
|
||||
- .gitlab-ci/check_gofmt.sh
|
||||
|
||||
build:
|
||||
stage: build
|
||||
<<: *only-default
|
||||
before_script:
|
||||
- apk -q add go
|
||||
script:
|
||||
- go build -v
|
||||
- go test ./...
|
||||
artifacts:
|
||||
expire_in: 1 week
|
Reference in New Issue
Block a user