| 1 |
name: Test |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
tags: |
| 8 |
- "*" |
| 9 |
pull_request: |
| 10 |
|
| 11 |
concurrency: |
| 12 |
group: >- |
| 13 |
${{ github.workflow }}- |
| 14 |
${{ github.ref_type }}- |
| 15 |
${{ github.event.pull_request.number || github.sha }} |
| 16 |
cancel-in-progress: true |
| 17 |
|
| 18 |
jobs: |
| 19 |
test: |
| 20 |
runs-on: ${{ matrix.platform }} |
| 21 |
strategy: |
| 22 |
matrix: |
| 23 |
platform: |
| 24 |
- "ubuntu-latest" |
| 25 |
- "windows-latest" |
| 26 |
python-version: |
| 27 |
- "3.8" |
| 28 |
- "3.9" |
| 29 |
- "3.10" |
| 30 |
- "3.11" |
| 31 |
- "3.12" |
| 32 |
- "3.13" |
| 33 |
- "3.14" |
| 34 |
steps: |
| 35 |
- uses: actions/checkout@v7 |
| 36 |
|
| 37 |
- name: Setup Python ${{ matrix.python-version }} |
| 38 |
uses: actions/setup-python@v7 |
| 39 |
with: |
| 40 |
python-version: ${{ matrix.python-version }} |
| 41 |
|
| 42 |
- name: Install dependencies |
| 43 |
run: | |
| 44 |
python -m pip install --upgrade pip |
| 45 |
pip install tox tox-gh-actions codecov |
| 46 |
|
| 47 |
- name: Run tests |
| 48 |
run: tox |
| 49 |
|
| 50 |
- name: Codecov upload |
| 51 |
env: |
| 52 |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 53 |
run: codecov |
| 54 |
|
| 55 |
packages: |
| 56 |
runs-on: ubuntu-latest |
| 57 |
needs: [test] |
| 58 |
permissions: |
| 59 |
id-token: write # OIDC for uploading to PyPI |
| 60 |
|
| 61 |
steps: |
| 62 |
- name: Checkout |
| 63 |
uses: actions/checkout@v7 |
| 64 |
|
| 65 |
- name: Set up Python 3.12 |
| 66 |
uses: actions/setup-python@v7 |
| 67 |
with: |
| 68 |
python-version: "3.12" |
| 69 |
|
| 70 |
- name: Build flit_core & flit packages |
| 71 |
run: | |
| 72 |
python flit_core/build_dists.py |
| 73 |
pip install requests docutils |
| 74 |
PYTHONPATH=flit_core/ python -m flit build |
| 75 |
# Copy flit_core packages to same location |
| 76 |
cp flit_core/dist/* dist/ |
| 77 |
|
| 78 |
- uses: actions/upload-artifact@v7 |
| 79 |
with: |
| 80 |
name: packages |
| 81 |
path: ./dist/* |
| 82 |
|
| 83 |
- name: Publish package distributions to PyPI |
| 84 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 85 |
if: ${{ startsWith(github.ref, 'refs/tags/') }} |