Skip to content

Commit

Permalink
feat: add more test context
Browse files Browse the repository at this point in the history
Signed-off-by: Xinwei Xiong(cubxxw-openim) <[email protected]>
  • Loading branch information
cubxxw committed Jul 18, 2023
1 parent a3d30e2 commit ef091fc
Show file tree
Hide file tree
Showing 11 changed files with 614 additions and 147 deletions.
20 changes: 0 additions & 20 deletions .dockerignore

This file was deleted.

161 changes: 87 additions & 74 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,81 +182,94 @@ changelog:
# signs:
# - artifacts: checksum

kos:
- repository: ghcr.io/kubecub/github-label-syncer
tags:
- '{{.Version}}'
- latest
bare: true
preserve_import_paths: false
platforms:
- linux/amd64
- linux/arm64

checksum:
name_template: "{{ .ProjectName }}_checksums.txt"
algorithm: sha256

# dockers:
# - use: buildx
# ids:
# - syncer
# goos: linux
# goarch: amd64
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
# dockerfile: docker/syncer/Dockerfile.release
# build_flag_templates:
# - --pull
# - --platform=linux/amd64
# - --label=io.sealos.image.created={{.Date}}
# - --label=io.sealos.image.title=syncer
# - --label=io.sealos.image.revision={{.ShortCommit}}
# - --label=io.sealos.image.version={{.Tag }}
# - --label=io.sealos.image.auth={{ .Env.USERNAME }}
# - use: buildx
# ids:
# - syncer
# goos: linux
# goarch: arm64
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-arm64
# dockerfile: docker/syncer/Dockerfile.release
# build_flag_templates:
# - --pull
# - --platform=linux/arm64
# - --label=io.sealos.image.created={{.Date}}
# - --label=io.sealos.image.title=lvscare
# - --label=io.sealos.image.revision={{.ShortCommit}}
# - --label=io.sealos.image.version={{.Tag }}
# - --label=io.sealos.image.auth={{ .Env.USERNAME }}
# - use: buildx
# ids:
# - sealos
# goos: linux
# goarch: amd64
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/sealos:{{ .Tag }}-amd64
# dockerfile: docker/sealos/Dockerfile.release
# build_flag_templates:
# - --pull
# - --platform=linux/amd64
# - --label=io.sealos.image.created={{.Date}}
# - --label=io.sealos.image.title=sealos
# - --label=io.sealos.image.revision={{.ShortCommit}}
# - --label=io.sealos.image.version={{.Tag }}
# - --label=io.sealos.image.auth={{ .Env.USERNAME }}
# - use: buildx
# ids:
# - sealos
# goos: linux
# goarch: arm64
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/sealos:{{ .Tag }}-arm64
# dockerfile: docker/sealos/Dockerfile.release
# build_flag_templates:
# - --pull
# - --platform=linux/arm64
# - --label=io.sealos.image.created={{.Date}}
# - --label=io.sealos.image.title=sealos
# - --label=io.sealos.image.revision={{.ShortCommit}}
# - --label=io.sealos.image.version={{.Tag }}
# - --label=io.sealos.image.auth={{ .Env.USERNAME }}
# docker_manifests:
# - name_template: ghcr.io/{{ .Env.USERNAME }}/lvscare:{{ .Tag }}
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/lvscare:{{ .Tag }}-amd64
# - ghcr.io/{{ .Env.USERNAME }}/lvscare:{{ .Tag }}-arm64
# - name_template: ghcr.io/{{ .Env.USERNAME }}/sealos:{{ .Tag }}
# image_templates:
# - ghcr.io/{{ .Env.USERNAME }}/sealos:{{ .Tag }}-amd64
# - ghcr.io/{{ .Env.USERNAME }}/sealos:{{ .Tag }}-arm64
dockers:
- use: buildx
ids:
- syncer
goos: linux
goarch: amd64
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
dockerfile: deploy/syncer/Dockerfile.syncer
build_flag_templates:
- --pull
- --platform=linux/amd64
- --label=io.syncer.image.created={{.Date}}
- --label=io.syncer.image.title=syncer
- --label=io.syncer.image.revision={{.ShortCommit}}
- --label=io.syncer.image.version={{.Tag }}
- --label=io.syncer.image.auth={{ .Env.USERNAME }}
- use: buildx
ids:
- exporter
goos: linux
goarch: amd64
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-amd64
dockerfile: deploy/exporter/Dockerfile.exporter
build_flag_templates:
- --pull
- --platform=linux/amd64
- --label=io.exporter.image.created={{.Date}}
- --label=io.exporter.image.title=exporter
- --label=io.exporter.image.revision={{.ShortCommit}}
- --label=io.exporter.image.version={{.Tag }}
- --label=io.exporter.image.auth={{ .Env.USERNAME }}
- use: buildx
ids:
- syncer
goos: linux
goarch: arm64
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
dockerfile: docker/syncer/Dockerfile.syncer
build_flag_templates:
- --pull
- --platform=linux/amd64
- --label=io.syncer.image.created={{.Date}}
- --label=io.syncer.image.title=syncer
- --label=io.syncer.image.revision={{.ShortCommit}}
- --label=io.syncer.image.version={{.Tag }}
- --label=io.syncer.image.auth={{ .Env.USERNAME }}
- use: buildx
ids:
- exporter
goos: linux
goarch: arm64
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-arm64
dockerfile: docker/exporter/Dockerfile.exporter
build_flag_templates:
- --pull
- --platform=linux/arm64
- --label=io.exporter.image.created={{.Date}}
- --label=io.exporter.image.title=exporter
- --label=io.exporter.image.revision={{.ShortCommit}}
- --label=io.exporter.image.version={{.Tag }}
- --label=io.exporter.image.auth={{ .Env.USERNAME }}


