diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c6c70f..9755ea5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,12 +13,19 @@ jobs: uses: actions/checkout@v1 - name: Integration test run: | - # build image and run container with integration test case of - # original gcov2lcov repository. + # perform an integration test with original gcov2lcov integration + # test data, which is available in the testdata/ directory. docker build -t gcov2lcov-action . - git clone https://github.com/jandelgado/gcov2lcov.git + + # create bare-bones go project to run the action on + mkdir -p gcov2lcov/.git + echo -e '[remote "origin"]\nurl = git@github.com:jandelgado/gcov2lcov\n' > gcov2lcov/.git/config + echo -e "package main\n" > gcov2lcov/main.go + echo -e "module github.com/jandelgado/gcov2lcov\ngo 1.12\n" > gcov2lcov/go.mod + cp testdata/coverage.out gcov2lcov/ + docker run -e "GITHUB_WORKSPACE=/test" \ - -e "INPUT_INFILE=testdata/coverage.out" \ - -e "INPUT_OUTFILE=testdata/coverage.lcov" \ + -e "INPUT_INFILE=coverage.out" \ + -e "INPUT_OUTFILE=coverage.lcov" \ -i --rm -v "$PWD/gcov2lcov:/test" gcov2lcov-action - diff gcov2lcov/testdata/coverage_expected.lcov gcov2lcov/testdata/coverage.lcov + diff testdata/coverage_expected.lcov gcov2lcov/coverage.lcov diff --git a/Dockerfile b/Dockerfile index 0988810..64e616c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ LABEL "com.github.actions.color"="blue" WORKDIR /go/src/app ADD . /go/src/app -RUN GO111MODULE=on go get -u github.com/jandelgado/gcov2lcov@v1.0.1 +RUN GO111MODULE=on go get -u github.com/jandelgado/gcov2lcov@8226af035b78b815f035323db7530cc3702a3847 COPY entrypoint.sh / diff --git a/README.md b/README.md index 35d24db..dbc2d06 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ No outputs. ## Example usage ```yaml -uses: jandelgado/gcov2lcov-action@v1.0.0 +uses: jandelgado/gcov2lcov-action@v1.0.1 with: infile: coverage.out outfile: coverage.lcov @@ -47,7 +47,7 @@ with: export PATH=$PATH:$(go env GOPATH)/bin go test -v -covermode=count -coverprofile=coverage.out - name: Convert coverage to lcov - uses: jandelgado/gcov2lcov-action@v1.0.0 + uses: jandelgado/gcov2lcov-action@v1.0.1 with: infile: coverage.out outfile: coverage.lcov @@ -60,7 +60,6 @@ with: See also [example repository](https://github.com/jandelgado/golang-ci-template-github-actions). - ## Author Copyright (C) 2019 Jan Delgado diff --git a/testdata/coverage.out b/testdata/coverage.out new file mode 100644 index 0000000..39d0776 --- /dev/null +++ b/testdata/coverage.out @@ -0,0 +1,4 @@ +mode: set +github.com/jandelgado/gcov2lcov/main.go:45.44,49.38 4 1 +github.com/jandelgado/gcov2lcov/main.go:46.44,50.38 4 0 +github.com/jandelgado/gcov2lcov/main.go:58.2,58.32 1 1 diff --git a/testdata/coverage_expected.lcov b/testdata/coverage_expected.lcov new file mode 100644 index 0000000..a6ba74e --- /dev/null +++ b/testdata/coverage_expected.lcov @@ -0,0 +1,12 @@ +TN: +SF:main.go +DA:45,1 +DA:46,1 +DA:47,1 +DA:48,1 +DA:49,1 +DA:50,0 +DA:58,1 +LF:7 +LH:6 +end_of_record