File: config.yml

package info (click to toggle)
golang-github-hashicorp-go-immutable-radix 1.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 224 kB
  • sloc: makefile: 2
file content (72 lines) | stat: -rw-r--r-- 1,846 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
version: 2.1

references:
  images:
    go: &GOLANG_IMAGE docker.mirror.hashicorp.services/circleci/golang:1.15.3

# reusable 'executor' object for jobs
executors:
  go:
    docker:
      - image: *GOLANG_IMAGE
    environment:
      - TEST_RESULTS: /tmp/test-results # path to where test results are saved

jobs:
  go-fmt-and-vet:
    executor: go
    steps:
      - checkout

      # Restore go module cache if there is one
      - restore_cache:
          keys:
            - go-immutable-radix-modcache-v1-{{ checksum "go.mod" }}

      - run: go mod download

      # Save go module cache if the go.mod file has changed
      - save_cache:
          key: go-immutable-radix-modcache-v1-{{ checksum "go.mod" }}
          paths:
            - "/go/pkg/mod"

      # check go fmt output because it does not report non-zero when there are fmt changes
      - run:
          name: check go fmt
          command: |
            files=$(go fmt ./...)
            if [ -n "$files" ]; then
              echo "The following file(s) do not conform to go fmt:"
              echo "$files"
              exit 1
            fi
      - run: go vet ./...

  go-test:
    executor: go
    steps:
      - checkout
      - run: mkdir -p $TEST_RESULTS

      - restore_cache: # restore cache from dev-build job
          keys:
            - go-immutable-radix-modcache-v1-{{ checksum "go.mod" }}

      # run go tests with gotestsum
      - run: |
          PACKAGE_NAMES=$(go list ./...)
          gotestsum --format=short-verbose --junitfile $TEST_RESULTS/gotestsum-report.xml -- $PACKAGE_NAMES
      - store_test_results:
          path: /tmp/test-results
      - store_artifacts:
          path: /tmp/test-results

workflows:
  version: 2
  test-and-build:
    jobs:
      - go-fmt-and-vet
      - go-test:
          requires:
            - go-fmt-and-vet