docker_manifests:
- name_template: ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-amd64
- ghcr.io/{{ .Env.USERNAME }}/exporter:{{ .Tag }}-arm64
- name_template: ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}
image_templates:
- ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-amd64
- ghcr.io/{{ .Env.USERNAME }}/syncer:{{ .Tag }}-arm64
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ FROM golang AS build
ENV GOPROXY=https://goproxy.cn

WORKDIR /go/src/app

COPY . /go/src/app

# RUN go build -o /go/bin/app cmd/exporter/main.go
RUN go build -o /go/bin/app cmd/syncer/main.go
RUN make build

FROM alpine
COPY --from=build /go/bin/app /
COPY --from=build /go/bin/app/_output /
CMD ["/app"]
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ copyright-add: tools.verify.addlicense
@$(TOOLS_DIR)/addlicense -y $(shell date +"%Y") -v -c "KubeCub open source community." -f $(LICENSE_TEMPLATE) $(CODE_DIRS)
@echo "===========> End the copyright is added..."

## tools: Install a must tools
.PHONY: tools
tools: $(addprefix tools.verify., $(BUILD_TOOLS))

## clean: Clean all builds.
.PHONY: clean
clean:
Expand All @@ -302,47 +306,51 @@ tools.verify.%:
@if [ ! -f $(TOOLS_DIR)/$* ]; then GOBIN=$(TOOLS_DIR) $(MAKE) tools.install.$*; fi
@echo "===========> $* is install in $(TOOLS_DIR)/$*"

# tools: Install a must tools
.PHONY: tools
tools: $(addprefix tools.verify., $(BUILD_TOOLS))

# tools.install.%: Install a single tool in $GOBIN/
## tools.install.%: Install a single tool in $GOBIN/
.PHONY: tools.install.%
tools.install.%:
@echo "===========> Installing $,The default installation path is $(GOBIN)/$*"
@$(MAKE) install.$*

## install: Install all tools
.PHONY: install.golangci-lint
install.golangci-lint:
@$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

## install.goimports: Install goimports, used to format go source files
.PHONY: install.goimports
install.goimports:
@$(GO) install golang.org/x/tools/cmd/goimports@latest

## install.addlicense: Install addlicense, used to add license header to source files
.PHONY: install.addlicense
install.addlicense:
@$(GO) install github.com/google/addlicense@latest

## install.deepcopy-gen: Install deepcopy-gen, used to generate deepcopy functions
.PHONY: install.deepcopy-gen
install.deepcopy-gen:
@$(GO) install k8s.io/code-generator/cmd/deepcopy-gen@latest

## install.conversion-gen: Install conversion-gen, used to generate conversion functions
.PHONY: install.conversion-gen
install.conversion-gen:
@$(GO) install k8s.io/code-generator/cmd/conversion-gen@latest

## install.ginkgo: Install ginkgo, used to run go tests
.PHONY: install.ginkgo
install.ginkgo:
@$(GO) install github.com/onsi/ginkgo/[email protected]

## install.go-junit-report: Install go-junit-report, used to generate junit report
.PHONY: install.go-gitlint
# wget -P _output/tools/ https://openim-1306374445.cos.ap-guangzhou.myqcloud.com/openim/tools/go-gitlint
# go install github.com/antham/go-gitlint/cmd/gitlint@latest
install.go-gitlint:
@wget -q https://openim-1306374445.cos.ap-guangzhou.myqcloud.com/openim/tools/go-gitlint -O ${TOOLS_DIR}/go-gitlint
@chmod +x ${TOOLS_DIR}/go-gitlint

## install.go-junit-report: Install go-junit-report, used to generate junit report
.PHONY: install.go-junit-report
install.go-junit-report:
@$(GO) install github.com/jstemmer/go-junit-report@latest
Expand Down Expand Up @@ -446,6 +454,11 @@ install.cfssl:
install.depth:
@$(GO) install github.com/KyleBanks/depth/cmd/depth@latest

## install.ko: Install ko, used to build go program into container images
.PHONY: install.ko
install.ko:
@$(GO) install github.com/google/ko@latest

## install.go-callvis: Install go-callvis, used to visualize call graph
.PHONY: install.go-callvis
install.go-callvis:
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,21 @@ The labels are designed semantic and standard. We provide labels for priority, t
**github actions



## 🛫 Quick start

> **Note**: You can get started quickly with github-label-syncer.
### 📦 Installation

```bash
git clone https://github.com/kubecub/github-label-syncer/release syncer && export syncer=$(pwd)/syncer && cd $syncer && make
```

**Install from github release**

Install from [GitHub Releases](https://github.com/kubecub/github-label-syncer/release)


#### Work with Makefile

Expand Down
23 changes: 0 additions & 23 deletions deploy/Dockerfile.exporter

This file was deleted.

19 changes: 0 additions & 19 deletions deploy/Dockerfile.syncer

This file was deleted.

14 changes: 14 additions & 0 deletions deploy/exporter/Dockerfile.exporter
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 设置基础镜像
FROM golang

# 设置工作目录
WORKDIR /app

ENV GOPROXY=https://goproxy.cn

COPY . /app/

RUN make build

# 设置容器启动命令
CMD ["/app/_output/bin/platforms/linux/amd64/exporter --help"]
14 changes: 14 additions & 0 deletions deploy/syncer/Dockerfile.syncer
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 设置基础镜像
FROM golang

# 设置工作目录
WORKDIR /app

ENV GOPROXY=https://goproxy.cn

COPY . /app/

RUN make build

# 设置容器启动命令
CMD ["/app/_output/bin/platforms/linux/amd64/syncer --help"]
Loading

0 comments on commit ef091fc

Please sign in to comment.