Skip to content

Commit

Permalink
Configure CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pawurb committed Dec 29, 2023
1 parent 7692103 commit 78b7077
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
37 changes: 18 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: Rust CI

on:
push:
Expand All @@ -8,30 +8,29 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
steps:
- uses: actions/checkout@v3
- name: Run PostgreSQL 14
run: |
docker run --env POSTGRES_USER=postgres \
--env POSTGRES_DB=ruby-pg-extras-test \
--env POSTGRES_DB=rust_pg_extras \
--env POSTGRES_PASSWORD=secret \
-d -p 5432:5432 postgres:14.6-alpine \
postgres -c shared_preload_libraries=pg_stat_statements
- uses: actions/checkout@v2
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
- uses: actions/checkout@v2
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Check
uses: actions-rs/cargo@v1
with:
command: check
- name: Test
env:
DATABASE_URL: postgresql://postgres:secret@localhost:5432/rust_pg_extras
uses: actions-rs/cargo@v1
with:
command: test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rust-pg-extras [![Latest Version](https://img.shields.io/crates/v/pg-extras.svg)](https://crates.io/crates/pg-extras)
# rust-pg-extras [![Latest Version](https://img.shields.io/crates/v/pg-extras.svg)](https://crates.io/crates/pg-extras) [![GH Actions](https://github.com/pawurb/rust-pg-extras/actions/workflows/ci.yml/badge.svg)](https://github.com/pawurb/rust-pg-extras/actions)

Rust port of [Heroku PG Extras](https://github.com/heroku/heroku-pg-extras) with several additions and improvements. The goal of this project is to provide powerful insights into the PostgreSQL database for Rust apps that are not using the Heroku PostgreSQL plugin.

Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ pub fn db_settings() -> Vec<DbSetting> {
}

fn read_file(filename: &str) -> String {
let contents = fs::read_to_string(format!("src/queries/{}.sql", filename))
.expect(format!("Error reading the '{}' file", filename.to_string()).as_str());
contents

fs::read_to_string(format!("src/queries/{}.sql", filename))
.unwrap_or_else(|_| panic!("Error reading the '{}' file", filename))
}

fn get_rows(query: &str) -> Vec<Row> {
Expand Down

0 comments on commit 78b7077

Please sign in to comment.