Skip to content

Commit

Permalink
feat: add test file
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 17, 2023
1 parent 383e498 commit 783f11c
Show file tree
Hide file tree
Showing 31 changed files with 200 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

style: github
template: CHANGELOG.tpl.md
info:
Expand Down
4 changes: 4 additions & 0 deletions .github/sync_labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: f9d0c4
default: false
description: ¯\\\_(ツ)_/¯
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/create-release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

name: Create Release Branch

on:
push:
tags:
- 'v*' # 监听以 'v' 开头的 tag

jobs:
create_release_branch:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Create release branch
run: |
# 获取当前推送的 tag
TAG_NAME=$(echo "${GITHUB_REF}" | sed -e 's,.*/\(.*\),\1,')
# 检查 tag 格式是否符合预期
if [[ "${TAG_NAME}" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
MAJOR_VERSION=${BASH_REMATCH[1]}
MINOR_VERSION=${BASH_REMATCH[2]}
PATCH_VERSION=${BASH_REMATCH[3]}
# 检查是否满足创建分支的条件
if [[ ${PATCH_VERSION} -eq 0 && ! ${TAG_NAME} =~ [A-Za-z-] ]]; then
RELEASE_BRANCH_NAME="release-v${MAJOR_VERSION}.0"
# 创建分支
git branch "${RELEASE_BRANCH_NAME}" "${TAG_NAME}"
git push origin "${RELEASE_BRANCH_NAME}"
echo "Created release branch: ${RELEASE_BRANCH_NAME}"
else
echo "Tag format is invalid or does not meet the conditions. Release branch not created."
fi
else
echo "Tag format is invalid. Release branch not created."
fi
4 changes: 4 additions & 0 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

name: Daily Build and Push

on:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/depsreview.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

name: dependency-review
on: [pull_request]

Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

name: github labels syncer release

on:
push:
# run only against tags
branches:
- 'main'
tags:
- '*'
- 'v*'

permissions:
contents: write
packages: write
issues: write
id-token: write

jobs:
goreleaser:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- uses: actions/checkout@v3
with:
Expand Down
22 changes: 18 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
- make tidy
- make copyright-add
# you may remove this if you don't need go generate
- go generate ./...
- make generate

# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

snapshot:
name_template: "{{ incpatch .Version }}-next"

gomod:
proxy: true

report_sizes: true

metadata:
mod_timestamp: "{{ .CommitTimestamp }}"

# Default: './dist'
dist: _output/dist

Expand Down
10 changes: 4 additions & 6 deletions cmd/exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ var (
)

func main() {

exporters := exporter.Labels{}
// var exporters exporter.LabelsToObject
if buildInfo, available := debug.ReadBuildInfo(); available {
Expand Down Expand Up @@ -77,7 +76,7 @@ func main() {
log.Fatal(err)
}
if *file != "" {
err = os.WriteFile(*file, b, 0644)
err = os.WriteFile(*file, b, 0o644)
if err != nil {
log.Fatal(err)
}
Expand All @@ -94,7 +93,7 @@ func main() {
log.Fatal(err)
}
if *file != "" {
err = os.WriteFile(*file, b, 0644)
err = os.WriteFile(*file, b, 0o644)
if err != nil {
log.Fatal(err)
}
Expand All @@ -111,7 +110,7 @@ func main() {
log.Fatal(err)
}
if *file != "" {
err = os.WriteFile(*file, b, 0644)
err = os.WriteFile(*file, b, 0o644)
if err != nil {
log.Fatal(err)
}
Expand All @@ -128,7 +127,7 @@ func main() {
log.Fatal(err)
}
if *file != "" {
err = os.WriteFile(*file, b, 0644)
err = os.WriteFile(*file, b, 0o644)
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -165,5 +164,4 @@ func main() {
fmt.Println(string(b))
return
}

}
4 changes: 4 additions & 0 deletions cmd/syncer/.goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
Expand Down
8 changes: 5 additions & 3 deletions internal/utils/term/term_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ type wordWrapWriter struct {
// NewResponsiveWriter creates a Writer that detects the column width of the
// terminal we are in, and adjusts every line width to fit and use recommended
// terminal sizes for better readability. Does proper word wrapping automatically.
// if terminal width >= 120 columns use 120 columns
// if terminal width >= 100 columns use 100 columns
// if terminal width >= 80 columns use 80 columns
//
// if terminal width >= 120 columns use 120 columns
// if terminal width >= 100 columns use 100 columns
// if terminal width >= 80 columns use 80 columns
//
// In case we're not in a terminal or if it's smaller than 80 columns width,
// doesn't do any wrapping.
func NewResponsiveWriter(w io.Writer) io.Writer {
Expand Down
6 changes: 6 additions & 0 deletions labels-templates/go-project-layout-xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
Copyright © 2023 KubeCub open source community. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
-->

<labels>
<label>
<Name>API</Name>
Expand Down
4 changes: 4 additions & 0 deletions labels-templates/go-project-layout-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: FBCA04
default: false
description: Issues and PR about the API
Expand Down
6 changes: 6 additions & 0 deletions labels-templates/kubernetes-xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
Copyright © 2023 KubeCub open source community. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
-->

<labels>
<label>
<Name>¯\_(ツ)_/¯</Name>
Expand Down
4 changes: 4 additions & 0 deletions labels-templates/kubernetes-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: f9d0c4
default: false
description: ¯\\\_(ツ)_/¯
Expand Down
6 changes: 6 additions & 0 deletions labels-templates/kustomize-xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
Copyright © 2023 KubeCub open source community. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
-->

<labels>
<label>
<Name>¯\_(ツ)_/¯</Name>
Expand Down
4 changes: 4 additions & 0 deletions labels-templates/kustomize-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: f9d0c4
default: false
description: ¯\\\_(ツ)_/¯
Expand Down
6 changes: 6 additions & 0 deletions labels-templates/openim-xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
Copyright © 2023 KubeCub open source community. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
-->

<labels>
<label>
<Name>API</Name>
Expand Down
4 changes: 4 additions & 0 deletions labels-templates/openim-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: FB4E16
default: false
description: ""
Expand Down
6 changes: 6 additions & 0 deletions labels-templates/prometheus-xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
Copyright © 2023 KubeCub open source community. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
-->

<labels>
<label>
<Name>benchmark</Name>
Expand Down
4 changes: 4 additions & 0 deletions labels-templates/prometheus-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: ededed
default: false
description: ""
Expand Down
6 changes: 6 additions & 0 deletions labels-templates/redis-xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
Copyright © 2023 KubeCub open source community. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
-->

<labels>
<label>
<Name>action:run-benchmark</Name>
Expand Down
4 changes: 4 additions & 0 deletions labels-templates/redis-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: 1d76db
default: false
description: Triggers the benchmark suite for this Pull Request
Expand Down
6 changes: 6 additions & 0 deletions labels-templates/sealos-xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
Copyright © 2023 KubeCub open source community. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
-->

<labels>
<label>
<Name>area/api</Name>
Expand Down
4 changes: 4 additions & 0 deletions labels-templates/sealos-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: ededed
default: false
description: ""
Expand Down
6 changes: 6 additions & 0 deletions labels-templates/test-infra-xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
Copyright © 2023 KubeCub open source community. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
-->

<labels>
<label>
<Name>¯\_(ツ)_/¯</Name>
Expand Down
4 changes: 4 additions & 0 deletions labels-templates/test-infra-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: f9d0c4
default: false
description: ¯\\\_(ツ)_/¯
Expand Down
6 changes: 6 additions & 0 deletions labels-templates/vscode-xml.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
Copyright © 2023 KubeCub open source community. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
-->

<labels>
<label>
<Name>:apple: si</Name>
Expand Down
4 changes: 4 additions & 0 deletions labels-templates/vscode-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

- color: e99695
default: false
description: Issues related to apple silicon
Expand Down
1 change: 0 additions & 1 deletion pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type Client struct {
token string
}

//
type Label struct {
// The name of the label.
Name string `json:"name"`
Expand Down
4 changes: 4 additions & 0 deletions repo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

import requests

url = "https://api.github.com/orgs/kubecub/repos"
Expand Down
Loading

0 comments on commit 783f11c

Please sign in to comment.