diff --git a/.copywrite.hcl b/.copywrite.hcl new file mode 100644 index 0000000..ca1fe5c --- /dev/null +++ b/.copywrite.hcl @@ -0,0 +1,6 @@ +schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2014 +} diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 9b2a997..cf23b1e 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,4 +1,4 @@ -# Copyright IBM Corp. 2014, 2025 +# Copyright IBM Corp. 2014, 2026 # SPDX-License-Identifier: MPL-2.0 version: 2 @@ -10,10 +10,18 @@ updates: interval: "weekly" commit-message: prefix: "[chore] : " + groups: + github-actions: + patterns: + - "*" - package-ecosystem: "gomod" directory: "/" schedule: interval: "weekly" commit-message: - prefix: "[chore] : " \ No newline at end of file + prefix: "[chore] : " + groups: + go: + patterns: + - "*" diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index b9ddd18..a4cf8a6 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -1,30 +1,36 @@ name: Build and Test Workflow -on: +on: pull_request: + push: branches: [master] jobs: - build: - runs-on: ubuntu-latest + build: + runs-on: ubuntu-latest + strategy: + matrix: + go-version: + - "oldstable" + - "stable" - steps: - - name: Checkout Code - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 - - name: Setup Go - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 - with: - go-version: '1.24' - - name: Run golangci-lint - uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a - - name: Run test and generate coverage report - run: go test -v ./... -coverprofile=coverage.out - - name: Upload Coverage Report - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a - with: - name: coverage-report - path: coverage.out - - name: Display Coverage result - run: go tool cover -func=coverage.out - - name: Build Go - run: go build ./... \ No newline at end of file + steps: + - name: Checkout Code + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + - name: Setup Go + uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 + with: + go-version: ${{ matrix.go-version }} + - name: Run golangci-lint + uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0 + - name: Run test and generate coverage report + run: go test -v -race ./... -coverprofile=coverage.out + - name: Upload Coverage Report + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a + with: + name: coverage-report + path: coverage.out + - name: Display Coverage result + run: go tool cover -func=coverage.out + - name: Build Go + run: go build ./... diff --git a/.github/workflows/copywrite.yml b/.github/workflows/copywrite.yml new file mode 100644 index 0000000..ebadf95 --- /dev/null +++ b/.github/workflows/copywrite.yml @@ -0,0 +1,24 @@ +name: Check Copywrite Headers + +on: + pull_request: + push: + branches: + - "main" + +jobs: + copywrite: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + fetch-depth: 0 + - uses: hashicorp/setup-copywrite@32638da2d4e81d56a0764aa1547882fc4d209636 # v1.1.3 + name: Setup Copywrite + with: + version: v0.25.3 + archive-checksum: e43f4b72fff3f219c5a5f883438d63edd5b68f5bea90a5d18abb3001c8c3aedc + - name: Check Header Compliance + run: make copywriteheaders +permissions: + contents: read diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f0af107 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +default: copywriteheaders lint test + +.PHONY: copywriteheaders +copywriteheaders: + @echo "==> Running copywrite headers plan..." + @copywrite headers --plan + @echo "==> Done" + +.PHONY: deps +deps: + @go install github.com/hashicorp/copywrite@b3e6599f43beff698f471c6f46888045453fa030 # v0.25.3 + @go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@c0d3ddc9cf3faa61a4e378e879ece580256d76e5 # v2.12.2 + +.PHONY: lint +lint: + @echo "==> Running linters..." + @golangci-lint run + @echo "==> Done" + +.PHONY: test +test: + @echo "==> Running tests..." + @go test -v -race ./... + @echo "==> Done"