Skip to content
Merged
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
68 changes: 42 additions & 26 deletions .github/workflows/devRun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ on:
pull_request:
branches: [ main ]
paths:
- '**/*.py'
- '**/*.toml'
- '**/*.lock'
- '.github/workflows/devRun.yml'
- "**/*.py"
- "**/*.toml"
- "**/*.lock"
- ".github/workflows/devRun.yml"

permissions:
contents: write
contents: read
pull-requests: write
checks: write
pages: write
id-token: write

jobs:
merge_test:
Expand All @@ -22,7 +25,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
python-version: "3.14"
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
Expand All @@ -39,31 +42,44 @@ jobs:
- name: Auto-assign reviewers
uses: kentaro-m/auto-assign-action@v2.0.0
if: success()
- name: Link Git Information And Browser Version To Allure Report
working-directory: allure-results
- name: Link Git Information And Browser Version To Allure Results
if: always()
working-directory: allure-results
Comment on lines +45 to +47
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Prevent failures when allure-results is missing.

With working-directory: allure-results and if: always(), this step fails if tests didn’t create the folder (e.g., early failure), which then blocks report generation/deploy. Consider creating the directory beforehand.

🛠️ Suggested hardening
       - name: Auto-assign reviewers
         uses: kentaro-m/auto-assign-action@v2.0.0
         if: success()
+      - name: Ensure Allure results directory exists
+        if: always()
+        run: mkdir -p allure-results
       - name: Link Git Information And Browser Version To Allure Results
         if: always()
         working-directory: allure-results
🤖 Prompt for AI Agents
In @.github/workflows/devRun.yml around lines 45 - 47, The workflow step named
"Link Git Information And Browser Version To Allure Results" uses
working-directory: allure-results and if: always(), which causes failures when
the allure-results folder doesn't exist; add a prior step (or incorporate into
the job setup) that ensures the directory exists (e.g., run a mkdir -p
allure-results or equivalent) before the named step runs so that the
working-directory is valid even when tests fail early, referencing the step
label "Link Git Information And Browser Version To Allure Results" and the
working-directory value "allure-results" when updating the YAML.

