Release v0.2.2 II #25
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: pytest | |
# Only build PRs, the main branch, and releases. | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
schedule: | |
- cron: "14 14 20 * *" | |
# Cancel any previous run of the test job. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: ${{ matrix.os }} py${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, ] # macos, windows] # Only Linux currently. | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Need to fetch more than the last commit so that setuptools_scm can | |
# create the correct version string. If the number of commits since | |
# the last release is greater than this, the version still be wrong. | |
# Increase if necessary. | |
fetch-depth: 100 | |
# The GitHub token is preserved by default but this job doesn't need | |
# to be able to push to GitHub. | |
persist-credentials: false | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install .[tests] | |
- name: Flake8 | |
run: flake8 src/ tests/ | |
- name: Test with pytest | |
run: pytest --cov=fftlog | |
deploy: | |
needs: test | |
name: Deploy to PyPI | |
runs-on: ubuntu-latest | |
# Only from the origin repository, not forks; only main and tags. | |
if: github.repository_owner == 'emsig' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
- name: Build source and wheel distributions | |
run: | | |
# Build source and wheel packages | |
python -m build | |
echo "" | |
echo "Generated files:" | |
ls -lh dist/ | |
- name: Publish to PyPI | |
# Only for releases | |
if: success() && github.event_name == 'release' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} |