Skip to content

Update contact email with additional note (#7) #9

Update contact email with additional note (#7)

Update contact email with additional note (#7) #9

Workflow file for this run

name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov pytest-mock pytest-xdist
pip install -r requirements.txt
continue-on-error: false
- name: Create tests directory if not exists
run: |
python -c "import os; os.makedirs('tests', exist_ok=True); open('tests/__init__.py', 'a').close()"
shell: bash
- name: Run basic smoke test
run: |
python -c "import cryptvault; print(f'CryptVault version: {cryptvault.__version__}')"
continue-on-error: false
- name: Run tests with coverage
run: |
pytest tests/ -v --cov=cryptvault --cov-report=xml --cov-report=term || echo "Tests completed with issues"
continue-on-error: true
- name: Upload coverage to Codecov
if: always()
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
fail_ci_if_error: false
verbose: true
- name: Create Issue on Test Failure
if: failure() && github.event_name == 'push'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const title = `Test Failures on ${process.env.MATRIX_OS} - Python ${process.env.MATRIX_PY}`;
const body = `## Automated Test Failure Report
**Workflow Run:** ${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}
**OS:** ${process.env.MATRIX_OS}
**Python Version:** ${process.env.MATRIX_PY}
**Branch:** ${process.env.GITHUB_REF_NAME}
**Commit:** ${process.env.GITHUB_SHA}
### Action Required
Tests failed on this configuration. Please review the workflow logs and fix the failing tests.
### Debug Steps
1. Check out the branch
2. Run tests locally: \`pytest tests/ -v\`
3. Fix failing tests
4. Push changes
`;
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: ['automated', 'test-failure']
});
if (issues.data.length === 0) {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['automated', 'test-failure', 'bug']
});
}
env:
MATRIX_OS: ${{ matrix.os }}
MATRIX_PY: ${{ matrix.python-version }}