Skip to content

Commit e7d0c29

Browse files
authored
Phase 1.3: CI/CD Modernization (#205)
* create new feature branch; add audit file * refactor: migrate from mypy to ty (Astral type checker) Replace mypy with ty for static type checking. ty is Astral's extremely fast Rust-based type checker that: - Installs as a standalone binary (no Python package deps) - Eliminates PyPy build failures caused by mypy's librt dependency - Is 10-100x faster than mypy - Integrates well with the Astral toolchain (uv, ruff) Changes: - pyproject.toml: Remove mypy from dev deps, add [tool.ty] section - justfile: Update check-typing to use `ty check` instead of mypy - justfile: Update distclean to remove .ty/ instead of .mypy_cache/ Some ty rules are ignored due to txaio's dynamic framework switching: - unresolved-attribute: dynamic module attributes (using_twisted, etc) - possibly-missing-attribute: sys._getframe() returns FrameType | None - call-non-callable: callback type inference edge cases - deprecated: abc.abstractproperty usage (to be fixed later) * ci: enable ty type checking in GitHub Actions - Add step to install ty via `uv tool install ty` - Add ty version to toolchain verification output - Enable type checking step (was commented out for mypy) * ci: enable tests and coverage in GitHub Actions Add test execution and coverage reporting to quality-checks job: - Run tests via `just test cpy314` - Run coverage report via `just check-coverage cpy314` * ci: align workflows with wamp-cicd patterns - Add identifiers job using wamp-cicd reusable workflow - Add permissions block (contents: read, pull-requests: read) - Add submodules: recursive to all checkout steps - Add environment variables from identifiers outputs to all jobs - Add coverage report artifact upload step - Update build-package to depend on identifiers job This aligns txaio workflows with autobahn-python patterns for consistent CI/CD across the WAMP project group. * ci: fix publish-github-releases to skip on PRs - Add if condition to only run on push/workflow_dispatch events - Add permissions block with contents: write for release creation - Prevents failures when release.yml runs on PR events * ci: align release.yml with autobahn-python model - Replace direct push/pr triggers with workflow_run trigger - Add check-main-workflow job to verify main workflow completed - Use wamp-proto/wamp-cicd identifiers.yml for release type detection - Separate release-development (dev/nightly) and release-production jobs - Gate releases by identifiers.outputs.release_type - Production releases now trigger on 'stable' release_type from tags - Development releases trigger on 'development' or 'nightly' types - Use softprops/action-gh-release@v2 for GitHub releases - Use PyPI trusted publishing (OIDC) for production releases - Build docs with cpy314, package with cpy311 - Add checksums and documentation archive to releases This aligns txaio with the standard workflow model used by autobahn-python, zlmdb, and crossbar - eliminating the risk of accidental releases from PR builds. Note: This work was completed with AI assistance (Claude Code).
1 parent 2d0ca8e commit e7d0c29

5 files changed

Lines changed: 345 additions & 217 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- [ ] I did **not** use any AI-assistance tools to help create this pull request.
2+
- [x] I **did** use AI-assistance tools to *help* create this pull request.
3+
- [x] I have read, understood and followed the project's AI_POLICY.md when creating code, documentation etc. for this pull request.
4+
5+
Submitted by: @oberstet
6+
Date: 2025-12-02
7+
Related issue(s): #204
8+
Branch: oberstet:modernization-phase-1.3

.github/workflows/main.yml

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,40 @@ on:
77
branches: [master]
88
workflow_dispatch:
99

10+
permissions:
11+
contents: read
12+
pull-requests: read
13+
1014
env:
1115
UV_CACHE_DIR: ${{ github.workspace }}/.uv-cache
1216

1317
jobs:
18+
identifiers:
19+
# GitHub needs to know where .cicd/workflows/identifiers.yml lives at parse time,
20+
# and submodules aren't included in that context! thus the following does NOT work:
21+
# uses: ./.cicd/workflows/identifiers.yml
22+
# we MUST reference the remote repo directly:
23+
uses: wamp-proto/wamp-cicd/.github/workflows/identifiers.yml@main
24+
# IMPORTANT: we still need .cicd as a Git submodule in the using repo though!
25+
# because e.g. identifiers.yml wants to access scripts/sanitize.sh !
26+
1427
quality-checks:
1528
name: Code Quality Checks
29+
needs: identifiers
1630
runs-on: ubuntu-24.04
1731

32+
env:
33+
BASE_REPO: ${{ needs.identifiers.outputs.base_repo }}
34+
BASE_BRANCH: ${{ needs.identifiers.outputs.base_branch }}
35+
PR_NUMBER: ${{ needs.identifiers.outputs.pr_number }}
36+
PR_REPO: ${{ needs.identifiers.outputs.pr_repo }}
37+
PR_BRANCH: ${{ needs.identifiers.outputs.pr_branch }}
38+
1839
steps:
1940
- name: Checkout code
2041
uses: actions/checkout@v4
42+
with:
43+
submodules: recursive
2144

2245
- name: Install Just
2346
env:
@@ -37,10 +60,14 @@ jobs:
3760
-LsSf https://astral.sh/uv/install.sh | sh
3861
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
3962
63+
- name: Install ty (Astral type checker)
64+
run: uv tool install ty
65+
4066
- name: Verify toolchain installation
4167
run: |
4268
just --version
4369
uv --version
70+
ty --version
4471
4572
- name: Setup uv cache
4673
uses: actions/cache@v4
@@ -59,19 +86,40 @@ jobs:
5986
- name: Lint code using Ruff
6087
run: just check-format cpy314
6188

62-
# - name: Run static type checking with mypy
63-
# run: just check-typing cpy314
89+
- name: Run static type checking with ty
90+
run: just check-typing cpy314
91+
92+
- name: Run tests
93+
run: just test cpy314
94+
95+
- name: Run tests with coverage report
96+
run: just check-coverage cpy314
6497

65-
# - name: Run tests and generate an HTML coverage report
66-
# run: just check-coverage cpy314
98+
- name: Upload coverage report
99+
if: always()
100+
uses: actions/upload-artifact@v4
101+
with:
102+
name: coverage-report
103+
path: docs/_build/html/coverage/
104+
retention-days: 14
67105

68106
documentation:
69107
name: Documentation Build
108+
needs: identifiers
70109
runs-on: ubuntu-24.04
71110

111+
env:
112+
BASE_REPO: ${{ needs.identifiers.outputs.base_repo }}
113+
BASE_BRANCH: ${{ needs.identifiers.outputs.base_branch }}
114+
PR_NUMBER: ${{ needs.identifiers.outputs.pr_number }}
115+
PR_REPO: ${{ needs.identifiers.outputs.pr_repo }}
116+
PR_BRANCH: ${{ needs.identifiers.outputs.pr_branch }}
117+
72118
steps:
73119
- name: Checkout code
74120
uses: actions/checkout@v4
121+
with:
122+
submodules: recursive
75123

76124
- name: Install Just
77125
env:
@@ -123,7 +171,14 @@ jobs:
123171
build-package:
124172
name: Package Build
125173
runs-on: ubuntu-24.04
126-
needs: [quality-checks]
174+
needs: [identifiers, quality-checks]
175+
176+
env:
177+
BASE_REPO: ${{ needs.identifiers.outputs.base_repo }}
178+
BASE_BRANCH: ${{ needs.identifiers.outputs.base_branch }}
179+
PR_NUMBER: ${{ needs.identifiers.outputs.pr_number }}
180+
PR_REPO: ${{ needs.identifiers.outputs.pr_repo }}
181+
PR_BRANCH: ${{ needs.identifiers.outputs.pr_branch }}
127182

128183
strategy:
129184
matrix:
@@ -132,6 +187,8 @@ jobs:
132187
steps:
133188
- name: Checkout code
134189
uses: actions/checkout@v4
190+
with:
191+
submodules: recursive
135192

136193
- name: Install Just
137194
env:

0 commit comments

Comments
 (0)