ci: Rename things better #10
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 | |
on: | |
push: | |
paths: | |
- "**.py" | |
- "requirements.txt" | |
- "pyproject.toml" | |
- ".github/workflows/python.yml" | |
pull_request: | |
paths: | |
- "**.py" | |
- "requirements.txt" | |
- "pyproject.toml" | |
- ".github/workflows/python.yml" | |
jobs: | |
build-and-test: | |
name: Build and Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: python -m pip install -r requirements.txt | |
- name: Build | |
run: python -m build | |
- name: Test | |
run: python -m unittest discover -s src/locusts-r-us | |
publish: | |
name: Publish to PyPI | |
needs: build-and-test | |
if: ${{ github.event_name == 'tag' && startsWith(github.ref, 'refs/tags') }} | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: python -m pip install -r requirements.txt | |
- name: Build the package | |
run: python -m build --sdist --wheel | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |