-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (102 loc) · 3.54 KB
/
docker-publish.yml
File metadata and controls
127 lines (102 loc) · 3.54 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Build Wheels
on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
timeout-minutes: 600
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false
docker-images: false
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Add Swap
run: |
SWAP_FILE="/mnt/swapfile"
swapon --show
echo "Trying to disable and remove existing swap if needed..."
if swapon --show=NAME | grep -q "$SWAP_FILE"; then
echo "Disabling existing swap at $SWAP_FILE..."
sudo swapoff "$SWAP_FILE"
fi
if [ -f "$SWAP_FILE" ]; then
echo "Removing existing file at $SWAP_FILE..."
sudo rm -f "$SWAP_FILE"
fi
echo "Creating new 32G swap file..."
sudo dd if=/dev/zero of=$SWAP_FILE bs=1G count=32
sudo chmod 600 "$SWAP_FILE"
sudo mkswap "$SWAP_FILE"
sudo swapon "$SWAP_FILE"
echo "Final swap status:"
swapon --show
free -h
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# Avoid using local disk for buildx cache; use GHA cache backend
- name: Prune Docker to free space
run: |
docker system prune -af --volumes || true
rm -rf /tmp/.buildx-cache || true
rm -rf ./out || true
# Build and export wheels directly (fastest method)
- name: Build and export wheels
uses: docker/build-push-action@v5
with:
context: .
target: wheels # We'll add this target to Dockerfile
outputs: type=local,dest=./out
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Verify exported wheels
run: |
echo "Wheel files exported directly during build:"
ls -la ./out/
echo "Wheel count: $(ls -1 ./out/*.whl | wc -l)"
- name: Upload wheels as artifact
uses: actions/upload-artifact@v4
with:
name: wheels
path: ./out/*.whl
- name: Upload .whl to GitHub Release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${GITHUB_REF##*/}
# Get wheel file information
LIGHTKERNEL_WHEEL=$(ls ./out/lightllm_kernel-*.whl | head -n1 | xargs basename)
gh release create "$TAG_NAME" ./out/*.whl \
--title "LightKernel Release $TAG_NAME" \
--notes "🎯 **LightKernel Release $TAG_NAME**
This automated release contains pre-compiled wheel packages:
📦 **Packages:**
- **$LIGHTKERNEL_WHEEL** - Core CUDA kernel library
🚀 **Quick Installation:**
\`\`\`bash
# Install both packages
pip install https://github.com/${{ github.repository }}/releases/download/$TAG_NAME/$LIGHTKERNEL_WHEEL
\`\`\`
🔧 **Build Environment:**
- CUDA: 12.8.0 with cuDNN
- PyTorch: 2.8.0
- Python: 3.10
- Architecture: CUDA Compute Capabilities 9.0
Built on $(date -u)" \
|| echo "Release already exists, skipping"