Skip to content

Fetch blocks and logs concurrently #429

Fetch blocks and logs concurrently

Fetch blocks and logs concurrently #429

Workflow file for this run

name: cargo test
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
name: Install rust
with:
toolchain: 1.88.0
- uses: Swatinem/rust-cache@v2
- name: Cache cargo-pgrx + cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/cargo-pgrx
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-pgrx-0.16.1-${{ hashFiles('**/Cargo.lock') }}
- name: Install PostgreSQL 18
run: |
sudo systemctl stop postgresql
sudo pg_dropcluster --stop 16 main || true
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| sudo gpg --dearmor --yes --batch --no-tty \
-o /etc/apt/keyrings/postgresql.gpg
sudo chmod 0644 /etc/apt/keyrings/postgresql.gpg
echo "deb [signed-by=/etc/apt/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
| sudo tee /etc/apt/sources.list.d/pgdg.list >/dev/null
sudo apt-get update -y
sudo apt-get install -y \
build-essential pkg-config libssl-dev \
postgresql-server-dev-18 postgresql-18 postgresql-client-18
echo "/usr/lib/postgresql/18/bin" >> $GITHUB_PATH
sudo systemctl start postgresql
sudo -u postgres psql -tAc "select version(); show data_directory; show port; show listen_addresses;"
sudo -u postgres createuser --superuser --createdb --createrole golden_axe
sudo tee /etc/postgresql/18/main/pg_hba.conf >/dev/null <<'EOF'
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
EOF
sudo systemctl reload postgresql
sudo -u postgres psql -c "SELECT version();"
sudo -u postgres psql -tAc "SHOW port;"
sudo -u postgres createdb golden_axe_test
- name: Wait for Postgres
run: |
for i in {1..30}; do
pg_isready -h localhost -p 5432 && exit 0
sleep 1
done
echo "Postgres did not become ready in time" >&2
exit 1
- name: Install pgrx
run: |
cargo install --locked cargo-pgrx --version="0.16.1"
cargo pgrx init --pg18 /usr/lib/postgresql/18/bin/pg_config
- name: Install PG extension
run: |
cd pg_golden_axe
cargo pgrx install --sudo -p pg_golden_axe -c /usr/lib/postgresql/18/bin/pg_config
- name: Run tests
run: cargo test -- --no-capture
env:
RPC_URL: ${{ secrets.RPC_URL }}