diff --git a/.github/workflows/deploy-doc.yml b/.github/workflows/deploy-doc.yml new file mode 100644 index 0000000..afa9abf --- /dev/null +++ b/.github/workflows/deploy-doc.yml @@ -0,0 +1,36 @@ +name: "Sphinx: Render docs" + +on: push + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install uv + run: pip install uv + - name: Install docs dependencies + run: uv pip install --system -e ".[docs]" + - name: Build HTML + run: | + cd docs + make html + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: html-docs + path: docs/build/html/ + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html/ diff --git a/.github/workflows/pr-welcome.yml b/.github/workflows/pr-welcome.yml new file mode 100644 index 0000000..16841ed --- /dev/null +++ b/.github/workflows/pr-welcome.yml @@ -0,0 +1,37 @@ +name: PR Welcome Bot + +on: + pull_request: + types: [opened] + +jobs: + welcome: + runs-on: ubuntu-latest + steps: + - name: Post Welcome Comment + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const prNumber = context.issue.number; + const prAuthor = context.payload.pull_request.user.login; + + const welcomeMessage = ` + 👋 Hello @${prAuthor}, thank you for contributing to this project! 🎉 + + We've received your Pull Request and the team will review it as soon as possible. + + In the meantime, please ensure: + - [ ] Your code follows the project's coding style + - [ ] Relevant tests have been added and are passing + - [ ] Documentation has been updated if needed + + If you have any questions, feel free to ask here. Happy coding! 😊 + `; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: welcomeMessage + }); diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..3a10e89 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,36 @@ +name: Publish to PyPI + +on: + push: + branches: + - 'main' + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Build package with uv + run: | + uv build + + - name: Publish to PyPI + env: + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: | + uv publish --token $UV_PUBLISH_TOKEN diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml new file mode 100644 index 0000000..bc1b278 --- /dev/null +++ b/.github/workflows/python-lint.yml @@ -0,0 +1,27 @@ +name: Python Linting + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --all-files diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..1da8c6d --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,35 @@ +name: Run Tests with Pytest + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Install dependencies + run: | + uv sync --group test + + - name: Run tests with pytest + run: | + uv run pytest tests/