forked from getmoto/moto
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (55 loc) · 2.27 KB
/
test_terraform.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
on: [push, pull_request]
name: TestTerraform
jobs:
prepare_list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: echo "::set-output name=matrix::$(python tests/terraformtests/get_tf_services.py --names)"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
test_service:
needs: prepare_list
strategy:
fail-fast: false
matrix:
service: ${{ fromJson(needs.prepare_list.outputs.matrix) }}
go-version: [1.18.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Start MotoServer
run: |
pip install PyYAML
python setup.py sdist
docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -e MOTO_PORT=4566 -e AWS_SECRET_ACCESS_KEY=server_secret -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 4566:4566 -v /var/run/docker.sock:/var/run/docker.sock python:3.7-buster /moto/scripts/ci_moto_server.sh &
MOTO_PORT=4566 python scripts/ci_wait_for_server.py
- name: Download Cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ matrix.service }}-${{ hashFiles('**/tests/terraformtests/terraform-provider-aws/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-${{ matrix.service }}-
- name: Get list of tests for this service
id: get-list
run: echo "::set-output name=testlist::$(python tests/terraformtests/get_tf_tests.py '${{ matrix.service }}')"
- name: Get original AWS service name
id: get-service-name
run: echo "::set-output name=servicename::$(python -c "print('${{ matrix.service }}'[:'${{ matrix.service }}'.index('|') if '|' in '${{ matrix.service }}' else len('${{ matrix.service }}')])")"
- name: Execute tests
run: |
make terraformtests SERVICE_NAME=${{ steps.get-service-name.outputs.servicename }} TEST_NAMES=${{ steps.get-list.outputs.testlist }}