|
| 1 | +on: push |
| 2 | + |
| 3 | +name: Plugin Patch Test |
| 4 | + |
| 5 | +jobs: |
| 6 | + test_plugin_patch: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + |
| 9 | + steps: |
| 10 | + |
| 11 | + - uses: actions/checkout@v3 |
| 12 | + with: |
| 13 | + submodules: 'true' |
| 14 | + |
| 15 | + - uses: actions/setup-go@v3 |
| 16 | + with: |
| 17 | + go-version: '1.20.x' |
| 18 | + cache: true |
| 19 | + cache-dependency-path: terraform-provider-aws/go.sum |
| 20 | + |
| 21 | + - name: Set up Python 3.10.5 |
| 22 | + uses: actions/setup-python@v4 |
| 23 | + with: |
| 24 | + python-version: '3.10.5' |
| 25 | + cache: 'pip' |
| 26 | + |
| 27 | + - name: Install system dependencies |
| 28 | + run: | |
| 29 | + python -m venv .venv |
| 30 | + source .venv/bin/activate |
| 31 | + pip install --upgrade pip |
| 32 | + pip install -r requirements.txt |
| 33 | +
|
| 34 | + - name: Patch Terraform Provider |
| 35 | + run: | |
| 36 | + source .venv/bin/activate |
| 37 | + cd terraform-provider-aws && go mod vendor |
| 38 | + cd ../ |
| 39 | + python -m terraform_pytest.main patch |
| 40 | +
|
| 41 | + - name: Build EC2 Binary |
| 42 | + run: | |
| 43 | + source .venv/bin/activate |
| 44 | + python -m terraform_pytest.main build -s ec2 |
| 45 | + ls -la ./test-bin |
| 46 | +
|
| 47 | + - name: Setup LocalStack |
| 48 | + env: |
| 49 | + LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} |
| 50 | + TMP_USER: ${{ secrets.TMP_USER }} |
| 51 | + TMP_PW: ${{ secrets.TMP_PW }} |
| 52 | + run: | |
| 53 | + source .venv/bin/activate |
| 54 | + pip install --pre localstack |
| 55 | + enable_pro=${{ inputs.enable-pro || 'true' }} |
| 56 | + if [[ $enable_pro != 'true' ]] |
| 57 | + then |
| 58 | + docker pull localstack/localstack |
| 59 | + else |
| 60 | + docker pull localstack/localstack-pro |
| 61 | + localstack auth login -u $TMP_USER -p $TMP_PW # login is currently required |
| 62 | + localstack extensions init |
| 63 | + localstack extensions install "git+https://github.com/localstack/localstack-moto-test-coverage/#egg=collect-raw-metric-data-extension&subdirectory=collect-raw-metric-data-extension" |
| 64 | + fi |
| 65 | +
|
| 66 | + - name: Run EC2 - Create Instance Tests |
| 67 | + env: |
| 68 | + SERVICE: ec2 |
| 69 | + PARTITION: null |
| 70 | + TINYBIRD_URL: https://api.tinybird.co |
| 71 | + TINYBIRD_DATASOURCE: localstack_terraform_test_results |
| 72 | + TINYBIRD_TOKEN: ${{ secrets.TINYBIRD_TOKEN }} |
| 73 | + CI_COMMIT_SHA: ${{ github.sha }} |
| 74 | + CI_JOB_ID: ${{ github.job }} |
| 75 | + CI_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 76 | + CI_JOB_NAME: ${{ github.job }}-${{ matrix.service_partition.service }}-${{ matrix.service_partition.partition }} |
| 77 | + run: | |
| 78 | + source .venv/bin/activate |
| 79 | + enable_pro=${{ inputs.enable-pro || 'true' }} |
| 80 | + enable_tinybird='false' |
| 81 | + if [[ $enable_pro == 'true' ]] |
| 82 | + then |
| 83 | + export LOCALSTACK_API_KEY=${{ secrets.LOCALSTACK_API_KEY }} |
| 84 | + fi |
| 85 | + |
| 86 | + python -m pytest --junitxml=target/reports/pytest.xml terraform-provider-aws/internal/service/ec2/ec2_instance_test.go::TestAccEC2Instance_basic |
| 87 | +
|
| 88 | + - name: Archive Test Result |
| 89 | + uses: actions/upload-artifact@v3 |
| 90 | + if: always() |
| 91 | + with: |
| 92 | + name: test-metrics |
| 93 | + path: target/reports |
| 94 | + |
| 95 | + - name: Publish ${{ matrix.service }} Test Results |
| 96 | + uses: EnricoMi/publish-unit-test-result-action@v2 |
| 97 | + if: always() |
| 98 | + with: |
| 99 | + junit_files: target/reports/*.xml |
| 100 | + check_name: ${{ matrix.service }} Terraform Test Results |
0 commit comments