Skip to content

Commit

Permalink
feat: add standardizer type check
Browse files Browse the repository at this point in the history
  • Loading branch information
cubxxw committed Mar 27, 2024
1 parent 513feb6 commit d635666
Show file tree
Hide file tree
Showing 15 changed files with 409 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .github/code-language-detector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
directory: ./
file_types:
- .go
- .yaml
- .yml
languages:
- Chinese
30 changes: 30 additions & 0 deletions .github/workflows/auto-assign-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright © 2024 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: Assign issue to comment author
on:
issue_comment:
types: [created]
jobs:
assign-issue:
if: contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/accept')
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Assign the issue
run: |
export LETASE_MILESTONES=$(curl "https://api.github.com/repos/$OWNER/$REPO/milestones" | jq -r 'last(.[]).title')
gh issue edit ${{ github.event.issue.number }} --add-assignee "${{ github.event.comment.user.login }}"
gh issue edit ${{ github.event.issue.number }} --add-label "triage/accepted"
gh issue edit ${{ github.event.issue.number }} --milestone "$LETASE_MILESTONES"
gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }} Glad to see you accepted this issue🤲, this issue has been assigned to you. <br>I set the milestones for this issue to $LETASE_MILESTONES, we are looking forward to your PR!"
env:
GH_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.html_url }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
13 changes: 13 additions & 0 deletions .github/workflows/go-typecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Go Typecheck Workflow Test

on: [push, pull_request]

jobs:
comment-language-detector:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Code Typecheck Detector
uses: kubecub/typecheck@main
13 changes: 13 additions & 0 deletions .github/workflows/language-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Language Check Workflow Test

on: [pull_request, push]

jobs:
comment-language-detector:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Code Language Detector
uses: kubecub/[email protected]
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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: Go Typecheck Release Version

on:
push:
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:
fetch-depth: 0

- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v3
with:
go-version: ${{ env.GO_VERSION }}

- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: stable

- name: Install Dependencies
run: |
sudo apt update && sudo apt install -y gcc-aarch64-linux-gnu \
libbtrfs-dev libgpgme-dev libdevmapper-dev \
qemu-user-static binfmt-support
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.BOT_GITHUB_TOKEN }}

# More assembly might be required: Docker logins, GPG, etc. It all depends
# on your needs.
- uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
version: latest
args: release --clean

env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
USERNAME: ${{ github.repository_owner }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Type Check

on: [push, pull_request]

jobs:
comment-language-detector:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Install typecheck
run: |
go install github.com/kubecub/typecheck@latest
- name: Run typecheck Detector
run: typecheck
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
# vendor/

# Go workspace file

standardizer

go.work
213 changes: 213 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# 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.

# 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"

report_sizes: true

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

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

builds:
- binary: composite
id: composite
main: ./composite.go
goos:
- windows
- darwin
- linux
- freebsd
goarch:
- amd64
- 386
- arm
- arm64
goarm:
- 6
- 7

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
files:
- LICENSE
- README.md
- CHANGELOG/*
- docs/*
# a more complete example, check the globbing deep dive below
- src: "*.md"
dst: docs

# Strip parent folders when adding files to the archive.
strip_parent: true

# File info.
# Not all fields are supported by all formats available formats.
#
# Default: copied from the source file
info:
# Templates: allowed (since v1.14)
owner: root

# Templates: allowed (since v1.14)
group: root

# Must be in time.RFC3339Nano format.
#
# Templates: allowed (since v1.14)
mtime: "{{ .CommitDate }}"

# File mode.
mode: 0644

format_overrides:
- goos: windows
format: zip

nfpms:
- id: packages
builds:
- composite
# Your app's vendor.
vendor: kubecub
homepage: https://github.com/kubecub/composite
maintainer: kubbot <https://github.com/kubbot>
description: |-
Comment Lang Detector is a tool to detect the language of comments in code files.
Kubecub && cubxxw
license: MIT
formats:
- apk
- deb
- rpm
- termux.deb # Since: v1.11
- archlinux # Since: v1.13
dependencies:
- git
recommends:
- golang

changelog:
sort: asc
use: github
filters:
exclude:
- "^test:"
- "^chore"
- "merge conflict"
- Merge pull request
- Merge remote-tracking branch
- Merge branch
- go mod tidy
groups:
- title: Dependency updates
regexp: '^.*?(feat|fix)\(deps\)!?:.+$'
order: 300
- title: "New Features"
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 100
- title: "Security updates"
regexp: '^.*?sec(\([[:word:]]+\))??!?:.+$'
order: 150
- title: "Bug fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 200
- title: "Documentation updates"
regexp: ^.*?doc(\([[:word:]]+\))??!?:.+$
order: 400
- title: "Build process updates"
regexp: ^.*?build(\([[:word:]]+\))??!?:.+$
order: 400
- title: Other work
order: 9999

# # semantization
# snapcrafts:
# - name_template: "{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
# summary: sync labels
# description: |
# sync labels
# grade: stable
# confinement: classic
# publish: true

# sboms:
# - artifacts: archive

# signs:
# - cmd: cosign
# stdin: '{{ .Env.COSIGN_PWD }}'
# args:
# - "sign-blob"
# - "--key=cosign.key"
# - "--output-signature=${signature}"
# - "${artifact}"
# - "--yes" # needed on cosign 2.0.0+
# artifacts: all

# docker_signs:


# .goreleaser.yaml
milestones:
# You can have multiple milestone configs
-
# Repository for the milestone
# Default is extracted from the origin remote URL
repo:
owner: user
name: repo

# Whether to close the milestone
close: true

# Fail release on errors, such as missing milestone.
fail_on_error: false

# Name of the milestone
#
# Default: '{{ .Tag }}'
name_template: "Current Release"

publishers:
- name: "fury.io"
ids:
- packages
dir: "{{ dir .ArtifactPath }}"
cmd: |
bash -c '
if [[ "{{ .Tag }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
curl -F package=@{{ .ArtifactName }} https://{{ .Env.FURY_TOKEN }}@push.fury.io/{{ .Env.USERNAME }}/
else
echo "Skipping deployment: Non-production release detected"
fi'
checksum:
name_template: "{{ .ProjectName }}_checksums.txt"
algorithm: sha256

release:
footer: |
**Full Changelog**: https://github.com/kubecub/composite/compare/{{ .PreviousTag }}...{{ .Tag }}
## Helping out
This release is only possible thanks to **all** the support of some **awesome people**!
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An Github Actions Tools, Development of a Go-Based Conformity Checker for Projec

#### Project Name

- `GoConformityChecker`
- `GoConcomposite`

#### Functionality Description

Expand Down Expand Up @@ -54,7 +54,7 @@ package main
import (
"flag"
"fmt"
"GoConformityChecker/checker"
"GoConcomposite/checker"
)

func main() {
Expand Down
Loading

0 comments on commit d635666

Please sign in to comment.