From 902be07f707f288565f773c061d6ef2bd63ec751 Mon Sep 17 00:00:00 2001 From: Ahmed Hassanin Date: Tue, 19 Nov 2024 18:55:11 +0100 Subject: [PATCH] Enhance Github Workflows --- .github/workflows/go.yml | 39 ++++++++++++++++++++------------------ .github/workflows/ruby.yml | 16 ++++++++++++++-- .golangci.yml | 7 +++++++ 3 files changed, 42 insertions(+), 20 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f8245d0b..36b2b569 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,4 +1,4 @@ -name: Go +name: Run Go Tests concurrency: group: '${{ github.workflow }}-${{ github.head_ref || github.run_id }}' @@ -9,6 +9,9 @@ on: pull_request: paths: - 'src/openstack_cpi_golang/**' + push: + branches: + - master jobs: go: @@ -27,23 +30,23 @@ jobs: with: 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 + if: ${{ matrix.os != 'windows-2019' }} + uses: golangci/golangci-lint-action@v6 + with: + working-directory: src/openstack_cpi_golang - - name: Run golangci-lint and tests on Windows + - name: Run golangci-lint if: ${{ matrix.os == 'windows-2019' }} - run: | - cd src/openstack_cpi_golang - golangci-lint run - go test ./cpi/... - go test ./integration/... + uses: golangci/golangci-lint-action@v6 + with: + working-directory: src/openstack_cpi_golang + args: --disable=goimports - - 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 \ No newline at end of file + - 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 \ No newline at end of file diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index ceae5ab3..7e72b8b4 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -1,5 +1,17 @@ -name: Run Specs -on: [ push, pull_request ] +name: Run Ruby Specs + +concurrency: + group: '${{ github.workflow }}-${{ github.head_ref || github.run_id }}' + cancel-in-progress: true + +on: + workflow_dispatch: + pull_request: + paths: + - 'src/bosh_openstack_cpi/**' + push: + branches: + - master jobs: unit_specs: diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..a408e390 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,7 @@ +# https://golangci-lint.run/usage/configuration/ +run: + timeout: 3m # 1m default times out on github-action runners + +output: + # Sort results by: filepath, line and column. + sort-results: true \ No newline at end of file