-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
24,226 additions
and
8,984 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,131 +1,137 @@ | ||
version: 2 | ||
version: 2.1 | ||
parameters: | ||
cmds: | ||
type: string | ||
default: "ssl-status-board" | ||
|
||
jobs: | ||
frontend: | ||
build_node: | ||
resource_class: medium | ||
docker: | ||
- image: cimg/node:16.15 | ||
- image: cimg/node:16.20 | ||
steps: | ||
- checkout | ||
- run: | ||
name: "Install dependencies" | ||
command: yarn install | ||
- run: | ||
name: "Run lint" | ||
command: yarn lint | ||
working_directory: frontend | ||
command: npm install | ||
- run: | ||
name: "Build" | ||
command: yarn build | ||
working_directory: frontend | ||
command: npm run build | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- pkg/board/ui/dist/* | ||
- frontend/dist/* | ||
|
||
backend: | ||
test_go: | ||
resource_class: medium | ||
docker: | ||
- image: cimg/go:1.18 | ||
- image: cimg/go:1.20.2 | ||
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 | ||
- run: | ||
command: | | ||
GOOS=linux GOARCH=amd64 go build -o release/ssl-status-board_linux_amd64 ./cmd/ssl-status-board | ||
GOOS=linux GOARCH=arm go build -o release/ssl-status-board_linux_arm ./cmd/ssl-status-board | ||
GOOS=linux GOARCH=arm64 go build -o release/ssl-status-board_linux_arm64 ./cmd/ssl-status-board | ||
GOOS=darwin GOARCH=amd64 go build -o release/ssl-status-board_darwin_amd64 ./cmd/ssl-status-board | ||
GOOS=windows GOARCH=amd64 go build -o release/ssl-status-board_windows_amd64.exe ./cmd/ssl-status-board | ||
- run: | ||
command: | | ||
mkdir -p release | ||
cp -a rpi ssl-status-board | ||
tar czf release/bootstrap.tar.gz ssl-status-board | ||
- store_artifacts: | ||
path: coverage.html | ||
destination: coverage | ||
|
||
build_go: | ||
resource_class: large | ||
docker: | ||
- image: cimg/go:1.20.2 | ||
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} | ||
done | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- release/* | ||
- store_artifacts: | ||
path: coverage.html | ||
destination: coverage | ||
|
||
publish-github-release: | ||
publish_gh: | ||
resource_class: small | ||
docker: | ||
- image: cimg/go:1.18 | ||
- image: cimg/go:1.20.2 | ||
steps: | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: "Prepare artifacts" | ||
working_directory: release | ||
command: | | ||
mv ssl-status-board_linux_amd64 ssl-status-board_${CIRCLE_TAG}_linux_amd64 | ||
mv ssl-status-board_linux_arm ssl-status-board_${CIRCLE_TAG}_linux_arm | ||
mv ssl-status-board_linux_arm64 ssl-status-board_${CIRCLE_TAG}_linux_arm64 | ||
mv ssl-status-board_darwin_amd64 ssl-status-board_${CIRCLE_TAG}_darwin_amd64 | ||
mv ssl-status-board_windows_amd64.exe ssl-status-board_${CIRCLE_TAG}_windows_amd64.exe | ||
- run: | ||
name: "Publish Release on GitHub" | ||
command: | | ||
go install github.com/tcnksm/ghr@v0.14.0 | ||
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./release/ | ||
- run: | | ||
mkdir -p release | ||
cp -a rpi ssl-status-board | ||
tar czf release/bootstrap.tar.gz ssl-status-board | ||
- run: | | ||
set -u | ||
go install github.com/tcnksm/ghr@v0.16.0 | ||
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -generatenotes ${CIRCLE_TAG} ./release | ||
docker-build: | ||
build_docker: | ||
resource_class: small | ||
docker: | ||
- image: cimg/base:2022.06 | ||
- image: cimg/base:2023.04 | ||
steps: | ||
- checkout | ||
- setup_remote_docker: | ||
version: 20.10.11 | ||
version: 20.10.18 | ||
- run: | | ||
docker build . | ||
for cmd in << pipeline.parameters.cmds >>; do | ||
docker build --build-arg cmd=${cmd} -t robocupssl/${cmd}:latest . | ||
done | ||
docker-build-and-push: | ||
publish_docker: | ||
resource_class: small | ||
docker: | ||
- image: cimg/base:2022.06 | ||
- image: cimg/base:2023.04 | ||
steps: | ||
- checkout | ||
- setup_remote_docker: | ||
version: 20.10.11 | ||
version: 20.10.18 | ||
- run: | | ||
# Parse version from tag (removing 'v' prefix) | ||
TAG=${CIRCLE_TAG:1} | ||
TAG=${TAG:-latest} | ||
docker build -t robocupssl/ssl-status-board:$TAG . | ||
docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}" | ||
docker push robocupssl/ssl-status-board:$TAG | ||
for cmd in << pipeline.parameters.cmds >>; do | ||
docker build --build-arg cmd=${cmd} -t robocupssl/${cmd}:${TAG} . | ||
docker login -u "${DOCKER_HUB_USERNAME}" -p "${DOCKER_HUB_PASSWORD}" | ||
docker push robocupssl/${cmd}:${TAG} | ||
done | ||
workflows: | ||
version: 2 | ||
main: | ||
build: | ||
jobs: | ||
- frontend: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- backend: | ||
requires: | ||
- frontend | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- publish-github-release: | ||
- 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: | ||
- backend | ||
filters: | ||
branches: | ||
ignore: /.*/ | ||
tags: | ||
only: /^v.*/ | ||
- docker-build: | ||
context: docker hub | ||
filters: | ||
branches: | ||
ignore: master | ||
- docker-build-and-push: | ||
requires: [ build_go ] | ||
filters: { branches: { ignore: /.*/ }, tags: { only: /^v.*/ } } | ||
docker: | ||
jobs: | ||
- build_docker | ||
- publish_docker: | ||
context: docker hub | ||
filters: | ||
branches: | ||
only: master | ||
tags: | ||
only: /^v.*/ | ||
filters: { branches: { only: master }, tags: { only: /^v.*/ } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
/node_modules | ||
/dist | ||
/.git | ||
* | ||
!cmd | ||
!frontend | ||
!internal | ||
!pkg | ||
!go.mod | ||
!go.sum | ||
|
||
frontend/node_modules | ||
frontend/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
[*.vue] | ||
indent_size = 4 | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.proto] | ||
indent_size = 4 | ||
|
||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
changelog: | ||
categories: | ||
- title: 🏕 Features | ||
labels: | ||
- '*' | ||
exclude: | ||
labels: | ||
- dependencies | ||
- title: 👒 Dependencies | ||
labels: | ||
- dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": [ | ||
"config:base", | ||
"schedule:monthly" | ||
], | ||
"labels": [ | ||
"dependencies" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
FROM node:16.15-alpine3.15 AS build_node | ||
WORKDIR /tmp/ssl-status-board | ||
COPY . . | ||
RUN yarn install | ||
RUN yarn build | ||
FROM node:16-alpine AS build_node | ||
COPY frontend frontend | ||
WORKDIR frontend | ||
RUN npm install | ||
RUN npm run build | ||
|
||
FROM golang:1.18-alpine AS build_go | ||
WORKDIR /go/src/github.com/RoboCup-SSL/ssl-status-board | ||
FROM golang:1.20-alpine AS build_go | ||
ARG cmd=ssl-status-board | ||
WORKDIR work | ||
COPY . . | ||
COPY --from=build_node /tmp/ssl-status-board/pkg/board/ui/dist pkg/board/ui/dist | ||
RUN go build -o release/ssl-status-board_linux_amd64 ./cmd/ssl-status-board | ||
COPY --from=build_node frontend/dist frontend/dist | ||
RUN go install ./cmd/${cmd} | ||
|
||
# Start fresh from a smaller image | ||
FROM alpine:3.16 | ||
COPY --from=build_go /go/src/github.com/RoboCup-SSL/ssl-status-board/release/ssl-status-board_linux_amd64 /app/ssl-status-board | ||
EXPOSE 8082 | ||
FROM alpine:3 | ||
ARG cmd | ||
COPY --from=build_go /go/bin/${cmd} /app/${cmd} | ||
WORKDIR /data | ||
RUN chown 1000: /data | ||
USER 1000 | ||
ENTRYPOINT ["/app/ssl-status-board"] | ||
ENV COMMAND="/app/${cmd}" | ||
ENTRYPOINT "${COMMAND}" | ||
CMD [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
CMDS = ssl-status-board | ||
DOCKER_TARGETS = $(addprefix docker-, $(CMDS)) | ||
.PHONY: all docker frontend test install proto $(DOCKER_TARGETS) | ||
|
||
all: install docker | ||
|
||
docker: $(DOCKER_TARGETS) | ||
|
||
$(DOCKER_TARGETS): docker-%: | ||
docker build --build-arg cmd=$* -t $*:latest . | ||
|
||
.frontend: $(shell find frontend/ -type f -not -path "frontend/node_modules/*") | ||
cd frontend && \ | ||
npm install && \ | ||
npm run build && \ | ||
touch ../.frontend | ||
|
||
frontend: .frontend | ||
|
||
install: frontend | ||
go install -v ./... | ||
|
||
test: frontend | ||
go test ./... | ||
|
||
run: frontend | ||
go run ./cmd/$(word 1,$(CMDS)) | ||
|
||
proto: | ||
tools/generateProto.sh |
Oops, something went wrong.