diff --git a/.github/workflows/pr-workflow.yml b/.github/workflows/pr-workflow.yml new file mode 100644 index 0000000..dd60817 --- /dev/null +++ b/.github/workflows/pr-workflow.yml @@ -0,0 +1,51 @@ +name: PR Workflow + +on: + pull_request: + types: [opened, synchronize] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + 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: | + 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."); + } diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..000ea34 --- /dev/null +++ b/docs/index.md @@ -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. diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..33f7c19 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,8 @@ +site_name: "Your Project Documentation" +theme: + name: material +nav: + - Home: index.md + - Guide: guide.md + - API Reference: api.md + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..77d8e6c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +pytest==7.2.0 +flake8==5.0.4 +requests==2.31.0 +mkdocs +mkdocs-material + diff --git a/tests/test_example.py b/tests/test_example.py new file mode 100644 index 0000000..c6c28db --- /dev/null +++ b/tests/test_example.py @@ -0,0 +1,9 @@ + + +def test_add(): + assert 2+3 == 5 + + +def test_multiply(): + assert 2*3 == 6 +