Skip to content

Commit a826bd9

Browse files
Add Cosign (#184)
1 parent 08db5c5 commit a826bd9

File tree

7 files changed

+44
-13
lines changed

7 files changed

+44
-13
lines changed

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
packages: read
5353
statuses: read
5454
security-events: write
55+
id-token: write
5556
with:
5657
os: ubuntu_24_04
5758
build-runner: ubuntu-latest-32-cores

.github/workflows/job_build_cid.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
contents: read
9393
packages: read
9494
statuses: read
95+
id-token: write
9596
outputs:
9697
build-package: ${{ steps.set-build-package-name.outputs.build-package }}
9798
env:
@@ -109,11 +110,7 @@ jobs:
109110
run: |
110111
echo "Event name: ${{ github.event_name }}"
111112
echo "Full event payload:"
112-
echo '${{ toJson(github.event) }}' | jq .
113-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
114-
echo "Workflow dispatch inputs:"
115-
echo '${{ toJson(github.event.inputs) }}' | jq .
116-
fi
113+
jq . "$GITHUB_EVENT_PATH"
117114
118115
- name: Prepare artifact dir
119116
run: |
@@ -158,7 +155,7 @@ jobs:
158155
BASE_PREFIX="${{ steps.package-params.outputs.package-prefix }}"
159156
PLATFORM="${{ steps.package-params.outputs.package-platform-tag }}"
160157
VERSION="${{ steps.versions.outputs.npu-compiler-version }}"
161-
EXTENSION=${{ steps.package-params.outputs.package-extension }}
158+
EXTENSION="${{ steps.package-params.outputs.package-extension }}"
162159
163160
cid_package_base_name="${BASE_PREFIX}_vpux_compiler_l0_${PLATFORM}-${VERSION}-${CMAKE_BUILD_TYPE}"
164161
cid_package_base_name+="_dyntbb_${CI_CONTEXT}_cid_${{ github.sha }}_${TIME_STAMP}"
@@ -215,7 +212,7 @@ jobs:
215212
- name: Install python deps
216213
if: ${{ !steps.cache-restore.outputs.cache-hit }}
217214
run: |
218-
python -m pip install --require-hashes -r ${NPU_COMPILER_REPO}/.github/requirements-dev.txt
215+
python -m pip install --require-hashes -r "${NPU_COMPILER_REPO}/.github/requirements-dev.txt"
219216
220217
- name: Setup MSVC env (x64)
221218
if: ${{ !steps.cache-restore.outputs.cache-hit && env.IS_WINDOWS == '1' }}
@@ -245,7 +242,7 @@ jobs:
245242
run: |
246243
cmake \
247244
-G Ninja \
248-
-D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
245+
-D CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
249246
-D BUILD_SHARED_LIBS=OFF \
250247
-D OPENVINO_EXTRA_MODULES=$(realpath ${NPU_COMPILER_REPO}) \
251248
-D ENABLE_LTO=OFF \
@@ -293,9 +290,9 @@ jobs:
293290
if: ${{ !steps.cache-restore.outputs.cache-hit }}
294291
run: |
295292
cmake \
296-
--build ${OPENVINO_BUILD_DIR} \
293+
--build "${OPENVINO_BUILD_DIR}" \
297294
--parallel \
298-
--config ${CMAKE_BUILD_TYPE} \
295+
--config "${CMAKE_BUILD_TYPE}" \
299296
--target npu_driver_compiler compilerTest profilingTest vpuxCompilerL0Test loaderTest
300297
301298
- name: CMake cpack - CiD target
@@ -325,14 +322,30 @@ jobs:
325322
- name: Upload CiD package
326323
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
327324
with:
328-
path: ${{ env.CID_PACKAGE_ARTIFACTS_DIR }}/${{ steps.package-name.outputs.cid-package-full-name }}
329325
name: ${{ steps.package-name.outputs.cid-package-full-name }}
326+
path: |
327+
${{ env.CID_PACKAGE_ARTIFACTS_DIR }}/${{ steps.package-name.outputs.cid-package-full-name }}
330328
331329
- name: Set build package name to outputs
332330
id: set-build-package-name
333331
run: |
334332
echo "build-package=${{ steps.package-name.outputs.cid-package-full-name }}" >> $GITHUB_OUTPUT
335333
334+
- name: Install cosign
335+
if: ${{ github.event_name != 'pull_request' && inputs.publish-release-assets }}
336+
uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10.0
337+
338+
- name: Sign CiD package with cosign
339+
if: ${{ github.event_name != 'pull_request' && inputs.publish-release-assets }}
340+
env:
341+
ARCHIVE: ${{ env.CID_PACKAGE_ARTIFACTS_DIR }}/${{ steps.package-name.outputs.cid-package-full-name }}
342+
run: |
343+
cosign sign-blob \
344+
--yes \
345+
--output-signature "${ARCHIVE}.sig" \
346+
--output-certificate "${ARCHIVE}.pem" \
347+
"${ARCHIVE}"
348+
336349
- name: Upload asset to existing release tag
337350
if: ${{ github.event_name != 'pull_request' && inputs.publish-release-assets }}
338351
env:
@@ -341,6 +354,8 @@ jobs:
341354
NPU_TAG="${{ steps.versions.outputs.npu-compiler-tag }}"
342355
NPU_REPO="${{ steps.versions.outputs.npu-compiler-repository }}"
343356
CID_ASSET="${CID_PACKAGE_ARTIFACTS_DIR}/${{ steps.package-name.outputs.cid-package-full-name }}"
357+
CID_SIG="${CID_ASSET}.sig"
358+
CID_CERT="${CID_ASSET}.pem"
344359
345-
gh release upload "$NPU_TAG" "$CID_ASSET" --clobber --repo "$NPU_REPO"
346-
echo "Uploaded $CID_ASSET to release $NPU_TAG"
360+
gh release upload "$NPU_TAG" "$CID_ASSET" "$CID_SIG" "$CID_CERT" --clobber --repo "$NPU_REPO"
361+
echo "Uploaded $CID_ASSET with $CID_SIG and $CID_CERT to release $NPU_TAG"

.github/workflows/job_linux.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ jobs:
120120
name: CiD / Build
121121
if: ${{ inputs.build-cid }}
122122
uses: ./.github/workflows/job_build_cid.yml
123+
permissions:
124+
actions: read
125+
contents: read
126+
packages: read
127+
statuses: read
128+
id-token: write
123129
with:
124130
os: ${{ inputs.os }}
125131
build-runner: ${{ inputs.build-runner }}

.github/workflows/job_windows.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ jobs:
5151
name: CiD / Build
5252
if: ${{ inputs.build-cid }}
5353
uses: ./.github/workflows/job_build_cid.yml
54+
permissions:
55+
actions: read
56+
contents: read
57+
packages: read
58+
statuses: read
59+
id-token: write
5460
with:
5561
os: ${{ inputs.os }}
5662
build-runner: ${{ inputs.build-runner }}

.github/workflows/ubuntu_22.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
packages: read
2323
statuses: read
2424
security-events: write
25+
id-token: write
2526
with:
2627
os: ubuntu_22_04
2728
build-runner: ubuntu-22.04-16-cores

.github/workflows/ubuntu_24.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
packages: read
2323
statuses: read
2424
security-events: write
25+
id-token: write
2526
with:
2627
os: ubuntu_24_04
2728
build-runner: ubuntu-latest-32-cores

.github/workflows/windows_2022.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
packages: read
2323
statuses: read
2424
security-events: write
25+
id-token: write
2526
with:
2627
os: windows_2022
2728
build-runner: windows-2022-16-core

0 commit comments

Comments
 (0)