Skip to content

Commit a81de2a

Browse files
Sign the binary for windows
1 parent f8b5128 commit a81de2a

1 file changed

Lines changed: 55 additions & 1 deletion

File tree

.github/workflows/pack-pip.yaml

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
type: choice
99
default: None # no publishing to any Package Index by default
1010
options: [None, testpypi, pypi]
11+
signature-activation:
12+
type: boolean
13+
required: true
14+
default: false
15+
description: Sign khisto binary
1116
push:
1217
tags: ['*']
1318
pull_request:
@@ -23,6 +28,8 @@ concurrency:
2328
defaults:
2429
run:
2530
shell: bash
31+
env:
32+
KEYPAIR: KP_Khiops_HSM
2633

2734
jobs:
2835
build-wheel:
@@ -31,6 +38,8 @@ jobs:
3138
strategy:
3239
matrix:
3340
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2025-vs2026, windows-11-vs2026-arm, macos-15-intel, macos-15]
41+
env:
42+
SIGN_WINDOWS_WHEELS: ${{ github.event_name == 'workflow_dispatch' && inputs.signature-activation }}
3443
steps:
3544
- uses: actions/checkout@v6
3645

@@ -59,7 +68,52 @@ jobs:
5968
uv sync --python .test-env --group dev --no-install-project
6069
uv run --python .test-env pytest tests/ --no-cov
6170
62-
- uses: actions/upload-artifact@v6
71+
# Non-Windows wheels uploaded directly (no signing)
72+
- uses: actions/upload-artifact@v7
73+
if: runner.os != 'Windows'
74+
with:
75+
name: pkg-wheel-${{ matrix.os }}
76+
path: wheelhouse/*.whl
77+
if-no-files-found: error
78+
79+
# Windows wheels are unpackad, signed and repacked before uploading
80+
- name: Set SIGN_X64_WHEEL flag
81+
if: runner.os == 'Windows' && runner.arch == 'X64'
82+
run: echo "SIGN_X64_WHEEL=${{ env.SIGN_WINDOWS_WHEELS }}" >> "$GITHUB_ENV"
83+
- name: Warn smctl does not support ARM64 yet
84+
if: runner.os == 'Windows' && runner.arch == 'ARM64' && env.SIGN_WINDOWS_WHEELS == 'true'
85+
run: echo "::warning::smctl does not support ARM64 yet; the ARM64 wheel will not be signed"
86+
- name: Install wheel package for signing
87+
if: env.SIGN_X64_WHEEL == 'true'
88+
run: python -m pip install wheel
89+
- name: Unpack khisto wheel
90+
if: env.SIGN_X64_WHEEL == 'true'
91+
run: |
92+
mkdir -p wheelhouse/unpacked
93+
python -m wheel unpack wheelhouse/khisto-*.whl --dest wheelhouse/unpacked
94+
- name: Setup SM_CLIENT_CERT_FILE from base64 secret data
95+
if: env.SIGN_X64_WHEEL == 'true'
96+
run: |
97+
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
98+
echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
99+
- name: Sign unpacked wheel binaries
100+
if: env.SIGN_X64_WHEEL == 'true'
101+
uses: digicert/code-signing-software-trust-action@v1.2.1
102+
with:
103+
input: wheelhouse/unpacked/
104+
keypair-alias: ${{ env.KEYPAIR }}
105+
simple-signing-mode: true
106+
env:
107+
SM_HOST: ${{ secrets.SM_HOST }}
108+
SM_API_KEY: ${{ secrets.SM_API_KEY }}
109+
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
110+
- name: Repack signed wheels
111+
if: env.SIGN_X64_WHEEL == 'true'
112+
run: |
113+
rm wheelhouse/khisto-*.whl
114+
python -m wheel pack wheelhouse/unpacked/khisto-* --dest-dir wheelhouse
115+
- uses: actions/upload-artifact@v7
116+
if: runner.os == 'Windows'
63117
with:
64118
name: pkg-wheel-${{ matrix.os }}
65119
path: wheelhouse/*.whl

0 commit comments

Comments
 (0)