refactor: client.go file helper methods #1441
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, Lint, and Test | |
env: | |
EXPORT_RESULT: true | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build-container: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/golangci-lint | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install devbox | |
run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f | |
- name: Install devbox deps | |
run: devbox install | |
- name: Verify that generated manifests committed to the repository are up to date | |
run: devbox run -- make verify-manifests | |
- name: Build | |
run: devbox run -- make generate fmt vet build | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v3.7.0 | |
with: | |
args: --enable gofmt --enable gofumpt --timeout 5m --build-tags e2e | |
- name: Lint | |
run: devbox run -- make lint-yaml | |
- name: Run unit tests | |
run: devbox run -- make unit-test | |
# gocov-xml expects things to be properly placed under go path. | |
# GHA clones into /home/runner/work/repository so we create | |
# the directory under the right path and link it | |
- run: mkdir -p /home/runner/go/src/github.com/nutanix-cloud-native/ && ln -s /home/runner/work/cluster-api-provider-nutanix/cluster-api-provider-nutanix /home/runner/go/src/github.com/nutanix-cloud-native | |
- name: Run coverage report | |
run: devbox run -- "make coverage" | |
- name: Codecov | |
uses: codecov/codecov-action@v3.1.4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: ./coverage.xml # Replace with the path to your coverage report | |
fail_ci_if_error: true | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@0.16.1 | |
with: | |
scan-type: "fs" | |
ignore-unfixed: true | |
format: "table" | |
exit-code: "1" | |
vuln-type: "os,library" | |
severity: "CRITICAL,HIGH" |