Skip to content

ci: test postgres

ci: test postgres #4

Workflow file for this run

name: CI
on:
push:
branches: [ "master" ]
pull_request:
types: [ opened, synchronize, reopened ]
branches:
- master
env:
CARGO_TERM_COLOR: auto
SQLX_VERSION: 0.8.2
SQLX_FEATURES: "rustls,postgres"
DATABASE_TEST_URL: postgres://postgres:password@localhost:5432/bdk_wallet
jobs:
build-test:
name: Build + Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
ports:
- 5432:5432
# redis:
# image: redis:7
# ports:
# - 6379:6379
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: sqlx-${{ env.SQLX_VERSION }}
- name: Install sqlx-cli
run:
cargo install sqlx-cli
--version=${{ env.SQLX_VERSION }}
--no-default-features
--features ${{ env.SQLX_FEATURES }}
--locked
- name: Migrate database
run: |
sudo apt-get install libpq-dev -y
./ci/init_db.sh
# - name: Check sqlx-data.json is up-to-date
# run: |
# cargo sqlx prepare --workspace --check
- name: Test
run: cargo test
# fmt:
# name: Rustfmt
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# with:
# components: rustfmt
# - name: Check fmt
# run: cargo fmt --check
# clippy:
# name: Clippy
# runs-on: ubuntu-latest
# services:
# postgres:
# image: postgres:14
# env:
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: password
# POSTGRES_DB: postgres
# ports:
# - 5432:5432
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# with:
# components: clippy
# - uses: Swatinem/rust-cache@v2
# with:
# key: sqlx-${{ env.SQLX_VERSION }}
# - name: Install sqlx-cli
# run:
# cargo install sqlx-cli
# --version=${{ env.SQLX_VERSION }}
# --features ${{ env.SQLX_FEATURES }}
# --no-default-features
# --locked
# - name: Migrate database
# run: |
# sudo apt-get install libpq-dev -y
# SKIP_DOCKER=true ./scripts/init_db.sh
# - name: Linting
# run: cargo clippy -- -D warnings