Skip to content

Commit

Permalink
try out prov
Browse files Browse the repository at this point in the history
Signed-off-by: Luke Hinds <[email protected]>
  • Loading branch information
lukehinds committed Feb 22, 2024
1 parent 8eb3791 commit de618cb
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions .github/workflows/train_and_inference.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Train and Inference
name: Train and Inference with SLSA

on:
push:
branches:
- main

jobs:
train_and_inference:
train:
runs-on: ubuntu-latest

steps:
Expand All @@ -24,10 +24,40 @@ jobs:
pip install -r requirements.txt
- name: Generate Dataset
run: python generate_dataset.py
run: |
python generate_dataset.py
tar -czvf dataset.tgz dataset.npz
- name: Train Model
run: python train_model.py

- name: Run Inference
run: python run_inference.py
- name: Generate SLSA Attestation for Dataset
run: |
checksum=$(sha256sum dataset.tgz | cut -d ' ' -f 1)
echo "Dataset checksum: $checksum"
# Use the checksum to generate SLSA attestation
- name: Generate SLSA Attestation for Model
run: |
checksum=$(sha256sum model.pth | cut -d ' ' -f 1)
echo "Model checksum: $checksum"
# Use the checksum to generate SLSA attestation
provenance:
if: ${{ github.event_name != 'pull_request' }}
needs: [train]
runs-on: ubuntu-latest
permissions:
actions: read
id-token: write
contents: write
steps:
- name: Get outputs
id: hash
run: echo "::set-output name=hash::$(echo 'hash-'$(sha256sum dataset.tgz | cut -d ' ' -f 1) 'hash-'$(sha256sum model.pth | cut -d ' ' -f 1))"

- name: Run SLSA generator
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
base64-subjects: ${{ steps.hash.outputs.hash }}
upload-assets: true

0 comments on commit de618cb

Please sign in to comment.