Skip to content
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

Enhance Go CI #293

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ on:
pull_request:
paths:
- 'src/openstack_cpi_golang/**'
push:
paths:
- 'src/openstack_cpi_golang/**'

jobs:
go:
strategy:
matrix:
os: [macos-latest, windows-2019, ubuntu-latest]
os: [macos-latest, ubuntu-latest]
name: Run tests and Lint on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

Expand All @@ -28,22 +31,14 @@ jobs:
go-version-file: src/openstack_cpi_golang/go.mod

- name: Install golangci-lint
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

- name: Run golangci-lint and tests on Windows
if: ${{ matrix.os == 'windows-2019' }}
run: |
cd src/openstack_cpi_golang
golangci-lint run
go test ./cpi/...
go test ./integration/...

- name: Run golangci-lint and tests on non-Windows
if: ${{ matrix.os != 'windows-2019' }}
run: |
cd src/openstack_cpi_golang
golangci-lint run --enable goimports
go test ./cpi/...
go test ./integration/...
shell: bash
uses: golangci/golangci-lint-action@v6
with:
working-directory: src/openstack_cpi_golang

- name: Run unit tests
run: scripts/run-unit-tests
working-directory: src/openstack_cpi_golang

- name: Run integration tests
run: scripts/run-integration-tests
working-directory: src/openstack_cpi_golang
11 changes: 11 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# https://golangci-lint.run/usage/configuration/
run:
timeout: 3m # 1m default times out on github-action runners

linters:
enable:
- goimports

output:
# Sort results by: filepath, line and column.
sort-results: true