Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go_version: ['1.21', '1.22']
os: [ubuntu-latest, windows-latest, macos-14]
go_version: ['1.23']
os: [ubuntu-latest, windows-latest, macos-latest]
Comment thread
creativeprojects marked this conversation as resolved.

steps:

Expand Down Expand Up @@ -53,3 +53,33 @@ jobs:
fail_ci_if_error: false
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.os }}
path: coverage.txt

sonarCloudTrigger:
needs: build
name: SonarCloud Trigger
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- name: Download code coverage results
uses: actions/download-artifact@v4

- name: Display structure of downloaded files
run: ls -R

- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
/detect-latest-release
/go-get-release
/coverage.out
/coverage.txt
/cmd/restic
/.vscode/
72 changes: 20 additions & 52 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,22 @@
linters-settings:
govet:
check-shadowing: true
gocyclo:
min-complexity: 20
dupl:
threshold: 100
goconst:
min-len: 3
min-occurrences: 3
lll:
line-length: 160
nakedret:
max-func-lines: 20
gocritic:
enabled-tags:
- performance
- style
- diagnostic
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
settings:
rangeValCopy:
sizeThreshold: 512
hugeParam:
sizeThreshold: 512
linters:
enable-all: true
disable:
- interfacer
- scopelint
- golint
- maligned
- godot
- gochecknoglobals
- exhaustivestruct
- wsl
- nestif
- goerr113
- nlreturn
- wrapcheck
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- contextcheck
- errname
- gocheckcompilerdirectives
- gosec
- maintidx
- misspell
- cyclop
- whitespace
- paralleltest

fast: false

run:
tests: true

issues:
exclude-use-default: true

- nilnil
- noctx
- nolintlint
- predeclared
- reassign
- sloglint
- spancheck
- unconvert
- unparam
- usestdlibvars
20 changes: 18 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GOGET=$(GOCMD) get
GOPATH?=`$(GOCMD) env GOPATH`

TESTS=. ./update
COVERAGE_FILE=coverage.out
COVERAGE_FILE=coverage.txt

BUILD_DATE=`date`
BUILD_COMMIT=`git rev-parse HEAD`
Expand Down Expand Up @@ -41,7 +41,7 @@ full-coverage:
$(GOTOOL) cover -html=$(COVERAGE_FILE)

clean:
rm detect-latest-release go-get-release coverage.out
rm detect-latest-release go-get-release coverage.txt
$(GOCLEAN)

toc:
Expand All @@ -51,3 +51,19 @@ toc:
sed -i ".1" "/${TOC_START}/,/${TOC_END}/{//!d;}" "${README}"
sed -i ".2" "/${TOC_START}/r ${TOC_PATH}" "${README}"
rm ${README}.1 ${README}.2 ${TOC_PATH}

.PHONY: lint
lint:
@echo "[*] $@"
GOOS=darwin golangci-lint run
GOOS=linux golangci-lint run
GOOS=windows golangci-lint run

.PHONY: fix
fix:
@echo "[*] $@"
$(GOCMD) mod tidy
$(GOCMD) fix ./...
GOOS=darwin golangci-lint run --fix
GOOS=linux golangci-lint run --fix
GOOS=windows golangci-lint run --fix
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
codecov:
notify:
after_n_builds: 6
after_n_builds: 3
Comment thread
creativeprojects marked this conversation as resolved.

comment:
after_n_builds: 6
after_n_builds: 3

coverage:
round: nearest
Expand Down
11 changes: 11 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sonar.organization=creativeprojects
sonar.projectKey=creativeprojects_go-selfupdate
sonar.projectName=go-selfupdate
sonar.projectVersion=1.4.0

sonar.sources=.
sonar.exclusions=**/*_test.go,/docs/**

sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.go.coverage.reportPaths=**/coverage.txt
2 changes: 1 addition & 1 deletion update/hide_noop.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !windows
//go:build !windows

package update

Expand Down