moto-integration-tests #139
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: moto-integration-tests | |
on: | |
schedule: | |
- cron: '0 6 * * 0' | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
selected-services: | |
type: string | |
required: false | |
default: 'all' | |
description: 'enter a list of services (comma separated), that will be used to filter for tests' | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
checks: write | |
pull-requests: write | |
jobs: | |
run-moto-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Checkout Moto | |
uses: actions/checkout@v3 | |
with: | |
repository: getmoto/moto | |
path: moto | |
- name: Install dependencies | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install pytest requests pytest-timeout | |
cd moto && make init | |
- name: Copy conftest.py | |
run: | | |
cp conftest.py moto/tests | |
- name: Prepare Extension | |
run: | | |
cd collect-raw-metric-data-extension && make install | |
- name: Setup LocalStack | |
env: | |
LOCALSTACK_API_KEY: ${{ secrets.TEST_LOCALSTACK_API_KEY }} | |
run: | | |
source .venv/bin/activate | |
pip install localstack | |
docker pull localstack/localstack-pro # Make sure to pull the latest version of the image | |
localstack extensions init | |
localstack extensions dev enable ./collect-raw-metric-data-extension | |
DEBUG=1 DISABLE_EVENTS=1 DNS_ADDRESS=127.0.0.1 EXTENSION_DEV_MODE=1 localstack start -d | |
echo "Waiting for LocalStack startup..." | |
localstack wait -t 30 | |
echo "Startup complete" | |
- name: Run Moto Integration Tests against LocalStack | |
env: | |
LOCALSTACK_API_KEY: ${{ secrets.TEST_LOCALSTACK_API_KEY }} | |
run: | | |
source .venv/bin/activate | |
python -m pytest --durations=10 --services=${{ inputs.selected-services || 'all' }} --timeout=300 --capture=no --junitxml=target/reports/pytest.xml moto/tests --tb=line | |
- name: Archive Test Result | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-metrics | |
path: target/reports | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
junit_files: target/reports/*.xml | |
check_name: Moto Integration Tests against LocalStack Results | |
- name: LocalStack Logs | |
if: always() | |
run: | |
source .venv/bin/activate | |
localstack logs | |
- name: Prevent Workflows from getting Stale | |
if: always() | |
uses: gautamkrishnar/keepalive-workflow@v1 | |
with: | |
#this message should prevent automatic triggering of workflows | |
#see https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs | |
commit_message: "[skip ci] Automated commit by Keepalive Workflow to keep the repository active" |