run: |
{
echo BUILD_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
echo GIT_BRANCH=${{ github.head_ref || github.ref_name }}
echo GIT_COMMIT_ID=${{ github.sha }}
echo GIT_COMMIT_MESSAGE=$(git show -s --format=%s HEAD)
echo GIT_COMMIT_AUTHOR_NAME=$(git show -s --format='%ae' HEAD)
echo GIT_COMMIT_TIME=$(git show -s --format=%ci HEAD)
echo CHROME_VERSION=$(google-chrome --product-version)
echo BUILD_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
echo GIT_BRANCH=${{ github.head_ref || github.ref_name }}
echo GIT_COMMIT_ID=${{ github.sha }}
Comment on lines +50 to +52
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid untrusted github.head_ref expansion in shell.

Line 51 interpolates ${{ github.head_ref }} directly into the script, which can allow PR branch-name injection. Pass it via env and quote in the shell.

🔒 Proposed fix
       - name: Link Git Information And Browser Version To Allure Results
         if: always()
         working-directory: allure-results
+        env:
+          GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
         run: |
           {
             echo BUILD_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
-            echo GIT_BRANCH=${{ github.head_ref || github.ref_name }}
+            echo "GIT_BRANCH=$GIT_BRANCH"
             echo GIT_COMMIT_ID=${{ github.sha }}
             echo GIT_COMMIT_MESSAGE="$(git show -s --format=%s HEAD)"
🤖 Prompt for AI Agents
In @.github/workflows/devRun.yml around lines 50 - 52, Avoid expanding `${{
github.head_ref }}` directly in the shell; instead set GIT_BRANCH via the
job/step env (e.g., env: GIT_BRANCH: ${{ github.head_ref || github.ref_name }})
and then reference the safe environment variable in the script with quoting
(echo GIT_BRANCH="$GIT_BRANCH"); do similarly for any other interpolated values
if needed (BUILD_URL and GIT_COMMIT_ID can be set via env and echoed as
"$BUILD_URL" and "$GIT_COMMIT_ID") to prevent branch-name injection.

echo GIT_COMMIT_MESSAGE="$(git show -s --format=%s HEAD)"
echo GIT_COMMIT_AUTHOR_NAME="$(git show -s --format='%ae' HEAD)"
echo GIT_COMMIT_TIME="$(git show -s --format=%ci HEAD)"
echo CHROME_VERSION="$(google-chrome --product-version 2>/dev/null || true)"
} >> environment.properties
- name: Generate Allure Report
uses: simple-elf/allure-report-action@v1.13
- name: Generate Allure HTML report (Allure 3 CLI via npx)
if: always()
run: npx -y allure generate allure-results --output allure-report
- name: Allure PR summary
if: always()
id: allure-report
uses: allure-framework/allure-action@v0.6.2
with:
allure_results: allure-results
allure_report: allure-report
gh_pages: gh-pages
allure_history: allure-history
- name: Deploy Report To Github Pages
report-directory: "./allure-report"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Pages artifact
if: always()
uses: peaceiris/actions-gh-pages@v4
uses: actions/upload-pages-artifact@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: allure-history
path: allure-report
deploy_pages:
needs: merge_test
if: always()
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
76 changes: 59 additions & 17 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ on:
workflow_dispatch:
inputs:
pytest_command:
description: 'Custom pytest command'
description: "Custom pytest command"
required: true
default: '-m "not devRun"'
type: string
parallelism:
description: 'Number of machines to split tests'
description: "Number of machines to split tests"
required: false
default: 2
type: number

permissions:
contents: write
contents: read
pages: write
id-token: write

jobs:
setup-matrix:
Expand All @@ -31,7 +32,6 @@ jobs:
count=${{ github.event.inputs.parallelism || 2 }}
matrix=$(seq -s ',' 1 $count)
echo "matrix=$(jq -cn --argjson groups "[$matrix]" '{group: $groups}')" >> $GITHUB_OUTPUT

nightly-test:
needs: setup-matrix
runs-on: ubuntu-latest
Expand All @@ -42,11 +42,12 @@ jobs:
EMAIL: ${{ secrets.EMAIL }}
PASSWORD: ${{ secrets.PASSWORD }}
steps:
- uses: actions/checkout@v5
- name: Checkout
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
python-version: "3.14"
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
Expand All @@ -56,26 +57,67 @@ jobs:
uv venv
uv sync --all-extras --dev
- name: Run Tests
run: |
xvfb-run .venv/bin/python -m pytest ${{ github.event.inputs.pytest_command || '-m "not devRun"' }} \
--base-url ${{ vars.BASE_URL }} \
--splits ${{ github.event.inputs.parallelism || 2 }} \
--group ${{ matrix.group }}
- name: Upload Test Results
run: >
xvfb-run .venv/bin/python -m pytest
${{ github.event.inputs.pytest_command || '-m "not devRun"' }}
--base-url ${{ vars.BASE_URL }}
--splits ${{ github.event.inputs.parallelism || 2 }}
--group ${{ matrix.group }}
- name: Upload shard allure-results
if: always()
uses: actions/upload-artifact@v5
with:
name: allure-results-${{ matrix.group }}
path: allure-results
retention-days: 7

merge-reports:
build-report:
needs: nightly-test
if: always()
runs-on: ubuntu-latest
steps:
- name: Merge and Publish Allure Report
uses: Valiantsin2021/allure-shard-results-publish@1.0.6
- name: Checkout
uses: actions/checkout@v5
- name: Download all shard results into allure-results
if: always()
uses: actions/download-artifact@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
add-env: 'true'
pattern: allure-results-*
path: allure-results
merge-multiple: true
- name: Link Git Information And Browser Version To Allure Results
if: always()
working-directory: allure-results
run: |
{
echo BUILD_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
echo GIT_BRANCH=${{ github.ref_name }}
echo GIT_COMMIT_ID=${{ github.sha }}
echo GIT_COMMIT_MESSAGE="$(git show -s --format=%s HEAD)"
echo GIT_COMMIT_AUTHOR_NAME="$(git show -s --format='%ae' HEAD)"
echo GIT_COMMIT_TIME="$(git show -s --format=%ci HEAD)"
echo CHROME_VERSION="$(google-chrome --product-version 2>/dev/null || true)"
} >> environment.properties
- name: Generate Allure HTML report
if: always()
run: npx -y allure generate allure-results --output allure-report
- name: Upload Pages artifact
if: always()
uses: actions/upload-pages-artifact@v4
with:
path: allure-report

deploy_pages:
needs: build-report
if: always()
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,10 @@ pytest -m sanity
```

## 📊 Results & Reporting
We use Allure for reporting. To view results locally:

Windows (via Scoop):

```bash
scoop install allure
allure serve allure-results
```

Mac (via Brew):
We use Allure for reporting. To generate and open the report locally:

```bash
brew install allure
allure serve allure-results
npx -y allure generate allure-results --output allure-report --open
```

👉 [See a Live Example of the Report Here](https://nirtal85.github.io/Selenium-Python-Example/)
Expand Down