Repository navigation
75 lines (63 loc) · 1.92 KB
/
Copy pathpython.yml
File metadata and controls
75 lines (63 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Builds and tests the Python implementation (python/) against the conformance suite,
# and publishes it to PyPI when a release is published.
# Publishing uses PyPI trusted publishing (OIDC): configure the trusted publisher for the
# jsontron project on pypi.org with repository devlooped/Jsontron and workflow python.yml.
name: python
on:
workflow_dispatch:
push:
branches: [ main, 'feature/*', 'rel/*' ]
paths: [ 'python/**', 'tests/**', 'schemas/**', '.github/workflows/python.yml' ]
pull_request:
paths: [ 'python/**', 'tests/**', 'schemas/**', '.github/workflows/python.yml' ]
release:
types: [released]
defaults:
run:
working-directory: python
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python: [ '3.11', '3.13' ]
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
- name: ⚙ python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: 📦 install
run: python -m pip install -e ".[test]"
- name: 🧹 lint
run: ruff check
- name: 🧪 test
run: pytest
publish:
needs: test
if: github.event_name == 'release'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: 🤘 checkout
uses: actions/checkout@v4
- name: ⚙ python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: 🏷 version
env:
TAG: ${{ github.event.release.tag_name }}
run: sed -i "s/^version = .*/version = \"${TAG#v}\"/" pyproject.toml
- name: 🙏 build
run: |
python -m pip install build
python -m build
- name: 🚀 publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: python/dist