forked from localstack/localstack
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (119 loc) 路 3.79 KB
/
Copy pathterraform-tests.yml
File metadata and controls
138 lines (119 loc) 路 3.79 KB
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
on:
workflow_dispatch:
inputs:
terraform-ref:
default: master
required: false
type: string
description: git ref of the hashicorp/terraform-provider-aws to check out
localstack-ref:
required: false
type: string
description: git ref of the localstack/localstack to check out
push:
branches:
- master
pull_request:
branches:
- master
name: Terraform Tests
jobs:
prepare_list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: echo "::set-output name=matrix::$(python tests/terraform/get-tf-partitions.py)"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
test_service:
needs: prepare_list
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.prepare_list.outputs.matrix) }}
runs-on: ubuntu-latest
env:
DNS_ADDRESS: 0
AWS_DEFAULT_REGION: us-east-2
AWS_ALTERNATE_REGION: eu-west-1
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18.x
- name: Checkout Localstack
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.localstack-ref || github.ref }}
# FIXME: pinned because of https://github.com/hashicorp/terraform-provider-aws/issues/27049
- name: Install terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.2.9
terraform_wrapper: false
- name: Check Terraform version
run: |
which terraform
terraform --version
- name: Checkout Terraform AWS Provider
uses: actions/checkout@v3
with:
repository: hashicorp/terraform-provider-aws
ref: ${{ github.event.inputs.terraform-ref || 'v4.31.0' }}
path: './terraform-provider-aws'
- name: Set up Python 3.10.5
uses: actions/setup-python@v2
with:
python-version: '3.10.5'
- name: Cache Python .venv
id: python-cache
uses: actions/cache@v2
with:
path: ./.venv/
key: ${{ runner.os }}-venv-${{ hashFiles('**/setup.cfg') }}
- name: Install system dependencies
run: |
sudo apt update
sudo apt install libsasl2-dev -y
pip install --upgrade pip
pip install pyyaml
- name: Get list of tests for this service
id: get-list
run: echo "::set-output name=testlist::$(python tests/terraform/get-tf-tests.py ${{ matrix.service }} ${{ matrix.partition }})"
- name: Check Test Lists
if: ${{ steps.get-list.outputs.testlist == '' }}
run: exit 1
- name: Installing dependencies and start LocalStack
run: |
make install
make start &
- name: Patch Terraform Provider
run: |
cd terraform-provider-aws
git apply ../etc/tf-patch/0001-endpoints.patch
- name: Cache Go dependencies
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/terraform-provider-aws/go.sum') }}
- name: Run Test Cases
id: run-tests
env:
CI: true
run: |
bash tests/terraform/run.sh ${{ matrix.service }} ${{ steps.get-list.outputs.testlist }}
# only archive when the run step produced errors
- name: Remove files that don't contain ERROR entries before uploading logs
if: ${{ failure() && steps.run-tests.conclusion == 'failure' }}
run: |
cd terraform-provider-aws/terraformlogs
grep -r -L "\[ERROR" | xargs -I _ rm _
- name: Archive debug logs
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.run-tests.conclusion == 'failure' }}
with:
name: terraformlogs-${{ matrix.service }}
path: |
terraform-provider-aws/terraformlogs