name: reusable-test on: workflow_call: inputs: python-version: type: string required: false default: "3.12" matomo-url: type: string required: false default: "http://127.0.0.1:8080" matomo-admin-user: type: string required: false default: "administrator" matomo-admin-password: type: string required: false default: "AdminSecret123!" matomo-admin-email: type: string required: false default: "administrator@example.org" matomo-token-description: type: string required: false default: "ci-token" jobs: lint: runs-on: ubuntu-latest timeout-minutes: 10 steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} cache: "pip" - name: Install lint deps run: | python -m pip install --upgrade pip pip install ruff - name: Ruff run: | ruff check . ruff format --check . integration: runs-on: ubuntu-latest needs: lint steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} - name: Integration tests run: make test-integration e2e: runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} cache: "pip" - name: Install system deps (curl) run: | sudo apt-get update sudo apt-get install -y curl - name: Install Python deps (editable + e2e) run: | python -m pip install --upgrade pip pip install -e ".[e2e]" - name: Install Playwright Chromium run: | python -m playwright install --with-deps --force chromium - name: Run E2E (docker compose) env: MATOMO_URL: ${{ inputs.matomo-url }} MATOMO_ADMIN_USER: ${{ inputs.matomo-admin-user }} MATOMO_ADMIN_PASSWORD: ${{ inputs.matomo-admin-password }} MATOMO_ADMIN_EMAIL: ${{ inputs.matomo-admin-email }} MATOMO_TOKEN_DESCRIPTION: ${{ inputs.matomo-token-description }} run: | make e2e - name: Docker logs (on failure) if: failure() run: | docker compose -f tests/e2e/docker-compose.yml ps || true docker compose -f tests/e2e/docker-compose.yml logs --no-color --tail=300 matomo || true docker compose -f tests/e2e/docker-compose.yml logs --no-color --tail=300 db || true - name: Cleanup (always) if: always() run: | docker compose -f tests/e2e/docker-compose.yml down -v || true