Skip to content

Commit

Permalink
feat: add precommit and ci, remove sonar logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kafkaphoenix committed Dec 13, 2024
1 parent cd27ae0 commit dbcdbfc
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 27 deletions.
7 changes: 0 additions & 7 deletions .ci/tools/bump_version.sh

This file was deleted.

File renamed without changes.
29 changes: 29 additions & 0 deletions .github/workflows/github-pr-title-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "[GitHub] Validate PR title"

on:
pull_request_target:
types: [opened, edited, synchronize]

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
types: |
chore
ci
docs
feat
fix
requireScope: false
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
starts with an uppercase character.
wip: true
validateSingleCommit: true
24 changes: 24 additions & 0 deletions .github/workflows/github-stale-issues-and-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "[GitHub] Mark stale issues and PRs"
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest

# ref: https://github.com/actions/stale?tab=readme-ov-file#recommended-permissions
permissions:
contents: write
issues: write
pull-requests: write

steps:
- uses: actions/stale@v9
with:
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity.'
stale-pr-message: 'This pull request is stale because it has been open 60 days with no activity.'
days-before-stale: 60
days-before-close: -1
stale-issue-label: 'stale'
stale-pr-label: 'stale'
43 changes: 43 additions & 0 deletions .github/workflows/quality-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "[QA] Quality Checks API"

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'runner/*'
- 'sdk/*'
push:
paths:
- 'runner/*'
- 'sdk/*'

jobs:
quality-checks:
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: read
checks: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.2

- name: Linter
uses: golangci/golangci-lint-action@v6
with:
version: v1.62.2
args: --config ../.github/.golangci.yml
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Tests
run: go test ./... --tags=integration,unit -cover -v
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
- id: trailing-whitespace
- id: check-merge-conflict
- id: check-symlinks
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/zricethezav/gitleaks
rev: v8.21.1
hooks:
- id: gitleaks
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: golangci-lint
args: ['--config', '.github/.golangci.yml']
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ generate_mocks: ## Generate mocks

.PHONY: tidy
tidy: ## Run golangci-lint, goimports and gofmt
golangci-lint run ./... && goimports -w . && gofmt -s -w -e -d . && cd -
golangci-lint run ./... --config .github/.golangci.yml && goimports -w . && gofmt -s -w -e -d . && cd -

.PHONY: tests
tests: ## Run integration and unit tests
Expand Down
3 changes: 0 additions & 3 deletions package.json

This file was deleted.

16 changes: 0 additions & 16 deletions sonar-project.properties

This file was deleted.

0 comments on commit dbcdbfc

Please sign in to comment.