-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.yml
108 lines (103 loc) · 2.77 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
108
version: 2.1
orbs:
go: circleci/go@1.7.3
aws-ecr: circleci/aws-ecr@8.2.1
jobs:
build_lint_test:
machine:
image: ubuntu-2204:2022.10.1
resource_class: large
steps:
- go/install:
version: "1.19"
- checkout
- run:
name: Print Go environment
command: "go env"
- go/load-cache:
key: go-mod-v6-{{ checksum "go.sum" }}
- add_ssh_keys
- go/mod-download
- run:
name: Install Dependencies
command: sudo apt-get install libzmq3-dev
- go/save-cache:
key: go-mod-v6-{{ checksum "go.sum" }}
path: "/home/circleci/.go_workspace/pkg/mod"
- run:
name: Build vigilante
command: make build
- run:
name: Lint
command: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.52.2
./bin/golangci-lint run
- run:
name: Run tests
command: |
make test
- run:
name: Run integration tests
command: |
make test-e2e
build_docker:
machine:
image: ubuntu-2204:2022.10.1
resource_class: large
steps:
- checkout
- add_ssh_keys
- aws-ecr/build-image:
push-image: false
dockerfile: Dockerfile
path: ./
build-path: ./
tag: "$CIRCLE_SHA1,$CIRCLE_TAG"
repo: "$CIRCLE_PROJECT_REPONAME"
extra-build-args: "--secret id=sshKey,src=/home/circleci/.ssh/$DEPLOY_KEY_NAME"
- run:
name: Save Docker image to export it to workspace
command: |
docker save $(docker image ls --format '{{.Repository}}:{{.Tag}}') > /tmp/vigilante.tar
- persist_to_workspace:
root: /tmp
paths:
- vigilante.tar
push_docker:
machine:
image: ubuntu-2204:2022.10.1
resource_class: large
steps:
- attach_workspace:
at: /tmp
- run:
name: Load Docker image from workspace
command: |
docker load -i /tmp/vigilante.tar
- aws-ecr/ecr-login:
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
region: "$AWS_REGION"
- aws-ecr/push-image:
registry-id: AWS_ECR_REGISTRY_ID
region: "$AWS_REGION"
repo: "vigilante"
tag: "$CIRCLE_SHA1,$CIRCLE_TAG"
workflows:
CI:
jobs:
- build_lint_test
- build_docker:
filters:
tags:
only: /.*/
- push_docker:
requires:
- build_docker
filters:
tags:
only: /.*/
branches:
only:
- main
- dev