Add /tee/enclaves & enhance logs #110
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 MyPy, Pyright & Pylint | |
on: | |
pull_request: | |
paths-ignore: | |
- 'verified-inference/solana-attestation-contract/**' | |
jobs: | |
lint-and-type-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
!~/.cache/pip/log | |
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} | |
- name: Install Python Dependencies | |
run: | | |
cd verified-inference | |
pip install -r enclave/requirements.txt | |
pip install -r host/requirements.txt | |
pip install mypy pyright | |
#- name: Run PyLint | |
# run: | | |
# cd verified-inference | |
# pylint --rcfile=setup.cfg enclave/* | |
# pylint --rcfile=setup.cfg host/* | |
- name: Create output directory | |
run: | | |
cd verified-inference | |
mkdir -p mypy_pyright_outputs | |
- name: Run mypy and save output | |
run: | | |
cd verified-inference | |
mypy enclave/ > mypy_pyright_outputs/mypy_output_enclave.txt || true | |
mypy host/ > mypy_pyright_outputs/mypy_output_host.txt || true | |
continue-on-error: true | |
- name: Print mypy output | |
run: | | |
cd verified-inference | |
echo "=== mypy output ===" | |
cat mypy_pyright_outputs/mypy_output_enclave.txt | |
cat mypy_pyright_outputs/mypy_output_host.txt | |
- name: Count mypy errors | |
id: mypy-count | |
run: | | |
cd verified-inference | |
enclave_error_count=$(grep -oP "\d+ errors" mypy_pyright_outputs/mypy_output_enclave.txt | sed 's/ errors//g' || echo 0) | |
host_error_count=$(grep -oP "\d+ errors" mypy_pyright_outputs/mypy_output_host.txt | sed 's/ errors//g' || echo 0) | |
error_count=$((enclave_error_count + host_error_count)) | |
echo "Mypy error count: $error_count" | |
if [[ "$error_count" -gt 0 ]]; then | |
echo "::error::Found $error_count mypy errors." | |
exit 1 | |
fi | |
- name: Run pyright and save output | |
run: | | |
cd verified-inference | |
pyright enclave/ > mypy_pyright_outputs/pyright_enclave_output.txt || true | |
pyright host/ > mypy_pyright_outputs/pyright_host_output.txt || true | |
continue-on-error: true | |
- name: Print pyright output | |
run: | | |
cd verified-inference | |
echo "=== pyright output ===" | |
cat mypy_pyright_outputs/pyright_enclave_output.txt | |
cat mypy_pyright_outputs/pyright_host_output.txt | |
- name: Count pyright errors | |
id: pyright-count | |
run: | | |
cd verified-inference | |
enclave_error_count=$(grep -oP "\d+ errors" mypy_pyright_outputs/pyright_enclave_output.txt | sed 's/ errors//g' || echo 0) | |
host_error_count=$(grep -oP "\d+ errors" mypy_pyright_outputs/mypy_output_host.txt | sed 's/ errors//g' || echo 0) | |
error_count=$((enclave_error_count + host_error_count)) | |
echo "pyright error count: $error_count" | |
if [[ "$error_count" -gt 0 ]]; then | |
echo "::warning::Found $error_count pyright errors." | |
fi | |
- name: Upload mypy and pyright outputs as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mypy-pyright-outputs | |
path: verified-inference/mypy_pyright_outputs/ |