use local pg #403
Workflow file for this run
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: cargo test | |
| on: | |
| push: | |
| branches: ["master"] | |
| pull_request: | |
| branches: ["master"] | |
| jobs: | |
| test: | |
| runs-on: large | |
| 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 (PGDG) | |
| run: | | |
| 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 | |
| - 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 | |
| - name: Run tests | |
| run: cargo test -- --no-capture | |
| env: | |
| RPC_URL: ${{ secrets.RPC_URL }} |