ci: add initial config for gitlab CI

Just checks linting, and build/test.
This commit is contained in:
Clayton Craft
2021-08-10 19:02:37 -07:00
parent 206020c3f1
commit 49cf99f4d9
2 changed files with 54 additions and 0 deletions

43
.gitlab-ci.yml Normal file
View 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