-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.gitlab-ci.yml
75 lines (68 loc) · 1.78 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
variables:
GOPATH: /go
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: flare_ftso_indexer_indexer_test
GOLANG_VERSION: "1.21.12"
GOLINT_VERSION: "v1.59.1"
.gocache:
key: ${CI_COMMIT_REF_SLUG}
policy: pull-push
paths:
- ${GOPATH}/pkg/mod
- ${GOPATH}/bin
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
build:
stage: build
image: golang:${GOLANG_VERSION}
needs: []
cache: !reference [.gocache]
script:
- go build ./...
lint:
stage: test
needs: []
image: golangci/golangci-lint:${GOLINT_VERSION}
cache: !reference [.gocache]
script:
- ./gofmt_check.sh
- golangci-lint run --timeout 5m0s
test:
stage: test
image: golang:${GOLANG_VERSION}
cache: !reference [.gocache]
needs: []
variables:
DB_HOST: mysql
DB_PORT: 3306
DB_NAME: ${MYSQL_DATABASE}
DB_USERNAME: root
DB_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MOCK_CHAIN_PORT: 2426
services:
- name: mysql:latest
alias: mysql
script:
- sed -i 's/test_host = "localhost"/test_host = "mysql"/' testing/config_test.toml
- go test ./indexer
build-container:
stage: build
needs: []
image: gcr.si/cts/build-oci:1.3.0@sha256:af8fd5a7f8bf74037741f8a831209d66078d94251dd155df6d61b61a9f922bf7
script: ["/build.sh"]
variables:
CTS_BUILD_CACHE_REPO: ${CI_REGISTRY_IMAGE}/cache
CTS_BUILD_DOCKERFILE: Dockerfile
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
variables:
CTS_BUILD_TAG: latest
- if: $CI_COMMIT_TAG != null
variables:
CTS_BUILD_TAG: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != 'merge_request_event'
variables:
CTS_BUILD_TAG: $CI_COMMIT_REF_SLUG