|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: Acceptance Test |
| 19 | + |
| 20 | +on: |
| 21 | + pull_request: |
| 22 | + paths: |
| 23 | + - .github/workflows/acceptance.yml |
| 24 | + - '**.go' |
| 25 | + push: |
| 26 | + paths: |
| 27 | + - .github/workflows/acceptance.yml |
| 28 | + - '**.go' |
| 29 | + |
| 30 | +concurrency: |
| 31 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-acceptance |
| 32 | + cancel-in-progress: true |
| 33 | + |
| 34 | +permissions: |
| 35 | + contents: read |
| 36 | + |
| 37 | +env: |
| 38 | + CLOUDSTACK_API_URL: http://localhost:8080/client/api |
| 39 | + CLOUDSTACK_VERSIONS: "['4.18.2.0', '4.19.0.1']" |
| 40 | + |
| 41 | +jobs: |
| 42 | + prepare-matrix: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + outputs: |
| 45 | + cloudstack-versions: ${{ steps.set-versions.outputs.cloudstack-versions }} |
| 46 | + steps: |
| 47 | + - name: Set versions |
| 48 | + id: set-versions |
| 49 | + run: | |
| 50 | + echo "cloudstack-versions=${{ env.CLOUDSTACK_VERSIONS }}" >> $GITHUB_OUTPUT |
| 51 | +
|
| 52 | + acceptance-terraform: |
| 53 | + name: Terraform ${{ matrix.terraform-version }} with Cloudstack ${{ matrix.cloudstack-version }} |
| 54 | + needs: [prepare-matrix] |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v4 |
| 58 | + - name: Set up Go |
| 59 | + uses: actions/setup-go@v5 |
| 60 | + with: |
| 61 | + go-version-file: 'go.mod' |
| 62 | + - name: Configure Cloudstack v${{ matrix.cloudstack-version }} |
| 63 | + uses: ./.github/workflows/setup-cloudstack |
| 64 | + id: setup-cloudstack |
| 65 | + with: |
| 66 | + cloudstack-version: ${{ matrix.cloudstack-version }} |
| 67 | + - uses: hashicorp/setup-terraform@v3 |
| 68 | + with: |
| 69 | + terraform_version: ${{ matrix.terraform-version }} |
| 70 | + terraform_wrapper: false |
| 71 | + - name: Run acceptance test |
| 72 | + env: |
| 73 | + CLOUDSTACK_USER_ID: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_USER_ID }} |
| 74 | + CLOUDSTACK_API_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_API_KEY }} |
| 75 | + CLOUDSTACK_SECRET_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_SECRET_KEY }} |
| 76 | + run: | |
| 77 | + make testacc |
| 78 | + services: |
| 79 | + cloudstack-simulator: |
| 80 | + image: apache/cloudstack-simulator:${{ matrix.cloudstack-version }} |
| 81 | + ports: |
| 82 | + - 8080:5050 |
| 83 | + strategy: |
| 84 | + fail-fast: false |
| 85 | + matrix: |
| 86 | + terraform-version: |
| 87 | + - '1.7.*' |
| 88 | + - '1.8.*' |
| 89 | + cloudstack-version: ${{ fromJson(needs.prepare-matrix.outputs.cloudstack-versions) }} |
| 90 | + |
| 91 | + acceptance-opentofu: |
| 92 | + name: OpenTofu ${{ matrix.opentofu-version }} with Cloudstack ${{ matrix.cloudstack-version }} |
| 93 | + needs: [prepare-matrix] |
| 94 | + runs-on: ubuntu-latest |
| 95 | + steps: |
| 96 | + - uses: actions/checkout@v4 |
| 97 | + - name: Set up Go |
| 98 | + uses: actions/setup-go@v5 |
| 99 | + with: |
| 100 | + go-version-file: 'go.mod' |
| 101 | + - name: Configure Cloudstack v${{ matrix.cloudstack-version }} |
| 102 | + uses: ./.github/workflows/setup-cloudstack |
| 103 | + id: setup-cloudstack |
| 104 | + with: |
| 105 | + cloudstack-version: ${{ matrix.cloudstack-version }} |
| 106 | + - uses: opentofu/setup-opentofu@v1 |
| 107 | + with: |
| 108 | + tofu_version: ${{ matrix.opentofu-version }} |
| 109 | + - name: Run acceptance test |
| 110 | + env: |
| 111 | + CLOUDSTACK_USER_ID: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_USER_ID }} |
| 112 | + CLOUDSTACK_API_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_API_KEY }} |
| 113 | + CLOUDSTACK_SECRET_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_SECRET_KEY }} |
| 114 | + run: | |
| 115 | + make testacc |
| 116 | + services: |
| 117 | + cloudstack-simulator: |
| 118 | + image: apache/cloudstack-simulator:${{ matrix.cloudstack-version }} |
| 119 | + ports: |
| 120 | + - 8080:5050 |
| 121 | + strategy: |
| 122 | + fail-fast: false |
| 123 | + matrix: |
| 124 | + opentofu-version: |
| 125 | + - '1.6.*' |
| 126 | + cloudstack-version: ${{ fromJson(needs.prepare-matrix.outputs.cloudstack-versions) }} |
| 127 | + |
| 128 | + all-jobs-passed: # Will succeed if it is skipped |
| 129 | + runs-on: ubuntu-latest |
| 130 | + needs: [acceptance-terraform, acceptance-opentofu] |
| 131 | + # Only run if any of the previous jobs failed |
| 132 | + if: ${{ failure() }} |
| 133 | + steps: |
| 134 | + - name: Previous jobs failed |
| 135 | + run: exit 1 |
0 commit comments