forked from mozilla-services/pkcs7
-
Notifications
You must be signed in to change notification settings - Fork 13
Modernize GitHub Actions workflows and deprecated Go code patterns #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a7c789e
Initial plan
Copilot cf7e188
Update GitHub Actions workflows and modernize deprecated Go code patt…
Copilot 661b7a3
Fix Makefile staticcheck path and optimize build targets
Copilot 32d67f0
Add coverage.out to .gitignore to exclude build artifacts
Copilot 138206c
Update Go version to 1.24 and replace staticcheck with golangci-lint
Copilot 72707fb
Rename verify_test_dsa.go to dsa_test.go to follow Go naming conventions
Copilot 0d7983c
Fix CI workflow and SHA1 compatibility issues for Go 1.24
Copilot 57bd227
Fix CI workflow and address code quality improvements
Copilot dc6b33a
Fix DSA signature verification test failures across Go versions
Copilot 1390b41
Remove DSA signature verification functionality, allow parsing with p…
Copilot 70b1843
Fix tests
rosstimothy a136a97
Update golangci-lint and ci workflow
rosstimothy 50e53e2
move legacy tests behind a legacy build tag
rosstimothy d4636af
Split legacy tests into their own step in CI
rosstimothy 481dace
Limit linting to Go version defined in go.mod
rosstimothy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,28 +1,61 @@ | ||
| name: CI | ||
| on: [push, pull_request] | ||
|
|
||
| env: | ||
| GODEBUG: x509sha1=1 | ||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| branches: [main, master] | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint | ||
| strategy: | ||
| matrix: | ||
| go: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24"] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: ${{ matrix.go }} | ||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 | ||
| with: | ||
| version: v2.3.0 | ||
|
|
||
| test: | ||
| name: Test | ||
| strategy: | ||
| matrix: | ||
| go: ['1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19'] | ||
| go: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24"] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: ${{ matrix.go }} | ||
| - name: Test | ||
| run: | | ||
| go vet . | ||
| go build . | ||
| go test -count=1 -covermode=count -coverprofile=coverage.out . | ||
|
|
||
| legacy-test: | ||
| name: Legacy Tests | ||
| strategy: | ||
| matrix: | ||
| go: ["1.19", "1.20", "1.21", "1.22", "1.23"] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v2 | ||
| with: | ||
| go-version: ${{ matrix.go }} | ||
| stable: false | ||
| - name: Test | ||
| env: | ||
| # set this environment variable to true so tests can be run with the | ||
| # sha1 algorithm. Without this set, tests fail because Go notes the | ||
| # SHA1 algorithm as insecure | ||
| GODEBUG: x509sha1=1 | ||
| run: go vet . && go build . && go test -count=1 -covermode=count -coverprofile=coverage.out . | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: ${{ matrix.go }} | ||
| - name: Test | ||
| run: | | ||
| go vet -tags=legacy . | ||
| go build -tags=legacy . | ||
| GODEBUG=x509sha1=1 go test -tags=legacy -count=1 -covermode=count -coverprofile=coverage.out . -run "^TestLegacy.*$" | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -22,3 +22,6 @@ _testmain.go | |
| *.exe | ||
| *.test | ||
| *.prof | ||
|
|
||
| # Coverage reports | ||
| coverage.out | ||
This file contains hidden or 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,66 @@ | ||
| version: "2" | ||
| linters: | ||
| enable: | ||
| - copyloopvar | ||
| - goconst | ||
| - gocyclo | ||
| - gosec | ||
| - misspell | ||
| - nolintlint | ||
| - prealloc | ||
| - revive | ||
| - unconvert | ||
| - unparam | ||
| settings: | ||
| gocyclo: | ||
| min-complexity: 90 # Allow very high complexity for crypto functions and test utilities | ||
| gosec: | ||
| excludes: | ||
| - G401 # Allow weak crypto algorithms as this is a crypto library | ||
| - G501 # Allow import of blacklisted crypto/md5 | ||
| - G505 # Allow import of blacklisted crypto/sha1 | ||
| - G502 # Allow import of blacklisted crypto/des | ||
| - G405 # Allow use of weak cryptographic primitive | ||
| - G306 # Allow WriteFile permissions for test files | ||
| - G204 # Allow subprocess launches in tests (OpenSSL integration) | ||
| - G115 # Allow integer overflow conversion | ||
| revive: | ||
| rules: | ||
| - name: exported | ||
| disabled: true # Disable exported rule for crypto library | ||
| staticcheck: | ||
| checks: | ||
| - all | ||
| exclusions: | ||
| generated: lax | ||
| presets: | ||
| - comments | ||
| - common-false-positives | ||
| - legacy | ||
| - std-error-handling | ||
| rules: | ||
| # Allow specific deprecated crypto algorithms that are needed for PKCS#7 compatibility | ||
| - linters: | ||
| - staticcheck | ||
| text: SA1019.*crypto/dsa.*has been deprecated | ||
| - linters: | ||
| - staticcheck | ||
| text: SA1019.*crypto/sha1.*is deprecated | ||
| - linters: | ||
| - staticcheck | ||
| text: SA1019.*crypto/md5.*is deprecated | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
| formatters: | ||
| enable: | ||
| - gofmt | ||
| - gofumpt | ||
| - goimports | ||
| exclusions: | ||
| generated: lax | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,20 +1,19 @@ | ||
| all: vet staticcheck test | ||
| all: vet test | ||
|
|
||
| test: | ||
| GODEBUG=x509sha1=1 go test -covermode=count -coverprofile=coverage.out . | ||
| go test -covermode=count -coverprofile=coverage.out . | ||
|
|
||
| test-legacy: | ||
| GODEBUG=x509sha1=1 go test -tags=legacy -covermode=count -coverprofile=coverage.out . | ||
|
|
||
| showcoverage: test | ||
| go tool cover -html=coverage.out | ||
|
|
||
| vet: | ||
| go vet . | ||
|
|
||
| lint: | ||
| golint . | ||
|
|
||
| staticcheck: | ||
| staticcheck . | ||
| golangci-lint: | ||
| golangci-lint run | ||
|
|
||
| gettools: | ||
| go get -u honnef.co/go/tools/... | ||
| go get -u golang.org/x/lint/golint | ||
| go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.