Add in-toto format as hash of shard hashes #644
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: Lint | |
on: | |
pull_request: | |
branches: [main] | |
types: [opened, synchronize] | |
permissions: read-all | |
jobs: | |
whitespace-lint: | |
runs-on: ubuntu-latest | |
name: Lint whitespace | |
steps: | |
- name: Check out source repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Detect empty lines at end of file and trailing whitespace | |
run: | | |
set -euxo pipefail # No -x here! | |
failed=0 | |
# First, check for empty files at end | |
for file in $(for f in $(git ls-files --eol | grep 'i/[cr]*lf' | awk '{print $4}'); do egrep -l "^$" $file; done); do | |
line=$(wc -l "$file" | cut -d ' ' -f1) | |
echo "::error file=$file,line=$line::File $file has empty lines at end. Please remove." | |
failed=$((failed + 1)) | |
done | |
# Next, check for files with whitespace at end of line. Remove CRLF files. | |
for file in $(git ls-files --eol | grep 'i/lf' | awk '{print $4}'); do | |
for line in $(grep -n '[[:space:]]$' "$file" | cut -d: -f1); do | |
echo "::error file=$file,line=$line::File $file has trailing whitespace at line $line. Please remove." | |
failed=$((failed + 1)) | |
done | |
done | |
# Finally, check for missing endline at end of file, for any text file. | |
for file in $(git ls-files | grep 'i/lf' | awk '{print $4}'); do | |
if [[ -n "$(tail -c 1 "$file")" ]]; then | |
line=$(wc -l "$file" | cut -d ' ' -f1) | |
echo "::error file=$file,line=$line::File $file needs an endline at the end. Please add." | |
failed=$((failed + 1)) | |
fi | |
done | |
# Report status | |
if [[ $failed -ne 0 ]]; then | |
echo "::error Found $failed whitespace errors, failing" | |
exit 1 | |
fi | |
pytype-lint: | |
runs-on: ubuntu-latest | |
name: Type Check | |
steps: | |
- name: Check out source repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Python environment | |
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 | |
with: | |
python-version: "3.11" | |
- name: run pytype | |
run: | | |
python -m venv venv | |
.github/workflows/scripts/venv_activate.sh | |
pip install -r model_signing/install/requirements_Linux.txt | |
pip install -r model_signing/install/requirements_test_Linux.txt | |
pip install -r model_signing/install/requirements_dev_Linux.txt | |
# TODO: https://github.com/sigstore/model-transparency/issues/231 - Support all repo | |
pytype --keep-going model_signing/{hashing,manifest,serialization,signature,signing} | |
ruff-lint: | |
runs-on: ubuntu-latest | |
name: Python lint | |
steps: | |
- name: Check out source repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Python environment | |
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 | |
with: | |
python-version: "3.11" | |
- name: run ruff | |
run: | | |
python -m venv venv | |
.github/workflows/scripts/venv_activate.sh | |
pip install -r model_signing/install/requirements_Linux.txt | |
pip install -r model_signing/install/requirements_test_Linux.txt | |
pip install -r model_signing/install/requirements_dev_Linux.txt | |
# TODO: https://github.com/sigstore/model-transparency/issues/231 - Support all repo | |
ruff check model_signing/{hashing,manifest,serialization,signature,signing} |