Skip to content

feat: asset tests

feat: asset tests #18

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.14"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Install project
run: poetry install --no-interaction
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Start LocalNet
run: |
poetry run algokit localnet reset || true
poetry run algokit localnet start
# Wait for LocalNet to be ready
timeout 120 bash -c 'until curl -s http://localhost:4001/health > /dev/null; do sleep 2; done' || true
- name: Run tests
run: |
if [ -d "tests" ]; then
poetry add --group dev pytest || true
poetry run pytest tests/ -v; EXIT_CODE=$?
# Exit code 5 means no tests were collected, which is OK
if [ $EXIT_CODE -eq 5 ]; then
echo "No tests collected, but this is OK"
exit 0
fi
exit $EXIT_CODE
else
echo "No tests directory found, skipping test execution"
fi
- name: Check imports
run: poetry run python -c "import algo_utils_examples; import algo_utils_examples.accounts; import algo_utils_examples.transaction; import algo_utils_examples.assets; print('All imports successful')"
- name: Verify module structure
run: |
poetry run python -c "from algo_utils_examples.main import main; print('main() function imported successfully')"
echo "Module structure verified (execution requires LocalNet)"
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-3.14-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-${{ runner.os }}-3.14-
- name: Install dependencies
run: poetry install --no-interaction
- name: Check code formatting with black (optional)
run: |
poetry add --group dev black || echo "black not available"
poetry run black --check src/ tests/ || echo "Formatting check skipped"
continue-on-error: true
- name: Lint with ruff (optional)
run: |
poetry add --group dev ruff || echo "ruff not available"
poetry run ruff check src/ tests/ || echo "Linting check skipped"
continue-on-error: true