-
Notifications
You must be signed in to change notification settings - Fork 2
Modernize CI workflow (GitHub Actions v4/v5, test matrix) #13
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
Changes from all commits
be83a26
a861631
fa5828d
e710427
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,66 @@ | ||
| name: CI | ||
|
|
||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Check | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GO111MODULE: on | ||
|
|
||
| steps: | ||
|
|
||
| - name: Install libraries | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libncurses5 libaio1 libnuma1 bash-completion | ||
| - name: Set up Go 1.x | ||
| uses: actions/setup-go@v2 | ||
| with: | ||
| go-version: ^1.18 | ||
| lint: | ||
| name: Lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.22' | ||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@v6 | ||
| with: | ||
| version: latest | ||
| - name: govulncheck | ||
| run: | | ||
| go install golang.org/x/vuln/cmd/govulncheck@latest | ||
| govulncheck ./... | ||
| - name: Copyright check | ||
| run: ./scripts/sanity_check.sh copyright | ||
|
Comment on lines
+21
to
+25
|
||
|
|
||
| - name: Check out code into the Go module directory | ||
| uses: actions/checkout@v2 | ||
| test: | ||
| name: Test (Go ${{ matrix.go-version }}, ${{ matrix.os }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| go-version: ['1.22', '1.23'] | ||
| os: [ubuntu-latest, macos-latest] | ||
| env: | ||
| GO111MODULE: on | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: ${{ matrix.go-version }} | ||
| - name: Install libraries (Linux) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y libncurses5 libaio1 libnuma1 bash-completion | ||
| - name: Unit tests | ||
| run: ./test/go-unit-tests.sh | ||
|
|
||
| - name: tests | ||
| run: ./scripts/ci.sh | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| needs: [lint, test] | ||
| env: | ||
| GO111MODULE: on | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.22' | ||
| - name: Build | ||
| run: ./scripts/build.sh linux | ||
| - name: Verify executable | ||
| run: | | ||
| version=$(cat common/VERSION) | ||
| test -f "dbdeployer-${version}.linux" || exit 1 | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,7 @@ linters: | |||||||
| - ineffassign | ||||||||
| - staticcheck | ||||||||
| - unused | ||||||||
| - gosec | ||||||||
|
||||||||
| - gosec | |
| - gosec | |
| - gofmt |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,10 +1,9 @@ | ||||||
| # This is an example .goreleaser.yml file with some sensible defaults. | ||||||
| # Make sure to check the documentation at https://goreleaser.com | ||||||
| # # goreleaser release --skip-publish --snapshot | ||||||
| version: 2 | ||||||
|
|
||||||
| before: | ||||||
| hooks: | ||||||
| # You may remove this if you don't use go modules. | ||||||
| - go mod tidy | ||||||
|
|
||||||
| builds: | ||||||
| - env: | ||||||
| - CGO_ENABLED=0 | ||||||
|
|
@@ -14,18 +13,22 @@ builds: | |||||
| goarch: | ||||||
| - amd64 | ||||||
| - arm64 | ||||||
|
|
||||||
| archives: | ||||||
| - replacements: | ||||||
| darwin: Darwin | ||||||
| linux: Linux | ||||||
| amd64: x86_64 | ||||||
| - formats: ['tar.gz'] | ||||||
| name_template: >- | ||||||
| {{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }} | ||||||
|
||||||
| {{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }} | |
| {{ .ProjectName }}-{{ .Version }}.{{ .Os }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
version: latestfor golangci-lint makes CI non-reproducible and can cause sudden failures when a new linter release ships. Pin the golangci-lint version (and similarly consider pinning govulncheck) to a known-good version, then update it intentionally.