Skip to content

test: trigger CI workflow #26

test: trigger CI workflow

test: trigger CI workflow #26

Workflow file for this run

name: CI - Code Testing Workflow
on:
pull_request:
branches:
- develop
- main
- "feature/*"
- "hotfix/*"
paths:
- "src/**"
- "tests/**"
- ".github/workflows/**"
push:
branches:
- develop
- main
paths:
- "src/**"
- "tests/**"
- ".github/workflows/**"
jobs:
test:
name: Run Tests and Post Coverage
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
BASE_URL: ${{ secrets.BASE_URL }}
API_KEY: ${{ secrets.API_KEY }}
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set up Node (for Allure CLI)
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install pytest pytest-cov allure-pytest
pip install -r requirements.txt
npm install -g allure-commandline
- name: Run tests (coverage + allure results)
run: |
source venv/bin/activate
pytest --cov=src --cov-report=xml --cov-report=term \
--alluredir=allure-results > coverage.txt
pytest --junitxml=pytest.xml
- name: Pull previous Allure history (if exists)
run: |
git fetch origin allure-report || true
if git ls-remote --exit-code origin allure-report; then
git checkout origin/allure-report -- history || true
if [ -d history ]; then
mkdir -p allure-results/history
cp -r history/* allure-results/history/ || true
fi
fi
continue-on-error: true
- name: Generate Allure Report
run: |
allure generate allure-results -o allure-report --clean
if [ -d allure-report/history ]; then ls -R allure-report/history | head -n 20; fi
- name: Pytest coverage comment (PR only)
if: github.event_name == 'pull_request'
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./coverage.txt
junitxml-path: ./pytest.xml
- name: Deploy Allure Report to GitHub Pages branch
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: allure-report
publish_dir: ./allure-report
keep_files: false
force_orphan: false
- name: Comment PR with Allure Report URL
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const reportUrl = `https://${owner}.github.io/${repo}/`;
const body = `📊 **Test Report Ready**\n\n✅ View detailed Allure test report with module-wise results, failures, coverage trends, and build durations:\n\n🔗 [**Open Allure Report**](${reportUrl})\n\n---\n*Report includes: Test Suites, Failures, Coverage Trends, Execution Timeline, and Module-wise Breakdown.*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});