CI #402
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| schedule: | |
| - cron: '0 */6 * * *' # Every 6 hours - catch tempo drift early | |
| workflow_dispatch: # Manual trigger | |
| jobs: | |
| abi-check: | |
| name: ABI Drift Check | |
| if: github.event_name != 'push' | |
| continue-on-error: true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install solc | |
| run: | | |
| curl -fsSL https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux -o /usr/local/bin/solc | |
| chmod +x /usr/local/bin/solc | |
| - name: Check ABIs are in sync | |
| run: ./scripts/tempo_abis.sh --check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run ruff linter | |
| run: uv run ruff check . | |
| - name: Run ruff formatter check | |
| run: uv run ruff format --check . | |
| test: | |
| name: Test Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run tests | |
| run: uv run pytest -v tests/ | |
| build: | |
| name: Build package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Build package | |
| run: uv build | |
| - name: Check package | |
| run: | | |
| uv run pip install dist/*.whl | |
| uv run python -c "import pytempo; print(pytempo.__version__)" | |
| integration-localnet: | |
| name: Integration Tests (Localnet) | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Start Tempo node | |
| run: | | |
| docker run -d --name tempo \ | |
| -p 8545:8545 \ | |
| ghcr.io/tempoxyz/tempo:latest \ | |
| node --dev --http --http.addr 0.0.0.0 --http.port 8545 --http.api eth,net,web3,txpool,trace --chain dev | |
| - name: Wait for Tempo node | |
| run: | | |
| echo "Waiting for Tempo node to start..." | |
| for i in {1..30}; do | |
| if curl -s http://localhost:8545 > /dev/null 2>&1; then | |
| echo "Tempo node is ready!" | |
| exit 0 | |
| fi | |
| echo "Attempt $i: Tempo node not ready yet..." | |
| sleep 2 | |
| done | |
| echo "Tempo node failed to start" | |
| docker logs tempo | |
| exit 1 | |
| - name: Run integration tests (offline only - localnet lacks tempo_fundAddress) | |
| run: uv run pytest -v -s tests/test_integration.py -k "TestNodeConnection or TestTransactionCreation" | |
| env: | |
| TEMPO_RPC_URL: http://localhost:8545 | |
| - name: Show Tempo node logs on failure | |
| if: failure() | |
| run: docker logs tempo | |
| - name: Stop Tempo node | |
| if: always() | |
| run: docker rm -f tempo || true | |
| integration-devnet: | |
| name: Integration Tests (Devnet) | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run integration tests against devnet | |
| run: uv run pytest -v -s tests/test_integration.py | |
| env: | |
| TEMPO_RPC_URL: ${{ secrets.TEMPO_DEVNET_RPC_URL }} | |
| integration-testnet: | |
| name: Integration Tests (Testnet) | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run integration tests against testnet | |
| run: uv run pytest -v -s tests/test_integration.py | |
| env: | |
| TEMPO_RPC_URL: ${{ secrets.TEMPO_TESTNET_RPC_URL }} |