1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [main, "release/*"]
6+ pull_request :
7+
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+
12+ outputs :
13+ version : ${{ steps.git_version.outputs.BUILD_VERSION }}
14+ version_major : ${{ steps.git_version.outputs.BUILD_VERSION_MAJOR }}
15+ version_minor : ${{ steps.git_version.outputs.BUILD_VERSION_MINOR }}
16+ version_patch : ${{ steps.git_version.outputs.BUILD_VERSION_PATCH }}
17+ version_build : ${{ steps.git_version.outputs.BUILD_VERSION_BUILD }}
18+ tag : ${{ steps.git_version.outputs.BUILD_VERSION_TAG }}
19+ branch : ${{ steps.git_version.outputs.BUILD_VERSION_BRANCH }}
20+ commit : ${{ steps.git_version.outputs.BUILD_VERSION_COMMIT }}
21+ short : ${{ steps.git_version.outputs.BUILD_VERSION_SHORT }}
22+ full : ${{ steps.git_version.outputs.BUILD_VERSION_FULL }}
23+ extended : ${{ steps.git_version.outputs.BUILD_VERSION_EXTENDED }}
24+ default_branch : ${{ steps.git_version.outputs.BUILD_VERSION_DEFAULT_BRANCH }}
25+ release_branches : ${{ steps.git_version.outputs.BUILD_VERSION_RELEASE_BRANCHES }}
26+
27+ steps :
28+ - uses : actions/checkout@v4
29+ with :
30+ fetch-depth : 0
31+
32+ - name : Set up Python
33+ uses : actions/setup-python@v5
34+ with :
35+ python-version : " 3.13"
36+
37+ - name : Install build tools
38+ run : |
39+ python -m pip install --upgrade pip
40+ pip install build
41+
42+ - name : Generate _version.py from git tags
43+ run : python tools/write_version.py
44+
45+ - name : Build package
46+ run : python -m build
47+
48+ - name : Install built package
49+ run : pip install dist/*.whl
50+
51+ - name : Extract version info from built package
52+ id : git_version
53+ run : |
54+ while IFS='=' read -r key value; do
55+ echo "$key=$value" >> "$GITHUB_OUTPUT"
56+ done < <(git-version --property env)
57+
58+ - name : Show version info
59+ run : |
60+ echo "═══════════════════════════════════════"
61+ echo " GIT VERSION INFORMATION"
62+ echo "═══════════════════════════════════════"
63+ echo " Version: ${{ steps.git_version.outputs.BUILD_VERSION }}"
64+ echo " Major: ${{ steps.git_version.outputs.BUILD_VERSION_MAJOR }}"
65+ echo " Minor: ${{ steps.git_version.outputs.BUILD_VERSION_MINOR }}"
66+ echo " Patch: ${{ steps.git_version.outputs.BUILD_VERSION_PATCH }}"
67+ echo " Build: ${{ steps.git_version.outputs.BUILD_VERSION_BUILD }}"
68+ echo " Tag: ${{ steps.git_version.outputs.BUILD_VERSION_TAG }}"
69+ echo " Branch: ${{ steps.git_version.outputs.BUILD_VERSION_BRANCH }}"
70+ echo " Commit: ${{ steps.git_version.outputs.BUILD_VERSION_COMMIT }}"
71+ echo " Short: ${{ steps.git_version.outputs.BUILD_VERSION_SHORT }}"
72+ echo " Full: ${{ steps.git_version.outputs.BUILD_VERSION_FULL }}"
73+ echo " Extended: ${{ steps.git_version.outputs.BUILD_VERSION_EXTENDED }}"
74+ echo " DefaultBranch: ${{ steps.git_version.outputs.BUILD_VERSION_DEFAULT_BRANCH }}"
75+ echo " ReleaseBranches: ${{ steps.git_version.outputs.BUILD_VERSION_RELEASE_BRANCHES }}"
76+ echo "═══════════════════════════════════════"
77+
78+ - name : Upload build artifacts
79+ uses : actions/upload-artifact@v4
80+ with :
81+ name : dist
82+ path : dist/
83+
84+ test :
85+ runs-on : ubuntu-latest
86+ needs : build
87+
88+ strategy :
89+ matrix :
90+ python-version : ["3.10", "3.11", "3.12", "3.13"]
91+
92+ steps :
93+ - uses : actions/checkout@v4
94+ with :
95+ fetch-depth : 0
96+
97+ - name : Set up Python ${{ matrix.python-version }}
98+ uses : actions/setup-python@v5
99+ with :
100+ python-version : ${{ matrix.python-version }}
101+
102+ - name : Install build tools
103+ run : |
104+ python -m pip install --upgrade pip
105+ pip install build
106+
107+ - name : Generate _version.py from git tags
108+ run : python tools/write_version.py
109+
110+ - name : Build package
111+ run : python -m build
112+
113+ - name : Install built package
114+ run : pip install dist/*.whl
115+
116+ - name : Install test dependencies
117+ run : pip install pytest
118+
119+ - name : Run tests from repo
120+ run : python -m pytest tests/ -v
121+
122+ lint :
123+ runs-on : ubuntu-latest
124+
125+ steps :
126+ - uses : actions/checkout@v4
127+
128+ - name : Set up Python
129+ uses : actions/setup-python@v5
130+ with :
131+ python-version : " 3.13"
132+
133+ - name : Install lint tools
134+ run : |
135+ python -m pip install --upgrade pip
136+ pip install ruff
137+
138+ - name : Lint with ruff
139+ run : ruff check src/ tests/
0 commit comments