Skip to content

Commit cb3604c

Browse files
authored
Update config.yml
1 parent 5fbc3df commit cb3604c

File tree

1 file changed

+71
-25
lines changed

1 file changed

+71
-25
lines changed

.circleci/config.yml

Lines changed: 71 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,81 @@
11
version: 2.1
2-
jobs:
3-
build:
4-
docker:
5-
- image: circleci/golang:latest
62

7-
working_directory: /go/src/github.com/gopulse/pulse
3+
# Define resource classes
4+
resource_class:
5+
small: &small
6+
cpu: 2
7+
memory: 4GB
8+
medium: &medium
9+
cpu: 4
10+
memory: 8GB
11+
large: &large
12+
cpu: 8
13+
memory: 16GB
814

15+
jobs:
16+
# Define job templates
17+
lint:
18+
docker:
19+
- image: golang:latest
920
steps:
1021
- checkout
22+
- run: go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.42.1
23+
- run: golangci-lint run ./...
24+
test:
25+
parallelism: 2
26+
docker:
27+
- image: circleci/golang:1.17
28+
<<: *medium
29+
steps:
30+
- checkout
31+
- run: go mod download
32+
- run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
33+
# Cache dependencies between runs
34+
key: go-modules-{{ .Branch }}-{{ checksum "go.mod" }}
35+
caches:
36+
- path: ~/go/pkg/mod
1137

12-
# Install dependencies
13-
- run:
14-
name: Install Dependencies
15-
command: |
16-
go mod download
17-
18-
# Build and test
19-
- run:
20-
name: Build and Test
21-
command: |
22-
go build -v ./...
23-
go test -timeout=10m -v ./...
38+
build:
39+
docker:
40+
- image: golang:latest
41+
<<: *large
42+
steps:
43+
- checkout
44+
- run: go mod download
45+
- run: go build -o pulse-server .
46+
# Cache dependencies between runs
47+
key: go-modules-{{ .Branch }}-{{ checksum "go.mod" }}
48+
caches:
49+
- path: ~/go/pkg/mod
2450

25-
# Upload coverage report
26-
- run:
27-
name: Upload Coverage Report
28-
command: |
29-
bash <(curl -s https://codecov.io/bash) -f coverage.out -t $CODECOV_TOKEN
51+
deploy:
52+
docker:
53+
- image: alpine
54+
<<: *small
55+
steps:
56+
- checkout
57+
- run: echo "Deploying..."
3058

3159
workflows:
32-
version: 2
33-
build:
60+
version: 2.1
61+
build-and-test:
3462
jobs:
35-
- build
63+
- lint
64+
- test:
65+
requires:
66+
- lint
67+
filters:
68+
branches:
69+
only: master
70+
- build:
71+
requires:
72+
- test
73+
filters:
74+
branches:
75+
only: master
76+
- deploy:
77+
requires:
78+
- build
79+
filters:
80+
branches:
81+
only: master

0 commit comments

Comments
 (0)