ci: deduplicate workflows using reusable test pipeline and stable tagging
- Introduce reusable-test workflow for Ruff + E2E tests - Refactor CI to call reusable workflow (no duplicated steps) - Add stable-tag workflow to promote version tags to stable after successful tests https://chatgpt.com/share/694a7f81-d96c-800f-88cb-7b25b4cdfe1a
This commit is contained in:
86
.github/workflows/reusable-test.yml
vendored
Normal file
86
.github/workflows/reusable-test.yml
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
name: Reusable Test (ruff + e2e)
|
||||
|
||||
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:
|
||||
test:
|
||||
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
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[e2e]"
|
||||
pip install ruff
|
||||
|
||||
- name: Ruff
|
||||
run: |
|
||||
ruff check .
|
||||
ruff format --check .
|
||||
|
||||
- name: Install Playwright Chromium
|
||||
run: |
|
||||
python -m playwright install --with-deps chromium
|
||||
|
||||
- name: E2E (docker compose + installer + tests)
|
||||
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
|
||||
Reference in New Issue
Block a user