File: config.yml

package info (click to toggle)
golang-github-hashicorp-go-discover 0.0%2Bgit20190905.34a6505-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 476 kB
  • sloc: makefile: 9
file content (200 lines) | stat: -rw-r--r-- 5,285 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
version: 2.1

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

# reusable 'commands' to be added as a step in jobs
commands:
  tf-install:
    description: Install Terraform binary
    parameters:
      version:
        type: string
        default: 0.11.11
      os:
        type: string
        default: linux
      arch:
        type: string
        default: amd64
    steps:
      - run:
          name: download Terraform
          command: |
            curl -L -o /tmp/terraform.zip \
            https://releases.hashicorp.com/terraform/<< parameters.version >>/terraform_<< parameters.version >>_<< parameters.os >>_<< parameters.arch >>.zip
      - run: unzip -d /go/bin /tmp/terraform.zip

  acctest:
    description: Run acceptance tests for cloud providers
    parameters:
      provider-test-infra-dir:
        type: string
      provider-go-test-dir:
        type: string
      provider-go-test-tags:
        type: string
        default: ""
    steps:
      - tf-install
      - checkout

      - run:
          name: install junit and setup test path
          command: |
            go get github.com/jstemmer/go-junit-report
            mkdir -p /tmp/test-results

      # spin up infrastructure
      - run:
          working_directory: ./test/tf/<< parameters.provider-test-infra-dir >>
          command: terraform init
      - run:
          working_directory: ./test/tf/<< parameters.provider-test-infra-dir >>
          command: terraform apply --auto-approve

      # run acceptance tests
      - when:
          condition: << parameters.provider-go-test-tags >>
          steps:
            - run: go test -run << parameters.provider-go-test-tags >> -v ./provider/<< parameters.provider-go-test-dir >> | tee ${TEST_RESULTS}/results.out
      - unless:
          condition: << parameters.provider-go-test-tags >>
          steps:
            - run: go test -v ./provider/<< parameters.provider-go-test-dir >> | tee ${TEST_RESULTS}/results.out

      # generate XML results
      - run:
          command: go-junit-report < ${TEST_RESULTS}/results.out > ${TEST_RESULTS}/results.xml
          when: always

      # store test results for CircleCI
      - store_test_results:
          path: /tmp/test-results

      # teardown infrastructure
      - run:
          working_directory: ./test/tf/<< parameters.provider-test-infra-dir >>
          command: terraform destroy --force
          when: always

jobs:
  go-test:
    executor: go
    steps:
      - checkout
      - restore_cache:
          keys:
            - go-mod-test-v1-{{ checksum "go.sum" }}
      - run: go test -v
      - save_cache:
          key: go-mod-test-v1-{{ checksum "go.sum" }}
          paths:
            - /go/pkg/mod
  alicloud-provider:
    executor: go
    steps:
      - acctest:
          provider-test-infra-dir: aliyun
          provider-go-test-dir: aliyun
  aws-provider:
    executor: go
    steps:
      - acctest:
          provider-test-infra-dir: aws
          provider-go-test-dir: aws
  azure-vmss-provider:
    executor: go
    steps:
      - acctest:
          provider-test-infra-dir: azure-vmss
          provider-go-test-dir: azure
          provider-go-test-tags: TestVmScaleSetAddrs
  azurerm-provider:
    executor: go
    steps:
      - acctest:
          provider-test-infra-dir: azurerm
          provider-go-test-dir: azure
          provider-go-test-tags: TestTagAddrs
  digitalocean-provider:
    executor: go
    steps:
      - acctest:
          provider-test-infra-dir: digitalocean
          provider-go-test-dir: digitalocean
  gce-provider:
    executor: go
    steps:
      - acctest:
          provider-test-infra-dir: gce
          provider-go-test-dir: gce
  k8s-provider:
    executor: go
    steps:
      - acctest:
          provider-test-infra-dir: k8s
          provider-go-test-dir: k8s
  packet-provider:
    executor: go
    steps:
      - acctest:
          provider-test-infra-dir: packet
          provider-go-test-dir: packet

  scaleway-provider:
    executor: go
    steps:
      - acctest:
          provider-test-infra-dir: scaleway
          provider-go-test-dir: scaleway
  triton-provider:
    executor: go
    steps:
      - add_ssh_keys:
          fingerprints:
            - "3e:c7:ee:67:a5:e7:bc:eb:be:b8:9a:0e:ee:fb:e2:33"
      - acctest:
          provider-test-infra-dir: triton
          provider-go-test-dir: triton

workflows:
  version: 2
  acceptance:
    jobs:
      - go-test
      - alicloud-provider:
          requires:
            - go-test
      - aws-provider:
          requires:
            - go-test
      - azure-vmss-provider:
          requires:
            - go-test
      - azurerm-provider:
          requires:
            - go-test
      - digitalocean-provider:
          requires:
            - go-test
      - gce-provider:
          requires:
            - go-test
      - k8s-provider:
          requires:
            - go-test
      - packet-provider:
          requires:
            - go-test
      - scaleway-provider:
          requires:
            - go-test
      - triton-provider:
          requires:
            - go-test