Merge pull request #3 from European-XFEL/simplify-ci-packaging #27
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: Tests | |
on: | |
push: | |
branches: [ main ] | |
tags: [ "*" ] | |
pull_request: | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install package | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install . pytest | |
- name: Test with pytest | |
run: | | |
python3 -m pytest -v | |
packages: | |
name: Build packages | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: cp{38,39,310,311,312}-manylinux_x86_64 | |
with: | |
output-dir: dist | |
- name: List package files | |
run: | | |
ls -lh dist | |
# upload to PyPI on any tag on main | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_token }} |