Skip to content

Commit

Permalink
Enhance Go CI
Browse files Browse the repository at this point in the history
  • Loading branch information
a-hassanin committed Nov 19, 2024
1 parent 3479c0a commit 16c5b2d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
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

0 comments on commit 16c5b2d

Please sign in to comment.