-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathconfig.yml
141 lines (133 loc) · 4.76 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@sha256:c2ea6166daf4ed37d0abdaf9186798e0c73e75a9f1f3858b69bb770755a59cca
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.23.4@sha256:d89753cdb9f31e48c3a91aee6e73afcb23ad7e44abf7088491d8a9f002a71b67
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.23.4@sha256:d89753cdb9f31e48c3a91aee6e73afcb23ad7e44abf7088491d8a9f002a71b67
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.23.4@sha256:d89753cdb9f31e48c3a91aee6e73afcb23ad7e44abf7088491d8a9f002a71b67
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:2025.01@sha256:f6b81723236539a091130e4f0e57c599253abf2e3980aa4e60eeee871b4e2ef7
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:2025.01@sha256:f6b81723236539a091130e4f0e57c599253abf2e3980aa4e60eeee871b4e2ef7
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.*/ } }