Add model signing unit test GitHub Actions #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit tests for model signing | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
types: [opened, synchronize] | |
permissions: | |
id-token: write | |
jobs: | |
sign-model: | |
name: Test model signing still works | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | |
with: | |
python-version: 3.11 | |
cache: pip | |
cache-dependency-path: model_signing/install/requirements.txt | |
- name: Install dependencies | |
run: | | |
set -euo pipefail | |
python -m venv venv | |
source venv/bin/activate | |
python -m pip install --require-hashes -r model_signing/install/requirements.txt | |
- name: Download bertseq2seq | |
run: | | |
set -euo pipefail | |
wget "https://tfhub.dev/google/bertseq2seq/bert24_en_de/1?tf-hub-format=compressed" -O bertseq2seq.tgz | |
mkdir -p bertseq2seq | |
pushd bertseq2seq | |
tar xvzf ../bertseq2seq.tgz | |
popd | |
rm -rf bertseq2seq.tgz | |
- name: Sign bertseq2seq model | |
run: | | |
set -euo pipefail | |
source venv/bin/activate | |
python3 model_signing/main.py sign --path bertseq2seq | |
- name: Verify signature of bertseq2seq model | |
run: | | |
set -euo pipefail | |
source venv/bin/activate | |
python3 model_signing/main.py verify --path bertseq2seq --identity https://github.com/${{ github.workflow_ref }} --identity-provider https://token.actions.githubusercontent.com |