-
Notifications
You must be signed in to change notification settings - Fork 37
135 lines (126 loc) · 4.53 KB
/
acceptance.yml
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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Acceptance Test
on:
pull_request:
paths:
- .github/workflows/acceptance.yml
- '**.go'
push:
paths:
- .github/workflows/acceptance.yml
- '**.go'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-acceptance
cancel-in-progress: true
permissions:
contents: read
env:
CLOUDSTACK_API_URL: http://localhost:8080/client/api
CLOUDSTACK_VERSIONS: "['4.18.2.0', '4.19.0.1']"
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
cloudstack-versions: ${{ steps.set-versions.outputs.cloudstack-versions }}
steps:
- name: Set versions
id: set-versions
run: |
echo "cloudstack-versions=${{ env.CLOUDSTACK_VERSIONS }}" >> $GITHUB_OUTPUT
acceptance-terraform:
name: Terraform ${{ matrix.terraform-version }} with Cloudstack ${{ matrix.cloudstack-version }}
needs: [prepare-matrix]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Configure Cloudstack v${{ matrix.cloudstack-version }}
uses: ./.github/workflows/setup-cloudstack
id: setup-cloudstack
with:
cloudstack-version: ${{ matrix.cloudstack-version }}
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform-version }}
terraform_wrapper: false
- name: Run acceptance test
env:
CLOUDSTACK_USER_ID: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_USER_ID }}
CLOUDSTACK_API_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_API_KEY }}
CLOUDSTACK_SECRET_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_SECRET_KEY }}
run: |
make testacc
services:
cloudstack-simulator:
image: apache/cloudstack-simulator:${{ matrix.cloudstack-version }}
ports:
- 8080:5050
strategy:
fail-fast: false
matrix:
terraform-version:
- '1.7.*'
- '1.8.*'
cloudstack-version: ${{ fromJson(needs.prepare-matrix.outputs.cloudstack-versions) }}
acceptance-opentofu:
name: OpenTofu ${{ matrix.opentofu-version }} with Cloudstack ${{ matrix.cloudstack-version }}
needs: [prepare-matrix]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Configure Cloudstack v${{ matrix.cloudstack-version }}
uses: ./.github/workflows/setup-cloudstack
id: setup-cloudstack
with:
cloudstack-version: ${{ matrix.cloudstack-version }}
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: ${{ matrix.opentofu-version }}
- name: Run acceptance test
env:
CLOUDSTACK_USER_ID: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_USER_ID }}
CLOUDSTACK_API_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_API_KEY }}
CLOUDSTACK_SECRET_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_SECRET_KEY }}
run: |
make testacc
services:
cloudstack-simulator:
image: apache/cloudstack-simulator:${{ matrix.cloudstack-version }}
ports:
- 8080:5050
strategy:
fail-fast: false
matrix:
opentofu-version:
- '1.6.*'
cloudstack-version: ${{ fromJson(needs.prepare-matrix.outputs.cloudstack-versions) }}
all-jobs-passed: # Will succeed if it is skipped
runs-on: ubuntu-latest
needs: [acceptance-terraform, acceptance-opentofu]
# Only run if any of the previous jobs failed
if: ${{ failure() }}
steps:
- name: Previous jobs failed
run: exit 1