diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a38299c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +version: 2 +updates: + - package-ecosystem: gomod + directory: / + schedule: + interval: daily + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + groups: + artifacts: + patterns: + - "actions/*-artifact" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..0231f01 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,62 @@ +name: lint + +on: + push: + branches: [ master ] + paths: + - '.github/workflows/lint.yml' + - '.golangci.yml' + - '**.go' + - 'go.*' + pull_request: + branches: [ master ] + paths: + - '.github/workflows/lint.yml' + - '.golangci.yml' + - '**.go' + - 'go.*' + +permissions: + contents: read + +jobs: + lint: + name: golang + runs-on: ubuntu-24.04 + continue-on-error: true + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.21" + + - name: Install dependencies + run: | + sudo apt-get -y update + sudo apt-get -y install libheif-dev + + - name: lint + uses: golangci/golangci-lint-action@v6.1.0 + with: + version: latest + args: --timeout=2m0s + skip-cache: true + + dependencies: + name: dependencies + runs-on: ubuntu-latest + continue-on-error: true + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "stable" + + - name: Check minimum supported version of Go + run: | + go mod tidy -go=1.21 -compat=1.21 + + - name: Check go.mod / go.sum + run: | + git add go.* + git diff --cached --exit-code go.* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..415c4b2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,42 @@ +name: test + +on: + push: + branches: [ master ] + paths: + - '.github/workflows/test.yml' + - '**.go' + - 'go.*' + pull_request: + branches: [ master ] + paths: + - '.github/workflows/test.yml' + - '**.go' + - 'go.*' + +permissions: + contents: read + +jobs: + go: + strategy: + matrix: + go-version: + - "1.21" + - "1.22" + - "1.23" + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + + - name: Install dependencies + run: | + sudo apt-get -y update + sudo apt-get -y install libheif-dev + + - name: Run tests + run: | + go test -v ./... diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..32d094c --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,40 @@ +linters: + enable: + - gofmt + - revive + +linters-settings: + revive: + ignoreGeneratedHeader: true + severity: warning + rules: + - name: blank-imports + - name: context-as-argument + - name: context-keys-type + - name: dot-imports + - name: error-return + #- name: error-strings + - name: error-naming + - name: exported + - name: if-return + - name: increment-decrement + #- name: var-naming + - name: var-declaration + - name: package-comments + - name: range + - name: receiver-naming + - name: time-naming + - name: unexported-return + #- name: indent-error-flow + - name: errorf + - name: empty-block + - name: superfluous-else + #- name: unused-parameter + - name: unreachable-code + - name: redefines-builtin-id + +issues: + exclude-rules: + - path: \.gen\.go + linters: + - gofmt