mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-09 08:06:22 +00:00
Merge pull request #958 from ArangoGutierrez/codecov
Some checks are pending
Some checks are pending
[no-relnote] Enable Coveralls for code coverage
This commit is contained in:
commit
c8c22162b7
21
.github/workflows/golang.yaml
vendored
21
.github/workflows/golang.yaml
vendored
@ -30,54 +30,73 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
name: Checkout code
|
name: Checkout code
|
||||||
|
|
||||||
- name: Get Golang version
|
- name: Get Golang version
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
GOLANG_VERSION=$(./hack/golang-version.sh)
|
GOLANG_VERSION=$(./hack/golang-version.sh)
|
||||||
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
|
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GOLANG_VERSION }}
|
go-version: ${{ env.GOLANG_VERSION }}
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
uses: golangci/golangci-lint-action@v8
|
uses: golangci/golangci-lint-action@v8
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: -v --timeout 5m
|
args: -v --timeout 5m
|
||||||
skip-cache: true
|
skip-cache: true
|
||||||
|
|
||||||
- name: Check golang modules
|
- name: Check golang modules
|
||||||
run: |
|
run: |
|
||||||
make check-vendor
|
make check-vendor
|
||||||
make -C deployments/devel check-modules
|
make -C deployments/devel check-modules
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Unit test
|
name: Unit test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get Golang version
|
- name: Get Golang version
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
GOLANG_VERSION=$(./hack/golang-version.sh)
|
GOLANG_VERSION=$(./hack/golang-version.sh)
|
||||||
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
|
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GOLANG_VERSION }}
|
go-version: ${{ env.GOLANG_VERSION }}
|
||||||
- run: make test
|
|
||||||
|
- name: Run unit tests and generate coverage report
|
||||||
|
run: make coverage
|
||||||
|
|
||||||
|
- name: Upload to Coveralls
|
||||||
|
uses: coverallsapp/github-action@v2
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: coverage.out
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get Golang version
|
- name: Get Golang version
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
GOLANG_VERSION=$(./hack/golang-version.sh)
|
GOLANG_VERSION=$(./hack/golang-version.sh)
|
||||||
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
|
echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GOLANG_VERSION }}
|
go-version: ${{ env.GOLANG_VERSION }}
|
||||||
|
|
||||||
- run: make build
|
- run: make build
|
||||||
|
6
Makefile
6
Makefile
@ -122,11 +122,11 @@ licenses:
|
|||||||
|
|
||||||
COVERAGE_FILE := coverage.out
|
COVERAGE_FILE := coverage.out
|
||||||
test: build cmds
|
test: build cmds
|
||||||
go test -coverprofile=$(COVERAGE_FILE) $(MODULE)/...
|
go test -coverprofile=$(COVERAGE_FILE).with-mocks $(MODULE)/...
|
||||||
|
|
||||||
coverage: test
|
coverage: test
|
||||||
cat $(COVERAGE_FILE) | grep -v "_mock.go" > $(COVERAGE_FILE).no-mocks
|
cat $(COVERAGE_FILE).with-mocks | grep -v "_mock.go" > $(COVERAGE_FILE)
|
||||||
go tool cover -func=$(COVERAGE_FILE).no-mocks
|
go tool cover -func=$(COVERAGE_FILE)
|
||||||
|
|
||||||
generate:
|
generate:
|
||||||
go generate $(MODULE)/...
|
go generate $(MODULE)/...
|
||||||
|
Loading…
Reference in New Issue
Block a user