Skip to content

Commit 07b9a2a

Browse files
committed
update workflow
1 parent 509281d commit 07b9a2a

1 file changed

Lines changed: 94 additions & 29 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 94 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
# GitHub Actions workflow for building and publishing txaio wheels.
2-
#
3-
# This is a simplified version based on the autobahn-python workflow,
4-
# adapted for a pure Python package.
5-
#
2+
63
name: wheels
74

85
on:
96
# Build wheels on feature branches and PRs (test only)
107
push:
118
branches: ["**"]
129
pull_request:
13-
branches: [main]
10+
branches: [master]
1411

15-
# Publish to GitHub Releases when merged to master
12+
# Publish to GitHub Releases when merged to master OR
1613
# Publish to PyPI when tagged
1714
workflow_dispatch:
1815

@@ -21,48 +18,105 @@ env:
2118
UV_CACHE_DIR: ${{ github.workspace }}/.uv-cache
2219

2320
jobs:
24-
build-wheels:
25-
name: Build wheels
21+
build-package:
22+
name: Build wheels and source distribution
2623
runs-on: ubuntu-latest
2724

2825
steps:
2926
- name: Checkout code
3027
uses: actions/checkout@v4
3128

32-
- name: Set up Python
33-
uses: actions/setup-python@v5
34-
with:
35-
python-version: '3.11'
29+
- name: Install Just
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
34+
echo "$HOME/bin" >> $GITHUB_PATH
3635
37-
- name: Install dependencies
38-
run: pip install build just
36+
- name: Install uv
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
run: |
40+
curl -LsSf https://astral.sh/uv/install.sh | sh
41+
source $HOME/.cargo/env
42+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
3943
40-
- name: Build package
41-
run: just build
44+
- name: Verify toolchain
45+
run: |
46+
export PATH="/root/.cargo/bin:$PATH"
47+
echo "==> Build environment summary:"
48+
echo "Just: $(just --version)"
49+
echo "uv: $(uv --version)"
50+
echo "Rust: $(rustc --version)"
51+
echo "Python: $(python3 --version)"
52+
echo "GCC: $(gcc --version | head -1)"
53+
echo "glibc: $(ldd --version 2>/dev/null | head -1 || echo 'N/A')"
54+
55+
- name: Build package (wheel and source distribution on CPython 3.11)
56+
run: just build cpy311
57+
58+
- name: Generate build metadata
59+
run: |
60+
mkdir -p dist/
61+
cat > dist/build-info.txt << EOF
62+
Build Information for ${{ matrix.target.name }}
63+
=============================================
64+
65+
Build Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
66+
Container: ${{ matrix.target.base_image }}
67+
Platform: AMD64
68+
Build Method: GitHub Actions + Docker Container
69+
70+
System Information:
71+
- OS: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)
72+
- Kernel: $(uname -r)
73+
- glibc: $(ldd --version 2>/dev/null | head -1 || echo 'N/A')
74+
75+
Build Tools:
76+
- Just: $(just --version)
77+
- uv: $(uv --version)
78+
- Rust: $(rustc --version)
79+
- Python: $(python3 --version)
80+
- GCC: $(gcc --version | head -1)
81+
EOF
82+
83+
- name: List build artifacts
84+
run: |
85+
echo "==> Built package artifacts:"
86+
ls -la dist/ 2>/dev/null || echo "No dist/ directory found"
87+
echo ""
88+
echo "==> Build metadata:"
89+
cat dist/build-info.txt 2>/dev/null || echo "No build info found"
4290
43-
- name: Upload distribution package
91+
- name: Upload build artifacts
4492
uses: actions/upload-artifact@v4
4593
with:
46-
name: python-package-distributions
47-
path: dist/
94+
name: build-artifacts
95+
path: dist/*
96+
retention-days: 30
4897

4998
publish-github-releases:
5099
name: Publish to GitHub Releases
51-
needs: build-wheels
100+
needs: build-package
52101
runs-on: ubuntu-latest
53-
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
102+
103+
# Publish to GitHub Releases when merged to master
104+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
54105

55106
steps:
56-
- name: Download distribution package
107+
- name: Download build artifacts
57108
uses: actions/download-artifact@v4
58109
with:
59-
name: python-package-distributions
110+
name: build-artifacts
60111
path: dist/
61112

62113
- name: List all artifacts
63114
run: |
64115
echo "All built artifacts:"
65116
ls -la dist/
117+
echo ""
118+
echo "Wheel count: $(ls dist/*.whl | wc -l)"
119+
echo "Source distributions: $(ls dist/*.tar.gz | wc -l)"
66120
67121
- name: Create GitHub Release
68122
env:
@@ -80,26 +134,37 @@ jobs:
80134
81135
publish-pypi:
82136
name: Publish to PyPI
83-
needs: build-wheels
137+
needs: build-package
84138
runs-on: ubuntu-latest
85-
# Run only when a tag is pushed
86-
if: startsWith(github.ref, 'refs/tags/')
139+
140+
# Publish to PyPI when tagged
141+
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
87142

88143
environment:
89144
name: pypi
90145
url: https://pypi.org/p/txaio
91146

92147
permissions:
93-
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
148+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
94149

95150
steps:
96151
- name: Download distribution package
97152
uses: actions/download-artifact@v4
98153
with:
99-
name: python-package-distributions
154+
name: build-artifacts
100155
path: dist/
101156

157+
- name: List all artifacts
158+
run: |
159+
echo "All built artifacts:"
160+
ls -la dist/
161+
echo ""
162+
echo "Wheel count: $(ls dist/*.whl | wc -l)"
163+
echo "Source distributions: $(ls dist/*.tar.gz | wc -l)"
164+
102165
- name: Publish package to PyPI
103166
uses: pypa/gh-action-pypi-publish@release/v1
104167
with:
105-
verbose: true
168+
verbose: true
169+
attestations: true
170+
print-hash: true

0 commit comments

Comments
 (0)