Skip to content

Merge pull request #1423 from bryanv/bryanv/clear-subnetid-nsx-restore #6400

Merge pull request #1423 from bryanv/bryanv/clear-subnetid-nsx-restore

Merge pull request #1423 from bryanv/bryanv/clear-subnetid-nsx-restore #6400

Workflow file for this run

name: ci
env:
# This value is usually commented out, allowing the go-version-file
# directive to pull the Go version from the go.mod file. However,
# sometimes we need to explicitly override the Go version, ex. CVEs,
# when it is not possible to update the go.mod version yet, ex. the
# internal builds do not yet support that version of Go.
GO_VERSION: ""
on:
pull_request:
branches:
- main
- 'release/**'
push:
branches:
- main
#jobs:
#
# lint-markdown:
# runs-on: ubuntu-latest
# steps:
# - name: Check out code
# uses: actions/checkout@v4
# - name: Lint Markdown
# run: make lint-markdown
#
# lint-shell:
# runs-on: ubuntu-latest
# steps:
# - name: Check out code
# uses: actions/checkout@v4
# - name: Lint Shell
# run: make lint-shell
jobs:
typos:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/[email protected]
verify-docs:
# needs:
# - lint-markdown
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: 'docs/requirements.txt'
- name: Install Doc Requirements
run: pip install -r docs/requirements.txt
- name: Verify Docs
run: make docs-build-python
verify-go-modules:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: Run go mod tidy
run: make modules
- name: Verify go modules have not changed
run: git diff --exit-code
- name: Run go mod download
run: make modules-download
verify-codegen:
needs:
- verify-go-modules
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'hack/quicktype/package-lock.json'
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: Verify codegen
run: make verify-codegen
verify-unfocus:
needs:
- verify-go-modules
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: 'hack/quicktype/package-lock.json'
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: Verify unfocus
run: make verify-unfocus
verify-filenames:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Verify filenames
run: make verify-filenames
verify-manifests:
needs:
- verify-go-modules
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: Create kind cluster
id: create_kind_cluster
run: make kind-up
env:
KIND_IMAGE: kindest/node:v1.31.1
- name: Verify the manifests
run: make verify-wcp-manifests
- name: Destroy kind cluster
run: make kind-down
if: steps.create_kind_cluster.outcome == 'success'
lint-go:
needs:
- verify-go-modules
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: Setup the cache for golangci-lint
uses: actions/cache@v4
with:
key: golangci-lint-${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'hack/tools/go.sum') }}
path: |
~/.cache/golangci-lint
hack/tools/bin/golangci-lint
- name: Lint Go
run: make lint-go-full
vulncheck-go:
needs:
- verify-go-modules
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: Setup the cache for govulncheck
uses: actions/cache@v4
with:
key: govulncheck-${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('go.sum', 'hack/tools/go.sum') }}
path: |
hack/tools/bin/govulncheck
- name: Vulncheck Go
run: make vulncheck-go
build-image:
needs:
- verify-go-modules
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: Build Image
run: GOOS=linux GOARCH=amd64 make image-build
test:
needs:
- verify-go-modules
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: api
covered-pkgs: ./api/...
make-target: test-nocover
upload-coverage: false
- name: crd
covered-pkgs: ./pkg/crd
make-target: test
upload-coverage: true
go-test-parallel: yes
- name: controllers
covered-pkgs: ./controllers
make-target: test
upload-coverage: true
- name: webhooks
covered-pkgs: ./webhooks
make-target: test
upload-coverage: true
- name: services
covered-pkgs: ./services
make-target: test
upload-coverage: true
- name: util-vsphere-vm
covered-pkgs: ./pkg/util/vsphere/vm
make-target: test
upload-coverage: true
- name: vmprovider
covered-pkgs: ./pkg/providers/vsphere
make-target: test
go-test-recursive: no
upload-coverage: true
- name: vmprovider-vmlifecycle
covered-pkgs: ./pkg/providers/vsphere/vmlifecycle
make-target: test
upload-coverage: true
- name: vmprovider-virtualmachine
covered-pkgs: ./pkg/providers/vsphere/virtualmachine
make-target: test
upload-coverage: true
- name: vmprovider-other
covered-pkgs: ./pkg/providers/vsphere
make-target: test
upload-coverage: true
go-test-skip-file: pkg/providers/vsphere/(([^/]+\.go)|((vmlifecycle|virtualmachine)/\.*))
- name: vmconfig
covered-pkgs: ./pkg/vmconfig
make-target: test
upload-coverage: true
- name: other
covered-pkgs: ./pkg
make-target: test
upload-coverage: true
go-test-skip-pkgs: ./pkg/providers,./pkg/crd,./pkg/util/vsphere/vm,./pkg/vmconfig
name: test-${{ matrix.name }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: test
env:
COVERED_PKGS: ${{ matrix.covered-pkgs }}
GO_TEST_RECURSIVE: ${{ matrix.go-test-recursive }}
GO_TEST_SKIP_FILE: ${{ matrix.go-test-skip-file }}
GO_TEST_SKIP_PKGS: ${{ matrix.go-test-skip-pkgs }}
GO_TEST_PARALLEL: ${{ matrix.go-test-parallel }}
run: make ${{ matrix.make-target }}
- name: store-coverage
if: matrix.upload-coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.name }}
path: |
covmeta.*
covcounters.*
coverage:
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
go-version-file: 'go.mod'
cache: true
cache-dependency-path: '**/go.sum'
- name: load-coverage
uses: actions/download-artifact@v4
with:
pattern: coverage-*
merge-multiple: true
- name: merge-coverage
run: |
go tool covdata merge -i "$(pwd)" -o /tmp/
go tool covdata textfmt -i /tmp/ -o "$(pwd)/cover.out"
- name: coverage-to-xml
run: make coverage-xml
- name: coverage-report
uses: irongut/[email protected]
with:
filename: cover.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '79 89' # really '80 90', but the values are not inclusive
- name: save-pull-request-id
if: github.event_name == 'pull_request'
env:
PR_NUMBER: ${{ github.event.number }}
run: |
echo "${PR_NUMBER}" >pull_request_id
- name: store-coverage
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: code-coverage-results
path: |
code-coverage-results.md
pull_request_id