Skip to content
51 changes: 51 additions & 0 deletions .github/workflows/pr-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: PR Workflow

on:
pull_request:
types: [opened, synchronize]

jobs:
build-and-test:
runs-on: ubuntu-latest

Choose a reason for hiding this comment

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

check


steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # Change this to the version you need

- name: Install dependencies
run: |

Choose a reason for hiding this comment

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

test

python -m pip install --upgrade pip
pip install -r requirements.txt # Assuming you have a requirements file

- name: Deploy to GitHub Pages
run: mkdocs gh-deploy --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: |
pytest tests/ # Adjust path if tests are located elsewhere


- name: Post PR Comment if Tests Fail
if: failure()
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issueNumber = context.payload.pull_request ? context.payload.pull_request.number : null;
if (issueNumber) {
await github.rest.issues.createComment({
issue_number: issueNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: "⚠️ Tests failed! Please review the logs and make necessary changes."
});
} else {
console.log("No PR context found; skipping comment.");
}
17 changes: 17 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Welcome to MkDocs

For full documentation visit [mkdocs.org](https://www.mkdocs.org).

## Commands

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.

## Project layout

mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.
8 changes: 8 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
site_name: "Your Project Documentation"
theme:
name: material
nav:
- Home: index.md
- Guide: guide.md
- API Reference: api.md

6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pytest==7.2.0
flake8==5.0.4
requests==2.31.0
mkdocs
mkdocs-material

9 changes: 9 additions & 0 deletions tests/test_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@


def test_add():
assert 2+3 == 5


def test_multiply():
assert 2*3 == 6