Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

update workflows to use hyperdrive-rs #463

update workflows to use hyperdrive-rs

update workflows to use hyperdrive-rs #463

Workflow file for this run

name: Python lint
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
detect-changes:
uses: ./.github/workflows/check_diff.yml
with:
pattern: ^crates/hyperdrivepy
lint:
needs: detect-changes
# Run only if changes are detected
if: needs.detect-changes.outputs.changed == 'true'
name: python lint
runs-on: ubuntu-latest
steps:
- name: Checkout hyperdrive-bindings
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
# NOTE: This is needed to ensure that hyperdrive-wrappers builds correctly.
- name: Install foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Fetch latest release tag from hyperdrive
run: ./scripts/fetch-latest-tag.sh delvtech hyperdrive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch latest release tag from hyperdrive-rs
run: ./scripts/fetch-latest-tag.sh delvtech hyperdrive-rs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check out hyperdrive-rs
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive-rs
ref: ${{ env.latest_tag_hyperdrive-rs }}
path: "./hyperdrive-rs"
- name: check out hyperdrive
uses: actions/checkout@v4
with:
repository: delvtech/hyperdrive
ref: ${{ env.latest_tag_hyperdrive }}
path: "./hyperdrive-rs/hyperdrive"
ssh-key: ${{ secrets.HYPERDRIVE_ACCESS_KEY }}
- name: build hyperdrive
run: cd hyperdrive-rs/hyperdrive && make build-sol
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
token: ${{ secrets.GITHUB_TOKEN }}
- name: install requirements
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade -r requirements.txt
python -m pip install --upgrade -r requirements-dev.txt
- name: install hyperdrivepy
run: python -m pip install crates/hyperdrivepy
- name: get all Python files
id: list_files
run: |
echo "files=$(git ls-files '*.py' '*.pyi' | xargs)" >> $GITHUB_OUTPUT
- name: run black
run: python -m black --check --diff .
- name: run pylint
run: |
pylint --rcfile=pyproject.toml crates/hyperdrivepy/*.py
- name: run pyright
run: |
files="${{ steps.list_files.outputs.files }}"
if [ -n "$files" ]; then
python -m pyright --project pyproject.toml $files
else
echo "No Python files found."
fi