Terraform CI integration (#4081)
* CI - Add Terraform tests * Relative paths * Install TF cache only once
This commit is contained in:
parent
d01bd59ea9
commit
e0d3b9145f
77
.github/workflows/build.yml
vendored
77
.github/workflows/build.yml
vendored
@ -4,6 +4,37 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
# Install and cache dependencies
|
||||
terraformcache:
|
||||
name: Caching Terraform dependencies
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ 3.8 ]
|
||||
|
||||
steps:
|
||||
- name: Checkout Terraform Tests repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: bblommers/moto-terraform-tests
|
||||
path: moto-terraform-tests
|
||||
submodules: 'true'
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '^1.16.0'
|
||||
- run: go version
|
||||
- name: cache
|
||||
id: terraformcache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: '~/.cache'
|
||||
key: 'terraformcache'
|
||||
- name: Download
|
||||
if: ${{ steps.terraformcache.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
cd moto-terraform-tests
|
||||
bin/install-aws-test
|
||||
cd ..
|
||||
|
||||
cache:
|
||||
name: Caching
|
||||
runs-on: ubuntu-latest
|
||||
@ -165,10 +196,54 @@ jobs:
|
||||
fail_ci_if_error: false
|
||||
flags: servertests
|
||||
|
||||
terraform:
|
||||
name: Terraform Tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: terraformcache
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ 3.8 ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Checkout Terraform Tests repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: bblommers/moto-terraform-tests
|
||||
path: moto-terraform-tests
|
||||
submodules: 'true'
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: '~/.cache'
|
||||
key: 'terraformcache'
|
||||
- name: Start MotoServer
|
||||
run: |
|
||||
python setup.py sdist
|
||||
docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -e AWS_SECRET_ACCESS_KEY=server_secret -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 5000:5000 -v /var/run/docker.sock:/var/run/docker.sock python:3.7-buster /moto/travis_moto_server.sh &
|
||||
python wait_for.py
|
||||
- name: Run Terraform Tests
|
||||
run: |
|
||||
cd moto-terraform-tests
|
||||
bin/run-tests -i ../tests/terraform-tests.success.txt
|
||||
cd ..
|
||||
- name: "Create report"
|
||||
run: |
|
||||
cd moto-terraform-tests
|
||||
bin/create-report
|
||||
bin/create-report-cli
|
||||
cd ..
|
||||
|
||||
deploy:
|
||||
name: Deploy
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test, testserver]
|
||||
needs: [test, testserver, terraform]
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'spulec/moto' }}
|
||||
strategy:
|
||||
matrix:
|
||||
|
32
tests/terraform-tests.success.txt
Normal file
32
tests/terraform-tests.success.txt
Normal file
@ -0,0 +1,32 @@
|
||||
TestAccAWSAccessKey
|
||||
TestAccAWSAvailabilityZones
|
||||
TestAccAWSBillingServiceAccount
|
||||
TestAccAWSCallerIdentity
|
||||
TestAccAWSCloudTrailServiceAccount
|
||||
TestAccAWSCloudWatchDashboard
|
||||
TestAccAWSDataSourceElasticBeanstalkHostedZone
|
||||
TestAccAWSDataSourceIAMGroup
|
||||
TestAccAWSDataSourceIAMInstanceProfile
|
||||
TestAccAWSDataSourceIAMPolicy
|
||||
TestAccAWSDataSourceIAMRole
|
||||
TestAccAWSDataSourceIAMSessionContext
|
||||
TestAccAWSDataSourceIAMUser
|
||||
TestAccAWSDefaultSubnet
|
||||
TestAccAWSDefaultTagsDataSource
|
||||
TestAccAWSDynamoDbTableItem
|
||||
TestAccAWSEc2InstanceTypeOfferingDataSource
|
||||
TestAccAWSEc2InstanceTypeOfferingsDataSource
|
||||
TestAccAWSElasticBeanstalkSolutionStackDataSource
|
||||
TestAccAWSElbHostedZoneId
|
||||
TestAccAWSElbServiceAccount
|
||||
TestAccAWSIAMAccountAlias
|
||||
TestAccAWSIAMGroupPolicyAttachment
|
||||
TestAccAWSIPRanges
|
||||
TestAccAWSKmsSecretDataSource
|
||||
TestAccAWSPartition
|
||||
TestAccAWSProvider
|
||||
TestAccAWSRedshiftServiceAccount
|
||||
TestAccAWSSNSSMSPreferences
|
||||
TestAccAWSSageMakerPrebuiltECRImage
|
||||
TestAccAWSSsmParameterDataSource
|
||||
TestAccAWSUserPolicyAttachment
|
Loading…
Reference in New Issue
Block a user