dcap-qvl 0.3.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. dcap_qvl-0.3.8/.github/PUBLISHING.md +172 -0
  2. dcap_qvl-0.3.8/.github/dependabot.yml +45 -0
  3. dcap_qvl-0.3.8/.github/workflows/publish-npm.yml +196 -0
  4. dcap_qvl-0.3.8/.github/workflows/python-wheels.yml +274 -0
  5. dcap_qvl-0.3.8/.github/workflows/release.yml +163 -0
  6. dcap_qvl-0.3.8/.github/workflows/rust.yml +56 -0
  7. dcap_qvl-0.3.8/.github/workflows/test-suite.yml +62 -0
  8. dcap_qvl-0.3.8/.gitignore +5 -0
  9. dcap_qvl-0.3.8/Cargo.lock +2782 -0
  10. dcap_qvl-0.3.8/Cargo.toml +112 -0
  11. dcap_qvl-0.3.8/LICENSE +21 -0
  12. dcap_qvl-0.3.8/Makefile +111 -0
  13. dcap_qvl-0.3.8/PKG-INFO +389 -0
  14. dcap_qvl-0.3.8/README.md +79 -0
  15. dcap_qvl-0.3.8/dcap-qvl-js/README.md +365 -0
  16. dcap_qvl-0.3.8/dcap-qvl-js/package-lock.json +292 -0
  17. dcap_qvl-0.3.8/dcap-qvl-js/package.json +55 -0
  18. dcap_qvl-0.3.8/dcap-qvl-js/src/TrustedRootCA.der +0 -0
  19. dcap_qvl-0.3.8/dcap-qvl-js/src/collateral.js +341 -0
  20. dcap_qvl-0.3.8/dcap-qvl-js/src/constants.js +165 -0
  21. dcap_qvl-0.3.8/dcap-qvl-js/src/crypto-compat.js +428 -0
  22. dcap_qvl-0.3.8/dcap-qvl-js/src/index.d.ts +467 -0
  23. dcap_qvl-0.3.8/dcap-qvl-js/src/index.js +41 -0
  24. dcap_qvl-0.3.8/dcap-qvl-js/src/intel.js +126 -0
  25. dcap_qvl-0.3.8/dcap-qvl-js/src/oids.js +24 -0
  26. dcap_qvl-0.3.8/dcap-qvl-js/src/qe_identity.js +71 -0
  27. dcap_qvl-0.3.8/dcap-qvl-js/src/quote.js +507 -0
  28. dcap_qvl-0.3.8/dcap-qvl-js/src/tcb_info.js +134 -0
  29. dcap_qvl-0.3.8/dcap-qvl-js/src/utils.js +393 -0
  30. dcap_qvl-0.3.8/dcap-qvl-js/src/verify.js +590 -0
  31. dcap_qvl-0.3.8/dcap-qvl-js/test_case.js +202 -0
  32. dcap_qvl-0.3.8/docs/README_Python.md +364 -0
  33. dcap_qvl-0.3.8/pyproject.toml +52 -0
  34. dcap_qvl-0.3.8/python/dcap_qvl/__init__.py +130 -0
  35. dcap_qvl-0.3.8/python/dcap_qvl/_dcap_qvl.pyi +328 -0
  36. dcap_qvl-0.3.8/python-bindings/.gitignore +71 -0
  37. dcap_qvl-0.3.8/python-bindings/.pre-commit-config.yaml +17 -0
  38. dcap_qvl-0.3.8/python-bindings/README.md +145 -0
  39. dcap_qvl-0.3.8/python-bindings/docs/BUILDING.md +157 -0
  40. dcap_qvl-0.3.8/python-bindings/docs/PYTHON_TESTING.md +209 -0
  41. dcap_qvl-0.3.8/python-bindings/docs/README_Python.md +364 -0
  42. dcap_qvl-0.3.8/python-bindings/examples/basic_test.py +67 -0
  43. dcap_qvl-0.3.8/python-bindings/examples/python_example.py +65 -0
  44. dcap_qvl-0.3.8/python-bindings/pyproject.toml +52 -0
  45. dcap_qvl-0.3.8/python-bindings/python/dcap_qvl/__init__.py +130 -0
  46. dcap_qvl-0.3.8/python-bindings/python/dcap_qvl/_dcap_qvl.pyi +328 -0
  47. dcap_qvl-0.3.8/python-bindings/scripts/build_wheels.py +264 -0
  48. dcap_qvl-0.3.8/python-bindings/scripts/build_wheels.sh +30 -0
  49. dcap_qvl-0.3.8/python-bindings/test_case.py +186 -0
  50. dcap_qvl-0.3.8/python-bindings/tests/test_all_async_functions.py +308 -0
  51. dcap_qvl-0.3.8/python-bindings/tests/test_async_collateral.py +122 -0
  52. dcap_qvl-0.3.8/python-bindings/tests/test_collateral_api.py +123 -0
  53. dcap_qvl-0.3.8/python-bindings/tests/test_cross_versions.sh +251 -0
  54. dcap_qvl-0.3.8/python-bindings/tests/test_installation.py +53 -0
  55. dcap_qvl-0.3.8/python-bindings/tests/test_python_bindings.py +106 -0
  56. dcap_qvl-0.3.8/python-bindings/tests/test_python_versions.sh +215 -0
  57. dcap_qvl-0.3.8/python-bindings/tests/test_with_samples.py +218 -0
  58. dcap_qvl-0.3.8/python-bindings/uv.lock +448 -0
  59. dcap_qvl-0.3.8/sample/quote-from-tappd.hex +1 -0
  60. dcap_qvl-0.3.8/sample/sgx_quote +0 -0
  61. dcap_qvl-0.3.8/sample/sgx_quote_collateral.json +11 -0
  62. dcap_qvl-0.3.8/sample/tdx-quote.hex +1 -0
  63. dcap_qvl-0.3.8/sample/tdx_quote +0 -0
  64. dcap_qvl-0.3.8/sample/tdx_quote_collateral.json +11 -0
  65. dcap_qvl-0.3.8/src/TrustedRootCA.der +0 -0
  66. dcap_qvl-0.3.8/src/collateral.rs +713 -0
  67. dcap_qvl-0.3.8/src/constants.rs +108 -0
  68. dcap_qvl-0.3.8/src/intel.rs +123 -0
  69. dcap_qvl-0.3.8/src/lib.rs +103 -0
  70. dcap_qvl-0.3.8/src/oids.rs +15 -0
  71. dcap_qvl-0.3.8/src/python.rs +260 -0
  72. dcap_qvl-0.3.8/src/qe_identity.rs +61 -0
  73. dcap_qvl-0.3.8/src/quote.rs +745 -0
  74. dcap_qvl-0.3.8/src/tcb_info.rs +185 -0
  75. dcap_qvl-0.3.8/src/trust-chain.txt +48 -0
  76. dcap_qvl-0.3.8/src/utils.rs +190 -0
  77. dcap_qvl-0.3.8/src/verify.rs +1051 -0
  78. dcap_qvl-0.3.8/test_suite.sh +6 -0
  79. dcap_qvl-0.3.8/tests/esbuild/.gitignore +24 -0
  80. dcap_qvl-0.3.8/tests/esbuild/README.md +10 -0
  81. dcap_qvl-0.3.8/tests/esbuild/package.json +16 -0
  82. dcap_qvl-0.3.8/tests/esbuild/pnpm-lock.yaml +264 -0
  83. dcap_qvl-0.3.8/tests/esbuild/src/global.d.ts +2 -0
  84. dcap_qvl-0.3.8/tests/esbuild/src/index.html +12 -0
  85. dcap_qvl-0.3.8/tests/esbuild/src/main.ts +35 -0
  86. dcap_qvl-0.3.8/tests/esbuild/src/sample/tdx_quote +0 -0
  87. dcap_qvl-0.3.8/tests/esbuild/tsconfig.json +13 -0
  88. dcap_qvl-0.3.8/tests/generate_test_certs.sh +119 -0
  89. dcap_qvl-0.3.8/tests/js/.gitignore +2 -0
  90. dcap_qvl-0.3.8/tests/js/README.md +48 -0
  91. dcap_qvl-0.3.8/tests/js/TEST_WEB.md +50 -0
  92. dcap_qvl-0.3.8/tests/js/get_collateral_node.js +24 -0
  93. dcap_qvl-0.3.8/tests/js/get_collateral_web.html +12 -0
  94. dcap_qvl-0.3.8/tests/js/get_collateral_web.js +31 -0
  95. dcap_qvl-0.3.8/tests/js/index.html +12 -0
  96. dcap_qvl-0.3.8/tests/js/verify_quote_node.js +33 -0
  97. dcap_qvl-0.3.8/tests/js/verify_quote_web.js +43 -0
  98. dcap_qvl-0.3.8/tests/js/verify_quote_web_test.html +21 -0
  99. dcap_qvl-0.3.8/tests/js/verify_quote_web_test.js +528 -0
  100. dcap_qvl-0.3.8/tests/snapshots/verify_quote__could_parse_sgx_quote.snap +1084 -0
  101. dcap_qvl-0.3.8/tests/snapshots/verify_quote__could_parse_tdx_quote.snap +1307 -0
  102. dcap_qvl-0.3.8/tests/test_case.js +183 -0
  103. dcap_qvl-0.3.8/tests/test_suite.sh +629 -0
  104. dcap_qvl-0.3.8/tests/test_web.sh +346 -0
  105. dcap_qvl-0.3.8/tests/verify_quote.rs +88 -0
  106. dcap_qvl-0.3.8/tests/vite/.gitignore +24 -0
  107. dcap_qvl-0.3.8/tests/vite/README.md +10 -0
  108. dcap_qvl-0.3.8/tests/vite/index.html +13 -0
  109. dcap_qvl-0.3.8/tests/vite/package.json +18 -0
  110. dcap_qvl-0.3.8/tests/vite/pnpm-lock.yaml +604 -0
  111. dcap_qvl-0.3.8/tests/vite/public/sample/tdx_quote +0 -0
  112. dcap_qvl-0.3.8/tests/vite/src/main.ts +41 -0
  113. dcap_qvl-0.3.8/tests/vite/src/style.css +96 -0
  114. dcap_qvl-0.3.8/tests/vite/src/vite-env.d.ts +1 -0
  115. dcap_qvl-0.3.8/tests/vite/tsconfig.json +25 -0
  116. dcap_qvl-0.3.8/tests/vite/vite.config.ts +5 -0
