-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add GitHub Actions workflow for PR linting, auditing, and testing #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
75b75b8
9f4655b
0980b03
acb6d91
cd5d39c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| name: Pr workflow | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths-ignore: | ||
| - "**/*.go" | ||
| - "go.mod" | ||
| - "go.sum" | ||
|
|
||
| jobs: | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v2 | ||
| with: | ||
| go-version: '>=1.22' | ||
| check-latest: true | ||
|
|
||
| - name: Golangci-lint | ||
| uses: golangci/[email protected] | ||
|
|
||
| audit: | ||
| runs-on: ubuntu-20.04 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v2 | ||
| with: | ||
| go-version: 1.17 | ||
|
|
||
| - name: Verify dependencies | ||
| run: go mod verify | ||
|
|
||
| - name: Build | ||
| run: go build -v ./... | ||
|
|
||
| - name: Run go vet | ||
| run: go vet ./... | ||
|
|
||
| - name: Install staticcheck | ||
| run: go install honnef.co/go/tools/cmd/staticcheck@latest | ||
|
|
||
| - name: Run staticcheck | ||
| run: staticcheck ./... | ||
|
|
||
| - name: Install golint | ||
| run: go install golang.org/x/lint/golint@latest | ||
|
|
||
| - name: Run golint | ||
| run: golint ./... | ||
|
|
||
| - name: Run tests | ||
| run: go test -race -vet=off ./... | ||
|
|
||
|
|
||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@v3 | ||
| with: | ||
| languages: go | ||
| queries: security-and-quality | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
|
|
||
| - name: Perform CodeQL Analysis | ||
| uses: github/codeql-action/analyze@v3 | ||
|
|
||
| greetings: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Greeting to the Contributors | ||
| run: | | ||
| echo "Hello, contributors! Thank you for your hard work and dedication. Your contributions are greatly appreciated!" | ||
| echo "Keep up the great work!" | ||
| echo "Best regards," | ||
| echo "The Team" | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package program | ||
|
|
||
| import( | ||
| "fmt" | ||
| "github.com/go-git/go-git/v5" | ||
| ) | ||
|
|
||
| type Error struct { | ||
| Messafe string | ||
| } | ||
|
|
||
| func (e*Error) Error() string { | ||
| return fmt.Sprintf("Error: %s", e.Messafe) | ||
| } | ||
|
|
||
| func Search(args[]string) (string,error) { | ||
| searchTerm := args[0] | ||
| option := ["-un", "-nt", "-np"] | ||
| if len(args) == 0 { | ||
| return "", &Error{Messafe: "No search term provided"} | ||
| } | ||
|
|
||
| switch option { | ||
| case "-un": | ||
| repos,err := git.PlainOpen(".") | ||
| if err != nil { | ||
| return "", &Error{Messafe: "Failed to open git repository"} | ||
| } | ||
| } | ||
| if err:= &Error{Messafe: "Not implemented"}; err != nil { | ||
Check warningCode scanning / CodeQL Unreachable statement Warning
This statement is unreachable.
Check warningCode scanning / CodeQL Unreachable statement Warning
This statement is unreachable.
Check warningCode scanning / CodeQL Unreachable statement Warning
This statement is unreachable.
Check warningCode scanning / CodeQL Expression has no effect Warning
This expression has no effect.
|
||
| return "", err | ||
| } | ||
|
Comment on lines
+30
to
+32
Check warningCode scanning / CodeQL Expression has no effect Warning
This expression has no effect.
|
||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| module github.com/bupd/git-donkey | ||
|
|
||
| go 1.23.0 | ||
| go 1.23 | ||
|
|
||
|
|
||
| require ( | ||
| github.com/charmbracelet/bubbles v0.21.0 | ||
|
|
||
Check warning
Code scanning / CodeQL
Useless assignment to local variable Warning