diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fe96f50 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + go-version: ['1.25'] + + steps: + - uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: ${{ matrix.go-version }} + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v -race -coverprofile=coverage.out ./... + + - name: Upload coverage + if: matrix.go-version == '1.25' + uses: codecov/codecov-action@v5 + with: + files: coverage.out + fail_ci_if_error: false + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: '1.25' + + - name: golangci-lint + uses: golangci/golangci-lint-action@v9 + with: + version: latest diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..1337d6b --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,4 @@ +version: "2" +linters: + disable: + - unused diff --git a/go.mod b/go.mod index 7e5cd41..327c983 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/git-pkgs/spdx -go 1.25.5 +go 1.25.6 require github.com/github/go-spdx/v2 v2.3.6 diff --git a/parse_lax_test.go b/parse_lax_test.go index 38afc7c..59614d1 100644 --- a/parse_lax_test.go +++ b/parse_lax_test.go @@ -142,7 +142,7 @@ func BenchmarkParseLax(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { for _, expr := range expressions { - ParseLax(expr) + _, _ = ParseLax(expr) } } } diff --git a/real_world_test.go b/real_world_test.go index 07c6057..81f26c1 100644 --- a/real_world_test.go +++ b/real_world_test.go @@ -297,7 +297,7 @@ func BenchmarkRealWorldNormalization(b *testing.B) { for i := 0; i < b.N; i++ { for _, input := range inputs { // Try ParseLax on everything - ParseLax(input) + _, _ = ParseLax(input) } } } diff --git a/spdx_test.go b/spdx_test.go index 4464dfd..0d116d7 100644 --- a/spdx_test.go +++ b/spdx_test.go @@ -441,7 +441,7 @@ func BenchmarkNormalize(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { for _, input := range inputs { - Normalize(input) + _, _ = Normalize(input) } } } @@ -460,7 +460,7 @@ func BenchmarkNormalizeBatch(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { for _, input := range inputs { - Normalize(input) + _, _ = Normalize(input) } } } @@ -476,7 +476,7 @@ func BenchmarkParse(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { for _, expr := range expressions { - Parse(expr) + _, _ = Parse(expr) } } }