@@ -0,0 +1,172 @@
1
+ # Publishing Guide
2
+
3
+ This document explains how to publish dcap-qvl to various package repositories.
4
+
5
+ ## Python Package (PyPI)
6
+
7
+ ### Automated Publishing
8
+
9
+ The project includes GitHub Actions workflows for automated publishing:
10
+
11
+ #### 1. Via Git Tags (Automatic)
12
+ When you push a git tag starting with `v`, the `python-wheels.yml` workflow automatically:
13
+ - Builds wheels for all supported platforms
14
+ - Publishes to PyPI if the tag matches a version
15
+
16
+ ```bash
17
+ git tag v0.3.1
18
+ git push origin v0.3.1
19
+ ```
20
+
21
+ #### 2. Manual Publishing
22
+ Use the `publish-pypi.yml` workflow for manual control:
23
+
24
+ 1. Go to GitHub Actions → "Publish to PyPI"
25
+ 2. Click "Run workflow"
26
+ 3. Choose environment (testpypi or pypi)
27
+ 4. Optionally specify version
28
+ 5. Click "Run workflow"
29
+
30
+ ### Supported Platforms
31
+
32
+ The automated builds create wheels for:
33
+
34
+ **Linux (manylinux)**:
35
+ - x86_64
36
+ - x86 (32-bit)
37
+ - aarch64 (ARM64)
38
+
39
+ **Windows**:
40
+ - x64 (64-bit)
41
+ - x86 (32-bit)
42
+
43
+ **macOS**:
44
+ - x86_64 (Intel)
45
+ - aarch64 (Apple Silicon)
46
+
47
+ ### ABI3 Compatibility
48
+
49
+ All wheels are built with abi3 (stable ABI) enabled, meaning:
50
+ - One wheel works across multiple Python versions (3.8+)
51
+ - Smaller distribution size
52
+ - Better compatibility
53
+
54
+ ### Test Before Publishing
55
+
56
+ 1. **Test on TestPyPI first**:
57
+ ```bash
58
+ # Use the manual workflow with environment: testpypi
59
+ pip install -i https://test.pypi.org/simple/ dcap-qvl
60
+ ```
61
+
62
+ 2. **Local testing**:
63
+ ```bash
64
+ cd python-bindings
65
+ ./tests/test_python_versions.sh
66
+ ```
67
+
68
+ ## Rust Crate (crates.io)
69
+
70
+ ### Automated Publishing
71
+
72
+ When you create a git tag, the `release.yml` workflow automatically publishes to crates.io.
73
+
74
+ ### Manual Publishing
75
+
76
+ ```bash
77
+ # Main library
78
+ cargo publish
79
+
80
+ # CLI tool
81
+ cd cli
82
+ cargo publish
83
+ ```
84
+
85
+ ## GitHub Releases
86
+
87
+ The `release.yml` workflow automatically creates GitHub releases with:
88
+ - Pre-built CLI binaries for multiple platforms
89
+ - Changelog generated from git commits
90
+ - Links to PyPI and crates.io packages
91
+
92
+ ## Environment Setup
93
+
94
+ ### Required Secrets
95
+
96
+ Configure these secrets in your GitHub repository:
97
+
98
+ 1. **CRATES_IO_TOKEN**: Token for publishing to crates.io
99
+ - Get from https://crates.io/settings/tokens
100
+ - Add to repository secrets
101
+
102
+ 2. **PyPI Publishing**: Uses OpenID Connect (no token needed)
103
+ - Configured with `id-token: write` permission
104
+ - Uses trusted publishing via GitHub Actions
105
+
106
+ ### Environments
107
+
108
+ Set up these GitHub Environments for PyPI publishing:
109
+
110
+ 1. **testpypi**: For testing releases
111
+ - URL: https://test.pypi.org/p/dcap-qvl
112
+ - Protection rules: None
113
+
114
+ 2. **pypi**: For production releases
115
+ - URL: https://pypi.org/p/dcap-qvl
116
+ - Protection rules: Required reviewers, deployment branches
117
+
118
+ ## Version Management
119
+
120
+ ### Python Package Version
121
+
122
+ Update version in `python-bindings/pyproject.toml`:
123
+ ```toml
124
+ [project]
125
+ version = "0.3.1"
126
+ ```
127
+
128
+ ### Rust Crate Version
129
+
130
+ Update version in root `Cargo.toml`:
131
+ ```toml
132
+ [package]
133
+ version = "0.3.1"
134
+ ```
135
+
136
+ ### CLI Version
137
+
138
+ Update version in `cli/Cargo.toml`:
139
+ ```toml
140
+ [package]
141
+ version = "0.3.1"
142
+ ```
143
+
144
+ ## Troubleshooting
145
+
146
+ ### Build Failures
147
+
148
+ 1. **Cross-compilation issues**: Check the maturin-action logs
149
+ 2. **Missing dependencies**: Ensure all features are properly configured
150
+ 3. **Test failures**: Run tests locally first
151
+
152
+ ### Publishing Issues
153
+
154
+ 1. **Duplicate version**: Use `skip-existing: true` in workflows
155
+ 2. **Permission denied**: Check GitHub environment protection rules
156
+ 3. **Missing wheels**: Verify all build jobs completed successfully
157
+
158
+ ### Testing Issues
159
+
160
+ 1. **Import errors**: Check that the wheel is compatible with the test environment
161
+ 2. **Async function failures**: Ensure tokio runtime is properly configured
162
+ 3. **ABI compatibility**: Test with multiple Python versions locally
163
+
164
+ ## Best Practices
165
+
166
+ 1. **Always test on TestPyPI first**
167
+ 2. **Use semantic versioning**
168
+ 3. **Update all version numbers consistently**
169
+ 4. **Test locally before pushing tags**
170
+ 5. **Review the generated changelog before release**
171
+ 6. **Monitor PyPI download statistics**
172
+ 7. **Keep dependencies up to date with Dependabot**
@@ -0,0 +1,45 @@
1
+ version: 2
2
+ updates:
3
+ # Rust dependencies
4
+ - package-ecosystem: "cargo"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+ open-pull-requests-limit: 10
9
+ groups:
10
+ rust-dependencies:
11
+ patterns:
12
+ - "*"
13
+
14
+ # Rust CLI dependencies
15
+ - package-ecosystem: "cargo"
16
+ directory: "/cli"
17
+ schedule:
18
+ interval: "weekly"
19
+ open-pull-requests-limit: 5
20
+ groups:
21
+ cli-dependencies:
22
+ patterns:
23
+ - "*"
24
+
25
+ # Python dependencies in python-bindings
26
+ - package-ecosystem: "pip"
27
+ directory: "/python-bindings"
28
+ schedule:
29
+ interval: "weekly"
30
+ open-pull-requests-limit: 5
31
+ groups:
32
+ python-dependencies:
33
+ patterns:
34
+ - "*"
35
+
36
+ # GitHub Actions
37
+ - package-ecosystem: "github-actions"
38
+ directory: "/"
39
+ schedule:
40
+ interval: "weekly"
41
+ open-pull-requests-limit: 5
42
+ groups:
43
+ github-actions:
44
+ patterns:
45
+ - "*"
@@ -0,0 +1,196 @@
1
+ name: Publish npm Package
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "npm-v*" # Trigger on tags like npm-v0.0.1
7
+ workflow_dispatch:
8
+ inputs:
9
+ version:
10
+ description: "Version to publish (e.g., 0.0.1, leave empty to use package.json)"
11
+ required: false
12
+ type: string
13
+ npm_tag:
14
+ description: "npm dist-tag (latest, beta, alpha, etc.)"
15
+ required: false
16
+ type: string
17
+ default: "beta"
18
+ dry_run:
19
+ description: "Dry run (test without actually publishing)"
20
+ required: false
21
+ type: boolean
22
+ default: false
23
+
24
+ permissions:
25
+ id-token: write # Required for OIDC
26
+ contents: write # Required to commit version changes
27
+
28
+ jobs:
29
+ publish-npm:
30
+ name: Publish to npm
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - name: Checkout code
34
+ uses: actions/checkout@v6
35
+
36
+ - name: Determine npm tag and version
37
+ id: npm-meta
38
+ run: |
39
+ if [[ "${{ github.event_name }}" == "push" ]]; then
40
+ # Tag push: npm-v0.1.0 -> version=0.1.0, npm_tag=latest
41
+ NPM_TAG="latest"
42
+ VERSION=${GITHUB_REF#refs/tags/npm-v}
43
+ UPDATE_VERSION="true" # Update package.json to match tag
44
+ COMMIT_VERSION="true" # Commit back to keep repository in sync
45
+ echo "Triggered by tag push: npm-v$VERSION"
46
+ else
47
+ # Manual dispatch
48
+ NPM_TAG="${{ github.event.inputs.npm_tag || 'beta' }}"
49
+ if [[ -n "${{ github.event.inputs.version }}" ]]; then
50
+ # User specified version
51
+ VERSION="${{ github.event.inputs.version }}"
52
+ UPDATE_VERSION="true"
53
+ COMMIT_VERSION="true" # Commit version changes
54
+ echo "Triggered by workflow_dispatch with version=$VERSION, npm_tag=$NPM_TAG"
55
+ else
56
+ # Use version from package.json
57
+ VERSION=$(node -e "console.log(require('./dcap-qvl-js/package.json').version)")
58
+ UPDATE_VERSION="false"
59
+ COMMIT_VERSION="false"
60
+ echo "Triggered by workflow_dispatch using package.json version=$VERSION, npm_tag=$NPM_TAG"
61
+ fi
62
+ fi
63
+ echo "npm_tag=$NPM_TAG" >> $GITHUB_OUTPUT
64
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
65
+ echo "update_version=$UPDATE_VERSION" >> $GITHUB_OUTPUT
66
+ echo "commit_version=$COMMIT_VERSION" >> $GITHUB_OUTPUT
67
+ echo "dry_run=${{ github.event.inputs.dry_run || 'false' }}" >> $GITHUB_OUTPUT
68
+
69
+ - name: Setup Node.js
70
+ uses: actions/setup-node@v6
71
+ with:
72
+ node-version: '20'
73
+ registry-url: 'https://registry.npmjs.org'
74
+
75
+ - name: Upgrade npm for OIDC support
76
+ run: |
77
+ npm install -g npm@latest
78
+ echo "npm version: $(npm --version)"
79
+
80
+ - name: Verify OIDC token availability
81
+ run: |
82
+ if [ -n "${ACTIONS_ID_TOKEN_REQUEST_URL}" ] && [ -n "${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" ]; then
83
+ echo "✓ OIDC token available"
84
+ echo "Endpoint: ${ACTIONS_ID_TOKEN_REQUEST_URL}"
85
+ else
86
+ echo "✗ OIDC token NOT available"
87
+ echo "Check workflow permissions include 'id-token: write'"
88
+ exit 1
89
+ fi
90
+
91
+ - name: Verify repository configuration
92
+ run: |
93
+ echo "Checking repository consistency..."
94
+ GIT_REPO=$(git remote get-url origin | sed 's/.*github.com[/:]//; s/.git$//')
95
+ PKG_REPO=$(node -e "console.log(require('./dcap-qvl-js/package.json').repository?.url || '')" | sed 's|https://github.com/||; s|git+||; s|.git$||')
96
+
97
+ echo "Git remote: $GIT_REPO"
98
+ echo "package.json: $PKG_REPO"
99
+
100
+ if [ "$GIT_REPO" != "$PKG_REPO" ]; then
101
+ echo "✗ Repository mismatch!"
102
+ echo "This will cause 422 error during publish"
103
+ exit 1
104
+ fi
105
+ echo "✓ Repositories match"
106
+
107
+ - name: Display package information
108
+ run: |
109
+ cd dcap-qvl-js
110
+ PKG_NAME=$(node -e "console.log(require('./package.json').name)")
111
+ PKG_VERSION=$(node -e "console.log(require('./package.json').version)")
112
+ echo "Package: $PKG_NAME"
113
+ echo "Version: $PKG_VERSION"
114
+ echo "npm tag: ${{ steps.npm-meta.outputs.npm_tag }}"
115
+ echo "Dry run: ${{ steps.npm-meta.outputs.dry_run }}"
116
+ echo "Trigger: ${{ github.event_name }}"
117
+
118
+ - name: Install dependencies
119
+ working-directory: dcap-qvl-js
120
+ run: npm ci
121
+
122
+ - name: Update package version
123
+ if: steps.npm-meta.outputs.update_version == 'true'
124
+ working-directory: dcap-qvl-js
125
+ run: |
126
+ VERSION="${{ steps.npm-meta.outputs.version }}"
127
+ echo "Updating package.json version to $VERSION"
128
+ npm version "$VERSION" --no-git-tag-version
129
+ echo "Updated version:"
130
+ node -e "console.log(require('./package.json').version)"
131
+
132
+ - name: Publish to npm (Dry Run)
133
+ if: steps.npm-meta.outputs.dry_run == 'true'
134
+ working-directory: dcap-qvl-js
135
+ run: |
136
+ NPM_TAG="${{ steps.npm-meta.outputs.npm_tag }}"
137
+ echo "🔍 Dry run mode - simulating publish with tag: $NPM_TAG"
138
+ npm publish --access public --tag "$NPM_TAG" --provenance --dry-run --verbose
139
+
140
+ - name: Publish to npm
141
+ if: steps.npm-meta.outputs.dry_run != 'true'
142
+ working-directory: dcap-qvl-js
143
+ run: |
144
+ NPM_TAG="${{ steps.npm-meta.outputs.npm_tag }}"
145
+ echo "Publishing @phala/dcap-qvl with tag: $NPM_TAG"
146
+ npm publish --access public --tag "$NPM_TAG" --provenance --verbose
147
+
148
+ - name: Publish summary
149
+ if: success() && steps.npm-meta.outputs.dry_run != 'true'
150
+ run: |
151
+ PKG_NAME=$(node -e "console.log(require('./dcap-qvl-js/package.json').name)")
152
+ PKG_VERSION=$(node -e "console.log(require('./dcap-qvl-js/package.json').version)")
153
+ NPM_TAG="${{ steps.npm-meta.outputs.npm_tag }}"
154
+ echo ""
155
+ echo "================================"
156
+ echo "✓ Published Successfully!"
157
+ echo "================================"
158
+ echo "Package: $PKG_NAME@$PKG_VERSION"
159
+ echo "npm tag: $NPM_TAG"
160
+ echo ""
161
+ echo "Install with:"
162
+ echo " npm install $PKG_NAME@$NPM_TAG"
163
+ echo ""
164
+ echo "View on npm:"
165
+ echo " https://www.npmjs.com/package/$PKG_NAME"
166
+ echo "================================"
167
+
168
+ - name: Commit version changes
169
+ if: success() && steps.npm-meta.outputs.commit_version == 'true' && steps.npm-meta.outputs.dry_run != 'true'
170
+ run: |
171
+ VERSION="${{ steps.npm-meta.outputs.version }}"
172
+
173
+ # Configure git
174
+ git config user.name "github-actions[bot]"
175
+ git config user.email "github-actions[bot]@users.noreply.github.com"
176
+
177
+ # Determine target branch
178
+ if [[ "${{ github.event_name }}" == "push" ]]; then
179
+ # For tag push, get the default branch
180
+ DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch" | cut -d ":" -f 2 | xargs)
181
+ echo "Detected default branch: $DEFAULT_BRANCH"
182
+ # Switch to the default branch
183
+ git fetch origin "$DEFAULT_BRANCH"
184
+ git checkout "$DEFAULT_BRANCH"
185
+ else
186
+ # For workflow_dispatch, we're already on a branch
187
+ CURRENT_BRANCH=$(git branch --show-current)
188
+ echo "Current branch: $CURRENT_BRANCH"
189
+ fi
190
+
191
+ # Commit and push
192
+ git add dcap-qvl-js/package.json dcap-qvl-js/package-lock.json
193
+ git commit -m "chore(npm): bump version to $VERSION" \
194
+ -m "Published @phala/dcap-qvl@$VERSION to npm" \
195
+ -m "Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
196
+ git push
@@ -0,0 +1,274 @@
1
+ name: Build and Publish Python Wheels
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ branches:
8
+ - "python-bindings" # For testing
9
+ workflow_dispatch:
10
+ inputs:
11
+ version:
12
+ description: 'Version to publish (e.g., 0.3.5). Leave empty to use version from Cargo.toml'
13
+ required: false
14
+ type: string
15
+ publish_target:
16
+ description: 'Where to publish'
17
+ required: true
18
+ type: choice
19
+ options:
20
+ - none
21
+ - testpypi
22
+ - pypi
23
+ default: 'none'
24
+
25
+ env:
26
+ CARGO_TERM_COLOR: always
27
+
28
+ jobs:
29
+ build-wheels:
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v6
33
+ - name: Override version if specified
34
+ if: github.event.inputs.version != ''
35
+ run: |
36
+ sed -i 's/^version = "[^"]*"/version = "${{ github.event.inputs.version }}"/' Cargo.toml
37
+ echo "Updated Cargo.toml version to ${{ github.event.inputs.version }}"
38
+ grep '^version' Cargo.toml
39
+ - name: Install uv
40
+ uses: astral-sh/setup-uv@v7
41
+ - name: Setup Python 3.8
42
+ run: uv python install 3.8
43
+ - uses: actions-rs/toolchain@v1
44
+ with:
45
+ profile: minimal
46
+ toolchain: stable
47
+ override: true
48
+ components: rustfmt, clippy
49
+ - name: Install Zig
50
+ run: |
51
+ curl -L https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz | tar -xJ
52
+ sudo mv zig-linux-x86_64-0.13.0 /opt/zig
53
+ sudo ln -sf /opt/zig/zig /usr/local/bin/zig
54
+ zig version
55
+ - name: Build Linux and macOS wheels with Zig
56
+ working-directory: python-bindings
57
+ run: |
58
+ uv sync
59
+ uv run python scripts/build_wheels.py \
60
+ --platforms linux-x86_64 linux-aarch64 linux-x86_64-musl linux-aarch64-musl macos-aarch64 \
61
+ --zig \
62
+ --install-targets \
63
+ --output-dir dist
64
+ - name: Upload wheels
65
+ uses: actions/upload-artifact@v6
66
+ with:
67
+ name: wheels-cross
68
+ path: python-bindings/dist
69
+
70
+ # Windows build using native runner
71
+ windows:
72
+ runs-on: windows-latest
73
+ env:
74
+ PYTHONIOENCODING: "utf-8"
75
+ PYTHONUTF8: "1"
76
+ steps:
77
+ - uses: actions/checkout@v6
78
+ - name: Override version if specified
79
+ if: github.event.inputs.version != ''
80
+ shell: bash
81
+ run: |
82
+ sed -i 's/^version = "[^"]*"/version = "${{ github.event.inputs.version }}"/' Cargo.toml
83
+ echo "Updated Cargo.toml version to ${{ github.event.inputs.version }}"
84
+ grep '^version' Cargo.toml
85
+ - name: Install uv
86
+ uses: astral-sh/setup-uv@v7
87
+ - name: Setup Python 3.8
88
+ run: uv python install 3.8
89
+ - uses: actions-rs/toolchain@v1
90
+ with:
91
+ profile: minimal
92
+ toolchain: stable
93
+ override: true
94
+ components: rustfmt, clippy
95
+ - name: Build Windows wheel
96
+ working-directory: python-bindings
97
+ run: |
98
+ uv sync
99
+ uv run python scripts/build_wheels.py --platforms windows-x64 --install-targets --output-dir dist
100
+ - name: Upload wheels
101
+ uses: actions/upload-artifact@v6
102
+ with:
103
+ name: wheels-windows
104
+ path: python-bindings/dist
105
+
106
+ # macOS Intel build using native runner (Zig cross-compilation has issues)
107
+ macos-intel:
108
+ runs-on: macos-15-intel # Intel runner
109
+ steps:
110
+ - uses: actions/checkout@v6
111
+ - name: Override version if specified
112
+ if: github.event.inputs.version != ''
113
+ run: |
114
+ sed -i '' 's/^version = "[^"]*"/version = "${{ github.event.inputs.version }}"/' Cargo.toml
115
+ echo "Updated Cargo.toml version to ${{ github.event.inputs.version }}"
116
+ grep '^version' Cargo.toml
117
+ - name: Install uv
118
+ uses: astral-sh/setup-uv@v7
119
+ - name: Setup Python 3.8
120
+ run: uv python install 3.8
121
+ - uses: actions-rs/toolchain@v1
122
+ with:
123
+ profile: minimal
124
+ toolchain: stable
125
+ override: true
126
+ components: rustfmt, clippy
127
+ - name: Build wheel natively
128
+ working-directory: python-bindings
129
+ run: |
130
+ uv sync
131
+ uv run python scripts/build_wheels.py \
132
+ --platforms macos-x86_64 \
133
+ --install-targets \
134
+ --output-dir dist
135
+ - name: Upload wheels
136
+ uses: actions/upload-artifact@v6
137
+ with:
138
+ name: wheels-macos-x86_64
139
+ path: python-bindings/dist
140
+
141
+ sdist:
142
+ runs-on: ubuntu-latest
143
+ steps:
144
+ - uses: actions/checkout@v6
145
+ - name: Override version if specified
146
+ if: github.event.inputs.version != ''
147
+ run: |
148
+ sed -i 's/^version = "[^"]*"/version = "${{ github.event.inputs.version }}"/' Cargo.toml
149
+ echo "Updated Cargo.toml version to ${{ github.event.inputs.version }}"
150
+ grep '^version' Cargo.toml
151
+ - uses: actions-rs/toolchain@v1
152
+ with:
153
+ profile: minimal
154
+ toolchain: stable
155
+ override: true
156
+ components: rustfmt, clippy
157
+ - name: Build source distribution
158
+ uses: PyO3/maturin-action@v1
159
+ with:
160
+ command: sdist
161
+ args: --out dist
162
+ working-directory: python-bindings
163
+ - name: Upload source distribution
164
+ uses: actions/upload-artifact@v6
165
+ with:
166
+ name: wheels-sdist
167
+ path: python-bindings/dist
168
+
169
+ release:
170
+ name: Release
171
+ runs-on: ubuntu-latest
172
+ if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_target == 'pypi')
173
+ needs: [build-wheels, windows, macos-intel, sdist]
174
+ environment:
175
+ name: pypi
176
+ url: https://pypi.org/p/dcap-qvl
177
+ permissions:
178
+ id-token: write
179
+ steps:
180
+ - name: Download all artifacts
181
+ uses: actions/download-artifact@v7
182
+ with:
183
+ pattern: wheels-*
184
+ merge-multiple: true
185
+ path: dist
186
+ - name: List artifacts
187
+ run: ls -la dist/
188
+ - name: Publish to PyPI
189
+ uses: pypa/gh-action-pypi-publish@release/v1
190
+ with:
191
+ skip-existing: true
192
+ verbose: true
193
+
194
+ test-release:
195
+ name: Test Release
196
+ runs-on: ubuntu-latest
197
+ if: (github.event_name == 'push' && github.ref == 'refs/heads/python-bindings') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_target == 'testpypi')
198
+ needs: [build-wheels, windows, macos-intel, sdist]
199
+ environment:
200
+ name: testpypi
201
+ url: https://test.pypi.org/p/dcap-qvl
202
+ permissions:
203
+ id-token: write
204
+ steps:
205
+ - name: Download all artifacts
206
+ uses: actions/download-artifact@v7
207
+ with:
208
+ pattern: wheels-*
209
+ merge-multiple: true
210
+ path: dist
211
+ - name: List artifacts
212
+ run: ls -la dist/
213
+ - name: Publish to TestPyPI
214
+ uses: pypa/gh-action-pypi-publish@release/v1
215
+ with:
216
+ repository-url: https://test.pypi.org/legacy/
217
+ skip-existing: true
218
+ verbose: true
219
+
220
+ test-wheels:
221
+ name: Test Wheels
222
+ runs-on: ${{ matrix.os }}
223
+ needs: [build-wheels, windows, macos-intel]
224
+ if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/')
225
+ strategy:
226
+ matrix:
227
+ os: [ubuntu-latest, windows-latest, macos-latest]
228
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
229
+ exclude:
230
+ # Skip some combinations to reduce CI time
231
+ - os: windows-latest
232
+ python-version: "3.9"
233
+ - os: macos-latest
234
+ python-version: "3.9"
235
+ steps:
236
+ - uses: actions/checkout@v6
237
+ - name: Install uv
238
+ uses: astral-sh/setup-uv@v7
239
+ - name: Setup Python ${{ matrix.python-version }}
240
+ run: uv venv --python ${{ matrix.python-version }}
241
+ - name: Download wheels
242
+ uses: actions/download-artifact@v7
243
+ with:
244
+ pattern: wheels-*
245
+ merge-multiple: true
246
+ path: dist
247
+ - name: Find and install wheel
248
+ shell: bash
249
+ run: |
250
+ # Find the appropriate wheel for this platform and Python version
251
+ if [[ "${{ runner.os }}" == "Linux" ]]; then
252
+ WHEEL=$(find dist -name "*manylinux_*_x86_64*.whl" | head -n1)
253
+ elif [[ "${{ runner.os }}" == "Windows" ]]; then
254
+ WHEEL=$(find dist -name "*win_amd64*.whl" | head -n1)
255
+ elif [[ "${{ runner.os }}" == "macOS" ]]; then
256
+ if [[ "$(uname -m)" == "arm64" ]]; then
257
+ WHEEL=$(find dist -name "*macosx*arm64*.whl" | head -n1)
258
+ else
259
+ WHEEL=$(find dist -name "*macosx*x86_64*.whl" | head -n1)
260
+ fi
261
+ fi
262
+
263
+ if [[ -n "$WHEEL" ]]; then
264
+ echo "Installing wheel: $WHEEL"
265
+ uv pip install "$WHEEL"
266
+ else
267
+ echo "No suitable wheel found, installing from source"
268
+ cd python-bindings
269
+ uv add maturin
270
+ uv run maturin develop --features python
271
+ fi
272
+ - name: Test installation
273
+ working-directory: python-bindings
274
+ run: uv run python tests/test_installation.py