Skip to content

Refactor Tests #1191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Ignore cache directories
**/.ruff_cache/
**/__pycache__/
**/.pytest_cache/
*.pyc
*.pyo

# Ignore version control
.git/
.gitignore

# Ignore swap files
*.swp
*.swo
*~

# Ignore IDE files
.vscode/
.idea/
*.sublime-*

# Ignore build artifacts
.tox/
build/
dist/
*.egg-info/

# Ignore temporary files
*.tmp
*.temp
/tmp/

# Ignore logs
*.log
logs/

# Ignore test outputs
test-results.json
*.vader.out

# Ignore environment files
.env
.env.*
.python-version
76 changes: 0 additions & 76 deletions .github/workflows/build_base_image.yml

This file was deleted.

123 changes: 123 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Python-mode Tests

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
schedule:
- cron: '0 0 * * 0' # Weekly run

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
test-suite: ['unit', 'integration']
fail-fast: false
max-parallel: 4

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.python-version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.python-version }}-
${{ runner.os }}-buildx-

- name: Build test environment
run: |
# Check if Python Docker image exists and get the appropriate version
PYTHON_VERSION=$(bash scripts/cicd/check_python_docker_image.sh "${{ matrix.python-version }}")
echo "Using Python version: ${PYTHON_VERSION}"

# Export for docker compose
export PYTHON_VERSION="${PYTHON_VERSION}"

# Build the docker compose services
docker compose build python-mode-tests

- name: Run test suite
run: |
# Get the appropriate Python version
PYTHON_VERSION=$(bash scripts/cicd/check_python_docker_image.sh "${{ matrix.python-version }}")

# Set environment variables
export PYTHON_VERSION="${PYTHON_VERSION}"
export TEST_SUITE="${{ matrix.test-suite }}"
export GITHUB_ACTIONS=true

# Run dual test suite (both legacy and Vader tests)
python scripts/cicd/dual_test_runner.py

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.python-version }}-${{ matrix.test-suite }}
path: |
test-results.json
test-logs/
results/

- name: Upload coverage reports
uses: codecov/codecov-action@v3
if: matrix.test-suite == 'unit'
with:
file: ./coverage.xml
flags: python-${{ matrix.python-version }}

- name: Basic test validation
run: |
echo "Tests completed successfully"

- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

aggregate-results:
needs: test
runs-on: ubuntu-latest
if: always()

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4

- name: Generate test report
run: |
python scripts/cicd/generate_test_report.py \
--input-dir . \
--output-file test-report.html

- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: test-report
path: test-report.html

- name: Comment PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('test-summary.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: report
});
2 changes: 0 additions & 2 deletions .github/workflows/test_pymode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ jobs:
run: |
docker compose build -q \
--build-arg PYTHON_VERSION="${{ matrix.python_version.full }}" \
--build-arg PYTHON_VERSION_SHORT="${{ matrix.python_version.short }}" \
python-mode-tests

- name: Run tests with Python ${{ matrix.python_version.short }}
run: |
docker compose run --rm \
-e PYTHON_VERSION="${{ matrix.python_version.full }}" \
-e PYTHON_VERSION_SHORT="${{ matrix.python_version.short }}" \
python-mode-tests
Loading
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy