| 1 |
name: BTest |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
push: |
| 6 |
branches: [master] |
| 7 |
tags: |
| 8 |
- 'v*' |
| 9 |
- '!v*-dev' |
| 10 |
|
| 11 |
jobs: |
| 12 |
Run-BTest: |
| 13 |
strategy: |
| 14 |
matrix: |
| 15 |
python-version: |
| 16 |
- "3.10" |
| 17 |
- "3.11" |
| 18 |
- "3.12" |
| 19 |
- "3.13" |
| 20 |
os: [macos-latest, ubuntu-latest] |
| 21 |
|
| 22 |
runs-on: ${{ matrix.os }} |
| 23 |
steps: |
| 24 |
- name: Set up git config |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
run: | |
| 29 |
git config --global core.autocrlf false |
| 30 |
git config --global core.eol lf |
| 31 |
- uses: actions/checkout@v4 |
| 32 |
- name: Set up Python ${{ matrix.python-version }} |
| 33 |
uses: actions/setup-python@v5 |
| 34 |
with: |
| 35 |
python-version: ${{ matrix.python-version }} |
| 36 |
- name: Install dependencies |
| 37 |
run: | |
| 38 |
python -m pip install btest |
| 39 |
- name: Install pysubnettree |
| 40 |
run: | |
| 41 |
python -m pip install --verbose -e . |
| 42 |
- run: | |
| 43 |
make test BTEST=$(which btest) |
| 44 |
|
| 45 |
upload: |
| 46 |
runs-on: ubuntu-latest |
| 47 |
needs: [Run-BTest] |
| 48 |
if: github.repository == 'zeek/pysubnettree' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 49 |
environment: |
| 50 |
name: pypi |
| 51 |
url: https://pypi.org/p/pysubnettree |
| 52 |
permissions: |
| 53 |
id-token: write |
| 54 |
steps: |
| 55 |
- uses: actions/checkout@v4 |
| 56 |
- name: Check release version |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
run: | |
| 61 |
grep -E -x '[0-9]+\.[0-9]+(\.[0-9]+)?' VERSION |
| 62 |
- name: Build sdist |
| 63 |
run: | |
| 64 |
make dist |
| 65 |
- name: Upload to PyPI |
| 66 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 67 |
with: |
| 68 |
user: __token__ |
| 69 |
password: ${{ secrets.PYPI_API_TOKEN }} |