Admin - Parallelize TF test runs in CI (#4177)
This commit is contained in:
		
							parent
							
								
									7397b8c129
								
							
						
					
					
						commit
						c5b63693b5
					
				
							
								
								
									
										11
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							@ -203,8 +203,10 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    needs: terraformcache
 | 
					    needs: terraformcache
 | 
				
			||||||
    strategy:
 | 
					    strategy:
 | 
				
			||||||
 | 
					      fail-fast: false
 | 
				
			||||||
      matrix:
 | 
					      matrix:
 | 
				
			||||||
        python-version: [ 3.8 ]
 | 
					        python-version: [ 3.8 ]
 | 
				
			||||||
 | 
					        part: ["aa", "ab", "ac"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
    - uses: actions/checkout@v2
 | 
					    - uses: actions/checkout@v2
 | 
				
			||||||
@ -231,10 +233,17 @@ jobs:
 | 
				
			|||||||
        python setup.py sdist
 | 
					        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/travis_moto_server.sh &
 | 
					        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/travis_moto_server.sh &
 | 
				
			||||||
        MOTO_PORT=4566 python wait_for.py
 | 
					        MOTO_PORT=4566 python wait_for.py
 | 
				
			||||||
 | 
					    # Poor man's parallelization
 | 
				
			||||||
 | 
					    # Running them sequentially takes to much time
 | 
				
			||||||
 | 
					    # And using the build in parallel-argument does not help with reducing runtime
 | 
				
			||||||
 | 
					    # So we simply split the list of tests, and ask our CI for separate VM's to run them in parallel
 | 
				
			||||||
 | 
					    - name: Get list of tests
 | 
				
			||||||
 | 
					      run: |
 | 
				
			||||||
 | 
					        split -n l/3 tests/terraform-tests.success.txt tf-split-
 | 
				
			||||||
    - name: Run Terraform Tests
 | 
					    - name: Run Terraform Tests
 | 
				
			||||||
      run: |
 | 
					      run: |
 | 
				
			||||||
        cd moto-terraform-tests
 | 
					        cd moto-terraform-tests
 | 
				
			||||||
        AWS_DEFAULT_REGION=us-east-1 AWS_ALTERNATE_REGION=eu-west-1 bin/run-tests -t -i ../tests/terraform-tests.success.txt -e ../tests/terraform-tests.failures.txt
 | 
					        AWS_DEFAULT_REGION=us-east-1 AWS_ALTERNATE_REGION=eu-west-1 bin/run-tests -t -i ../tf-split-${{ matrix.part }} -e ../tests/terraform-tests.failures.txt
 | 
				
			||||||
        cd ..
 | 
					        cd ..
 | 
				
			||||||
    - name: "Create report"
 | 
					    - name: "Create report"
 | 
				
			||||||
      run: |
 | 
					      run: |
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user