Skip to content

Commit

Permalink
fix lint err (#7)
Browse files Browse the repository at this point in the history
* fix lint err

* Update internal/server/server.go

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

* Update internal/server/server.go

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>

---------

Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
  • Loading branch information
corymacd and qodo-merge-pro[bot] authored Dec 11, 2024
1 parent c237530 commit 6ec18ad
Show file tree
Hide file tree
Showing 20 changed files with 686 additions and 649 deletions.
156 changes: 78 additions & 78 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
name: Go

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
tags: [ 'v*' ]

permissions:
contents: write
pull-requests: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: Run Tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3

build:
needs: [test, lint]
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- run: |
go build -v -ldflags "
-X github.com/cloudtesting/internal/version.Version=${GITHUB_SHA::7}
-X github.com/cloudtesting/internal/version.GitCommit=${GITHUB_SHA}
-X github.com/cloudtesting/internal/version.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)
-X github.com/cloudtesting/internal/version.BuildUser=${GITHUB_ACTOR}
-X github.com/cloudtesting/internal/version.GoVersion=$(go version | cut -d' ' -f3)
" ./...
goreleaser:
needs: [test, lint]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Go

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
tags: [ 'v*' ]

permissions:
contents: write
pull-requests: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: Run Tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3

build:
needs: [test, lint]
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- run: |
go build -v -ldflags "
-X github.com/cloudtesting/internal/version.Version=${GITHUB_SHA::7}
-X github.com/cloudtesting/internal/version.GitCommit=${GITHUB_SHA}
-X github.com/cloudtesting/internal/version.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)
-X github.com/cloudtesting/internal/version.BuildUser=${GITHUB_ACTOR}
-X github.com/cloudtesting/internal/version.GoVersion=$(go version | cut -d' ' -f3)
" ./...
goreleaser:
needs: [test, lint]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LDFLAGS: "-X github.com/cloudtesting/internal/version.BuildUser=${GITHUB_ACTOR} -X github.com/cloudtesting/internal/version.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
28 changes: 14 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
21 changes: 21 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused

output:
format: colored-line-number

issues:
exclude-rules:
- path: _test\.go
linters:
- errcheck

run:
deadline: 5m
68 changes: 34 additions & 34 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ldflags:
- -s -w -X main.version={{.Version}}

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
ldflags:
- -s -w -X main.version={{.Version}}

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^ci:'
18 changes: 9 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## 2024-12-10

### Added
- Introduced a new command-line interface using the Cobra library with root and server commands.
- Implemented GitHub Actions workflow for CI/CD with testing and release automation using GoReleaser.
- Added tests for server command handlers to ensure correct HTTP responses.

### Changed
- Refactored the main application to utilize the new command structure.
## 2024-12-10

### Added
- Introduced a new command-line interface using the Cobra library with root and server commands.
- Implemented GitHub Actions workflow for CI/CD with testing and release automation using GoReleaser.
- Added tests for server command handlers to ensure correct HTTP responses.

### Changed
- Refactored the main application to utilize the new command structure.
- Updated the README to reflect the new CI/CD process and build instructions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM golang:latest
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN go build -o main .
FROM golang:latest
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN go build -o main .
CMD ["/app/main"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Copyright © 2022 Cory M. MacDonald <[email protected]>
Copyright © 2022 Cory M. MacDonald <[email protected]>
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# cloudtesting ![Build Status](https://github.com/corymacd/cloudtesting/actions/workflows/build.yml/badge.svg)

Minimal golang http api for testing of deployment pipelines

## Building and Testing

This project uses GitHub Actions for CI/CD and GoReleaser for building and releasing.

### Development Build
bash
go build -v
### Releases
Releases are automated using GoReleaser. To create a new release:

1. Tag the release:
git tag -a v1.0.0 -m "Release message"
git push origin v1.0.0

This will trigger the GitHub Actions workflow which:
- Runs all tests
- Creates cross-platform builds (Linux, Windows, macOS)
- Generates a GitHub release with artifacts
- Creates release notes automatically

# cloudtesting ![Build Status](https://github.com/corymacd/cloudtesting/actions/workflows/build.yml/badge.svg)

Minimal golang http api for testing of deployment pipelines

## Building and Testing

This project uses GitHub Actions for CI/CD and GoReleaser for building and releasing.

### Development Build
bash
go build -v
### Releases
Releases are automated using GoReleaser. To create a new release:

1. Tag the release:
git tag -a v1.0.0 -m "Release message"
git push origin v1.0.0

This will trigger the GitHub Actions workflow which:
- Runs all tests
- Creates cross-platform builds (Linux, Windows, macOS)
- Generates a GitHub release with artifacts
- Creates release notes automatically

Binaries will be available on the GitHub Releases page.
Loading

0 comments on commit 6ec18ad

Please sign in to comment.