-
Notifications
You must be signed in to change notification settings - Fork 43
/
config.yml
141 lines (133 loc) · 4.34 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
version: 2.1
parameters:
cmds:
type: string
default: "ssl-game-controller ssl-ref-client"
jobs:
build_node:
resource_class: medium
docker:
- image: cimg/node:lts
steps:
- checkout
- run:
name: "Install dependencies"
working_directory: frontend
command: npm install
- run:
name: "Build"
working_directory: frontend
command: npm run build
- persist_to_workspace:
root: .
paths:
- frontend/dist/*
test_go:
resource_class: medium
docker:
- image: cimg/go:1.21.6
steps:
- checkout
- attach_workspace:
at: .
- run: go get -v -t -d ./...
- run: go test -v -covermode=count -coverprofile=count.out ./...
- run: go tool cover -html=count.out -o coverage.html
- store_artifacts:
path: coverage.html
destination: coverage
build_go:
resource_class: large
docker:
- image: cimg/go:1.21.6
steps:
- checkout
- attach_workspace:
at: .
- run: go get -v -t -d ./...
- run: |
set -u
version=${CIRCLE_TAG:-}
for cmd in << pipeline.parameters.cmds >>; do
GOOS=linux GOARCH=amd64 go build -o ./release/${cmd}_${version}_linux_amd64 ./cmd/${cmd}
GOOS=linux GOARCH=arm64 go build -o ./release/${cmd}_${version}_linux_arm64 ./cmd/${cmd}
GOOS=linux GOARCH=arm go build -o ./release/${cmd}_${version}_linux_arm ./cmd/${cmd}
GOOS=darwin GOARCH=amd64 go build -o ./release/${cmd}_${version}_darwin_amd64 ./cmd/${cmd}
GOOS=darwin GOARCH=arm64 go build -o ./release/${cmd}_${version}_darwin_arm64 ./cmd/${cmd}
GOOS=windows GOARCH=amd64 go build -o ./release/${cmd}_${version}_windows_amd64.exe ./cmd/${cmd}
GOOS=windows GOARCH=arm64 go build -o ./release/${cmd}_${version}_windows_arm64.exe ./cmd/${cmd}
done
- persist_to_workspace:
root: .
paths:
- release/*
publish_gh:
resource_class: small
docker:
- image: cimg/go:1.21.6
steps:
- attach_workspace:
at: .
- run: |
set -u
go install github.com/tcnksm/[email protected]
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -generatenotes ${CIRCLE_TAG} ./release
build_docker:
resource_class: small
docker:
- image: cimg/base:2024.01
steps:
- checkout
- setup_remote_docker
- run: |
docker buildx create \
--name container-builder \
--driver docker-container \
--bootstrap --use
for cmd in << pipeline.parameters.cmds >>; do
docker buildx build --platform linux/amd64,linux/arm64 --build-arg cmd=${cmd} -f ./cmd/${cmd}/Dockerfile -t robocupssl/${cmd}:latest .
done
publish_docker:
resource_class: small
docker:
- image: cimg/base:2024.01
steps:
- checkout
- setup_remote_docker
- run: |
docker buildx create \
--name container-builder \
--driver docker-container \
--bootstrap --use
# Parse version from tag (removing 'v' prefix)
TAG=${CIRCLE_TAG:1}
TAG=${TAG:-latest}
for cmd in << pipeline.parameters.cmds >>; do
docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}"
docker buildx build --platform linux/amd64,linux/arm64 --build-arg cmd=${cmd} -f ./cmd/${cmd}/Dockerfile -t robocupssl/${cmd}:${TAG} --push .
done
workflows:
version: 2
build:
jobs:
- build_node
- test_go:
requires: [ build_node ]
release:
jobs:
- build_node:
filters: { branches: { ignore: /.*/ }, tags: { only: /^v.*/ } }
- build_go:
requires: [ build_node ]
filters: { branches: { ignore: /.*/ }, tags: { only: /^v.*/ } }
- publish_gh:
context: github
requires: [ build_go ]
filters: { branches: { ignore: /.*/ }, tags: { only: /^v.*/ } }
docker:
jobs:
- build_docker:
filters: { branches: { ignore: master } }
- publish_docker:
context: docker hub
filters: { branches: { only: master }, tags: { only: /^v.*/ } }