Skip to content

feat: Discogs user integration — authenticate, sync collection & wantlist #151

feat: Discogs user integration — authenticate, sync collection & wantlist

feat: Discogs user integration — authenticate, sync collection & wantlist #151

Workflow file for this run

---
# This workflow runs all E2E tests including desktop browsers and mobile device emulation.
# It can be called from other workflows or triggered directly on service changes.
name: E2E Test
on:
workflow_dispatch:
workflow_call:
push:
branches:
- main
paths:
- "dashboard/**"
- "explore/**"
- "tests/dashboard/**"
- "tests/explore/**"
- ".github/workflows/e2e-test.yml"
- "common/**"
- "pyproject.toml"
- "uv.lock"
pull_request:
branches:
- main
paths:
- "dashboard/**"
- "explore/**"
- "tests/dashboard/**"
- "tests/explore/**"
- ".github/workflows/e2e-test.yml"
- "common/**"
- "pyproject.toml"
- "uv.lock"
concurrency:
group: e2e-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CI: true
PLAYWRIGHT_BROWSERS_PATH: "0" # Use default location
PYTHON_VERSION: "3.13"
permissions:
contents: read
pull-requests: write # Required for coverage report comments
statuses: write # Required for coverage status creation
jobs:
e2e-test:
name: Test ${{ matrix.browser }} ${{ matrix.device && format('- {0}', matrix.device) || '' }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
max-parallel: 3 # Limit concurrent browser tests to prevent resource exhaustion
matrix:
include:
# Desktop browsers
- os: ubuntu-latest
browser: chromium
browser-install: chromium
flag: e2e-chromium
- os: ubuntu-latest
browser: firefox
browser-install: firefox
flag: e2e-firefox
- os: macos-latest
browser: webkit
browser-install: webkit
flag: e2e-webkit
# Mobile Safari on iPhone
- os: macos-latest
browser: webkit
browser-install: webkit
device: "iPhone 15"
flag: e2e-iphone-15
# Mobile Safari on iPad
- os: macos-latest
browser: webkit
browser-install: webkit
device: "iPad Pro 11"
flag: e2e-ipad-pro-11
steps:
- name: 🔀 Checkout repository
uses: actions/checkout@v6
- name: 🔧 Setup Python and UV
uses: ./.github/actions/setup-python-uv
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 🔧 Setup Just
uses: ./.github/actions/setup-just
# Test cache (pytest + playwright results + coverage)
- name: 🧪 Cache test results
uses: actions/cache@v5
with:
path: |
.pytest_cache
test-results
.coverage
htmlcov
key: ${{ runner.os }}-test-e2e-${{ matrix.browser }}-${{ matrix.device || 'desktop' }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-test-e2e-${{ matrix.browser }}-${{ matrix.device || 'desktop' }}-
${{ runner.os }}-test-e2e-${{ matrix.browser }}-
${{ runner.os }}-test-e2e-
${{ runner.os }}-test-
# Browser cache (Playwright)
- name: 🌐 Cache Playwright browsers
uses: actions/cache@v5
with:
path: |
~/.cache/ms-playwright
~/Library/Caches/ms-playwright
key: ${{ runner.os }}-playwright-browsers-${{ matrix.browser }}-v${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-playwright-browsers-${{ matrix.browser }}-
${{ runner.os }}-playwright-browsers-
- name: 📦 Install dependencies
run: |
uv sync --all-extras --frozen
# Install workspace packages
uv pip install -e dashboard
uv pip install -e explore
uv pip install -e common
- name: 🎭 Install Playwright browsers
run: |
# Set Playwright to run in CI mode
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
uv run playwright install ${{ matrix.browser-install }}
# Install system dependencies
uv run playwright install-deps ${{ matrix.browser-install }}
- name: 🧪 Run dashboard unit tests (coverage baseline)
run: just test-e2e-unit-dashboard
- name: 🧪 Run explore unit tests (coverage baseline)
run: just test-e2e-unit-explore
- name: 🧪 Run dashboard E2E tests (Desktop)
if: matrix.device == null
run: just test-e2e-dashboard ${{ matrix.browser }}
- name: 📱 Run dashboard E2E tests (Mobile)
if: matrix.device != null
run: just test-e2e-dashboard-mobile ${{ matrix.browser }} "${{ matrix.device }}"
- name: 🔍 Run explore E2E tests (Desktop)
if: matrix.device == null
run: just test-e2e-explore ${{ matrix.browser }}
- name: 📱 Run explore E2E tests (Mobile)
if: matrix.device != null
run: just test-e2e-explore-mobile ${{ matrix.browser }} "${{ matrix.device }}"
- name: 📋 Process E2E coverage reports
id: coverage-setup
if: always() # Process coverage even if tests fail
run: |
if [ -f coverage.json ]; then
# Transform coverage.json (generated by pytest) to coverage-summary.json format
jq '{
total: {
statements: {total: .totals.num_statements, covered: .totals.covered_lines},
lines: {total: .totals.num_statements, covered: .totals.covered_lines},
functions: {total: 0, covered: 0},
branches: {total: 0, covered: 0}
}
}' coverage.json > coverage-summary.json
echo "coverage-exists=true" >> "$GITHUB_OUTPUT"
else
echo "⚠️ No coverage.json found — tests may not have run"
echo "coverage-exists=false" >> "$GITHUB_OUTPUT"
fi
- name: 📤 Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: playwright-results-${{ matrix.os }}-${{ matrix.browser }}-${{ matrix.device || 'desktop' }}
path: test-results/
compression-level: 9
retention-days: 3
if-no-files-found: ignore
- name: 🎥 Upload test videos
if: failure()
uses: actions/upload-artifact@v6
with:
name: playwright-videos-${{ matrix.os }}-${{ matrix.browser }}-${{ matrix.device || 'desktop' }}
path: test-results/**/*.webm
compression-level: 9
retention-days: 3
if-no-files-found: ignore
- name: 📊 Upload E2E coverage to Codecov
if: always() # Upload coverage even if tests fail
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: SimplicityGuy/discogsography
files: ./coverage.xml
flags: ${{ matrix.flag }}
name: e2e-${{ matrix.browser }}-${{ matrix.device || 'desktop' }}
fail_ci_if_error: false
disable_search: true
verbose: false
env:
CODECOV_GCOV_DISABLE: 1
CODECOV_XCODE_DISABLE: 1
- name: 📊 E2E Coverage Report
if: github.event_name == 'pull_request' && steps.coverage-setup.outputs.coverage-exists == 'true'
uses: slavcodev/coverage-monitor-action@398c4cbbb710e549a8407fdef96ae8b9454d0463 # v1.10.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
coverage_path: "coverage-summary.json"
coverage_format: "json-summary"
status_context: "E2E Coverage (${{ matrix.browser }}${{ matrix.device && format(' - {0}', matrix.device) || '' }})"
comment_context: "E2E Coverage (${{ matrix.browser }}${{ matrix.device && format(' - {0}', matrix.device) || '' }})"