-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
107 lines (103 loc) · 2.86 KB
/
config.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Golang CircleCI 2.1 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2.1
jobs: # define some jobs, one to build the service, an other to run tests
tree-build: # job name
docker:
- image: circleci/golang:1.16
parameters: # define parameters to use inside the job
folder: # parameter name
type: string
default: '.'
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}} # since go need a specific path CircleCI give it to us
steps: # steps that will be used in the job
- checkout # checkout the repository to get the last version
- run: # named step
name: "Go build"
command: |
cd << parameters.folder >>
go build
tree-tests:
docker:
- image: circleci/golang:1.16
environment:
ENV: CI
DB_HOST: localhost
DB_USER: garden
DB_PORT: 5432
DB_NAME: garden_test
DB_PASSWORD: supergarden
- image: circleci/postgres:9.6-alpine
environment:
POSTGRES_PASSWORD: supergarden
POSTGRES_USER: garden
POSTGRES_DB: garden
parameters:
folder:
type: string
default: '.'
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
steps:
- checkout
- run:
name: "Go test"
command: |
cd << parameters.folder >>
go test
plant-build:
docker:
- image: circleci/golang:1.16
parameters:
folder:
type: string
default: '.'
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
steps:
- checkout
- run:
name: "Go build"
command: |
cd << parameters.folder >>
go build
plant-tests:
docker:
- image: circleci/golang:1.16
environment:
ENV: CI
DB_HOST: localhost
DB_USER: garden
DB_PORT: 5432
DB_NAME: garden_test
DB_PASSWORD: supergarden
- image: circleci/postgres:9.6-alpine
environment:
POSTGRES_PASSWORD: supergarden
POSTGRES_USER: garden
POSTGRES_DB: garden
parameters:
folder:
type: string
default: '.'
working_directory: /go/src/github.com/{{ORG_NAME}}/{{REPO_NAME}}
steps:
- checkout
- run:
name: "Go test"
command: |
cd << parameters.folder >>
go test
workflows: # each job is launched inside a workflow
version: 2.1
tree-tests: # workflow name
jobs:
- tree-build:
folder: './tree' # here we can setup the parameter value
- tree-tests:
folder: './tree/tests'
plant-tests:
jobs:
- plant-build:
folder: './plant'
- plant-tests:
folder: './plant/tests'