-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI with Linting and Testing (#142)
* Refactor codebase for improved functionality, error handling, and data manipulation Signed-off-by: Rodney Osodo <[email protected]> * Add Dependabot configuration file - Added a new file `.github/dependbot.yml` to the codebase. - The file includes configuration for Dependabot. - Added settings for two package ecosystems: `github-actions` and `gomod`. - Both ecosystems are set to be checked on a weekly basis. Signed-off-by: Rodney Osodo <[email protected]> * Add CI pipeline configuration for continuous integration A new file named "ci.yml" has been added to the GitHub repository. This file contains a CI pipeline configuration that enables continuous integration. The pipeline is triggered by pull requests and pushes to the main branch. It runs on an Ubuntu environment and includes several steps such as checking out code, setting up Go, running golangci-lint, and building binaries for different operating systems and architectures. Additionally, the configuration includes build commands for different operating systems and architectures, followed by a test command for running tests with coverage analysis. Signed-off-by: Rodney Osodo <[email protected]> * Refactor CI workflow to remove unnecessary build steps for darwin/arm platforms Signed-off-by: Rodney Osodo <[email protected]> * Rename .github/dependbot.yml to .github/dependabot.yml. Signed-off-by: Rodney Osodo <[email protected]> * Refactor linter settings in .golangci.yml Removed the errcheck and stylecheck linters from the list of enabled linters in .golangci.yml. Signed-off-by: Rodney Osodo <[email protected]> --------- Signed-off-by: Rodney Osodo <[email protected]>
- Loading branch information
1 parent
c6cf7da
commit c3907ec
Showing
43 changed files
with
188 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: CI Pipeline | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
name: Continuous Integration | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21.x | ||
cache-dependency-path: "go.sum" | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
|
||
- name: Build binary | ||
run: | | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o immich-linux-amd64.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o immich-linux-arm64.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o immich-linux-arm6.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o immich-linux-arm7.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o immich-windows-amd64.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -o immich-windows-arm64.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=windows GOARCH=arm GOARM=6 go build -o immich-windows-arm6.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=windows GOARCH=arm GOARM=7 go build -o immich-windows-arm7.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o immich-darwin-amd64.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o immich-darwin-arm64.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o immich-freebsd-amd64.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -o immich-freebsd-arm64.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=6 go build -o immich-freebsd-arm6.exe -ldflags="-s -w -extldflags=-static" main.go | ||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm GOARM=7 go build -o immich-freebsd-arm7.exe -ldflags="-s -w -extldflags=-static" main.go | ||
- name: Run tests | ||
run: | | ||
go test --race -v -count=1 -coverprofile=coverage.out ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
run: | ||
timeout: 3m | ||
|
||
issues: | ||
max-issues-per-linter: 100 | ||
max-same-issues: 100 | ||
|
||
linters-settings: | ||
gocritic: | ||
enabled-checks: | ||
- captLocal | ||
- singleCaseSwitch | ||
- switchTrue | ||
- httpNoBody | ||
- emptyStringTest | ||
- builtinShadow | ||
- exposedSyncMutex | ||
enabled-tags: | ||
- diagnostic | ||
disabled-tags: | ||
- performance | ||
- style | ||
- experimental | ||
- opinionated | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- gocritic | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- whitespace | ||
- gci | ||
- gofmt | ||
- goimports | ||
- loggercheck | ||
- asasalint | ||
- contextcheck | ||
- decorder | ||
- dogsled | ||
- errchkjson | ||
- exportloopref | ||
- ginkgolinter | ||
- gocheckcompilerdirectives | ||
- goprintffuncname | ||
- mirror | ||
- nakedret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.