Merge pull request #13 from nayandas69/main #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Package CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: [created] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
# Step 4: Run tests (if you add tests) | |
- name: Run tests | |
run: | | |
if [ -f pytest.ini ] || [ -d tests ]; then | |
pytest --maxfail=5 --disable-warnings | |
else | |
echo "No tests defined yet. Add your test commands here." | |
fi | |
publish: | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
# Step 3: Install build tools | |
- name: Install build tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
# Step 4: Build the package | |
- name: Build package | |
run: python -m build | |
# Step 5: Publish to PyPI | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: twine upload dist/* |