-
Notifications
You must be signed in to change notification settings - Fork 5
184 lines (144 loc) · 5.31 KB
/
Copy pathpublish-libkrun-sys.yml
File metadata and controls
184 lines (144 loc) · 5.31 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Publish libkrun-sys
on:
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 0.1.2)'
required: true
type: string
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
# ── Build and test Windows krun.dll ────────────────────────────
build-windows-dll:
name: Build Windows krun.dll
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- uses: Swatinem/rust-cache@v2
with:
workspaces: src
key: libkrun-windows
- name: Build krun.dll
working-directory: src/deps/libkrun-sys/vendor/libkrun
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Run Windows API tests
working-directory: src/deps/libkrun-sys
run: |
# Copy krun.dll to test location
Copy-Item vendor\libkrun\target\x86_64-pc-windows-msvc\release\krun.dll prebuilt\x86_64-pc-windows-msvc\
# Run all API tests
cargo test --target x86_64-pc-windows-msvc --lib -- --test-threads=1
- name: Package krun.dll
run: |
$VERSION = "${{ inputs.version }}"
$DIR = "a3s-libkrun-sys-$VERSION-windows-x86_64"
New-Item -ItemType Directory -Path $DIR\lib -Force
# Copy DLL
Copy-Item src\deps\libkrun-sys\vendor\libkrun\target\x86_64-pc-windows-msvc\release\krun.dll $DIR\lib\
# Copy headers if any
if (Test-Path src\deps\libkrun-sys\vendor\libkrun\include) {
Copy-Item -Recurse src\deps\libkrun-sys\vendor\libkrun\include $DIR\
}
# Create README
@"
# a3s-libkrun-sys Windows Build
Version: $VERSION
Platform: Windows x86_64 (WHPX)
Built: $(Get-Date -Format "yyyy-MM-dd HH:mm:ss UTC")
## Contents
- lib/krun.dll - libkrun Windows WHPX backend
## Usage
Add to your Cargo.toml:
``````toml
[dependencies]
a3s-libkrun-sys = "$VERSION"
``````
The krun.dll must be in your PATH or in the same directory as your executable.
## Features
- Windows Hypervisor Platform (WHPX) backend
- virtiofs passthrough filesystem
- virtio-net TCP backend
- virtio-blk block device
- virtio-console
- TSI (Transparent Socket Impersonation) for vsock
## Requirements
- Windows 10/11 with Hyper-V Platform enabled
- Run: ``Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform``
"@ | Out-File -FilePath $DIR\README.md -Encoding UTF8
# Create zip
Compress-Archive -Path $DIR -DestinationPath "$DIR.zip"
echo "ASSET=$DIR.zip" >> $env:GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: windows-dll
path: ${{ env.ASSET }}
# ── Publish to crates.io ───────────────────────────────────────
publish-crate:
name: Publish a3s-libkrun-sys to crates.io
needs: build-windows-dll
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- name: Update version in Cargo.toml
working-directory: src/deps/libkrun-sys
run: |
VERSION="${{ inputs.version }}"
sed -i "s/^version = .*/version = \"$VERSION\"/" Cargo.toml
cat Cargo.toml | grep "^version"
- name: Publish to crates.io
working-directory: src/deps/libkrun-sys
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish --allow-dirty || echo "Already published or error occurred"
# ── Create GitHub Release ──────────────────────────────────────
create-release:
name: Create GitHub Release
needs: [build-windows-dll, publish-crate]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: windows-dll
path: artifacts
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: libkrun-sys-v${{ inputs.version }}
name: "a3s-libkrun-sys v${{ inputs.version }} - Windows WHPX Support"
body: |
## a3s-libkrun-sys v${{ inputs.version }}
Windows WHPX backend support for libkrun.
### Features
- ✅ Windows Hypervisor Platform (WHPX) backend
- ✅ virtiofs passthrough filesystem
- ✅ virtio-net TCP backend
- ✅ virtio-blk block device
- ✅ virtio-console
- ✅ TSI (Transparent Socket Impersonation)
### Installation
```toml
[dependencies]
a3s-libkrun-sys = "${{ inputs.version }}"
```
### Requirements
- Windows 10/11 with Hyper-V Platform enabled
- Run: `Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform`
### Downloads
- Windows x86_64: See assets below
files: |
artifacts/*.zip
draft: false
prerelease: false