Commit c853dbc5 authored by Thomas Boni's avatar Thomas Boni
Browse files

Merge branch '660-go_unit_test-update-docker-image' into 'latest'

Resolve "[go_unit_test] - Update docker image"

Closes #660

See merge request r2devops/hub!416
parents 0c1b2c64 f90ef64b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
# Changelog
All notable changes to this job will be documented in this file.

## [1.3.0] - 2022-11-08
* Update docker image version into golang 1.19.3
* Improve job output

## [1.2.0] - 2022-06-13
* Add docker image tag in variable

+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ Execute your golang unit tests and have the results fully integrated with the va
| ---- | ----------- | ------- |
| `UT_WORK_DIR` | If for any reason (monorepo for example) your go project is not at root of project, specify the relative path to the project | `$CI_PROJECT_DIR` |
| `UT_TEST_CMD` | Customise the test command if needed | `go test -v` |
| `IMAGE_TAG` | The default tag for the docker image | `1.18`  |
| `IMAGE_TAG` | The default tag for the docker image | `1.19.3`  |



+5 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ go_unit_test:
  variables:
    UT_WORK_DIR: $CI_PROJECT_DIR
    UT_TEST_CMD: "go test -v"
    IMAGE_TAG: "1.18"
    IMAGE_TAG: "1.19.3"
  script:
    # Switch to working directory
    - cd "$UT_WORK_DIR"
@@ -15,7 +15,9 @@ go_unit_test:
    - go get -u github.com/jstemmer/go-junit-report@v1.0.0 github.com/t-yuki/gocover-cobertura@v0.0.0-20180217150009-aaee18c8195c
    - go install github.com/jstemmer/go-junit-report github.com/t-yuki/gocover-cobertura
    # Execute Unit tests to get both the junit report and the coverage file
    - ${UT_TEST_CMD} -coverprofile=coverage.out ./... 2>&1 | go-junit-report -set-exit-code > report.xml
    - ${UT_TEST_CMD} -coverprofile=coverage.out ./... 2>&1 | tee test_report
    # Convert output to junit
    - cat test_report | go-junit-report -set-exit-code > report.xml
    # Output the coverage to stdout for coverage regex to read
    - go tool cover -func=coverage.out
    # Capture coverage in cobertura format for MR highlighting