mirror of
https://github.com/kristoferssolo/zero2prod.git
synced 2025-10-21 20:10:40 +00:00
fix(workflows): fix sqlx-cli version
style: fix clippy warnings fix
This commit is contained in:
parent
4a2d00953c
commit
7871d95c1f
24
.github/workflows/CI.yml
vendored
24
.github/workflows/CI.yml
vendored
@ -2,7 +2,7 @@ name: Rust
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
SQLX_VERSION: 0.7
|
SQLX_VERSION: 0.7.4
|
||||||
SQLX_FEATURES: "rustls,postgres"
|
SQLX_FEATURES: "rustls,postgres"
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@ -24,11 +24,11 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
key: sqlx-${{ env.SQLX_VERSION }}
|
key: sqlx-${{ env.SQLX_VERSION }}
|
||||||
- name: Install sqlx-cli
|
- name: Install sqlx-cli
|
||||||
run: cargo install sqlx-cli --version ${{ env.SQLX_VERSION }} --features ${{ env.SQLX_FEATURES }} --no-default-features --locked
|
run: cargo install sqlx-cli --version=${{ env.SQLX_VERSION }} --features ${{ env.SQLX_FEATURES }} --no-default-features --locked
|
||||||
- name: Install postgresql-client
|
|
||||||
run: sudo apt-get update && sudo apt-get install -y postgresql-client
|
|
||||||
- name: Migrate database
|
- name: Migrate database
|
||||||
run: SKIP_DOCKER=true ./scripts/init_db
|
run: |
|
||||||
|
sudo apt-get install libpq-dev -y
|
||||||
|
SKIP_DOCKER=true ./scripts/init_db
|
||||||
- name: Check sqlx-data.json is up to date
|
- name: Check sqlx-data.json is up to date
|
||||||
run: cargo sqlx prepare --workspace --check
|
run: cargo sqlx prepare --workspace --check
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
@ -65,10 +65,10 @@ jobs:
|
|||||||
key: sqlx-${{ env.SQLX_VERSION }}
|
key: sqlx-${{ env.SQLX_VERSION }}
|
||||||
- name: Install sqlx-cli
|
- name: Install sqlx-cli
|
||||||
run: cargo install sqlx-cli --version=${{ env.SQLX_VERSION }} --features ${{ env.SQLX_FEATURES }} --no-default-features --locked
|
run: cargo install sqlx-cli --version=${{ env.SQLX_VERSION }} --features ${{ env.SQLX_FEATURES }} --no-default-features --locked
|
||||||
- name: Install postgresql-client
|
|
||||||
run: sudo apt-get update && sudo apt-get install postgresql-client -y
|
|
||||||
- name: Migrate database
|
- name: Migrate database
|
||||||
run: SKIP_DOCKER=true ./scripts/init_db
|
run: |
|
||||||
|
sudo apt-get install libpq-dev -y
|
||||||
|
SKIP_DOCKER=true ./scripts/init_db
|
||||||
- name: Linting
|
- name: Linting
|
||||||
run: cargo clippy -- -D warnings
|
run: cargo clippy -- -D warnings
|
||||||
coverage:
|
coverage:
|
||||||
@ -87,14 +87,16 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- name: Install postgresql-client
|
- name: Install libpq
|
||||||
run: sudo apt-get update && sudo apt-get install postgresql-client -y
|
run: sudo apt-get update && sudo apt-get install -y postgresql-client
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
key: sqlx-${{ env.SQLX_VERSION }}
|
key: sqlx-${{ env.SQLX_VERSION }}
|
||||||
|
- name: Install tarpaulin
|
||||||
|
run: cargo install cargo-tarpaulin
|
||||||
- name: Install sqlx-cli
|
- name: Install sqlx-cli
|
||||||
run: cargo install sqlx-cli --version=${{ env.SQLX_VERSION }} --features ${{ env.SQLX_FEATURES }} --no-default-features --locked
|
run: cargo install sqlx-cli --version=${{ env.SQLX_VERSION }} --features ${{ env.SQLX_FEATURES }} --no-default-features --locked
|
||||||
- name: Migrate database
|
- name: Migrate database
|
||||||
run: SKIP_DOCKER=true ./scripts/init_db
|
run: SKIP_DOCKER=true ./scripts/init_db
|
||||||
- name: Generate code coverage
|
- name: Generate code coverage
|
||||||
run: cargo install cargo-tarpaulin && cargo tarpaulin --verbose --workspace
|
run: cargo tarpaulin --verbose --workspace
|
||||||
|
|||||||
@ -13,7 +13,7 @@ async fn main() -> Result<(), std::io::Error> {
|
|||||||
init_subscriber(subscriber);
|
init_subscriber(subscriber);
|
||||||
let config = get_config().expect("Failed to read configuation.");
|
let config = get_config().expect("Failed to read configuation.");
|
||||||
let pool = PgPoolOptions::new()
|
let pool = PgPoolOptions::new()
|
||||||
.connect_lazy(&config.database.to_string().expose_secret())
|
.connect_lazy(config.database.to_string().expose_secret())
|
||||||
.expect("Failed to create Postgres connection pool.");
|
.expect("Failed to create Postgres connection pool.");
|
||||||
let addr = format!("{}:{}", config.application.host, config.application.port);
|
let addr = format!("{}:{}", config.application.host, config.application.port);
|
||||||
let listener = TcpListener::bind(addr)
|
let listener = TcpListener::bind(addr)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user