fix(ci-cd): update github ci-cd

- making sure we run postgreSQL in docker first, remove SKIP_DOCKER=true
This commit is contained in:
minhtrannhat 2024-05-04 10:34:53 -04:00
parent b4fa90f183
commit d2f959433d
Signed by: minhtrannhat
GPG Key ID: E13CFA85C53F8062
2 changed files with 2 additions and 73 deletions

View File

@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
image: postgres:15
ports:
- 5432:5432
steps:
@ -26,76 +26,6 @@ jobs:
run: |
sudo apt-get install libpq-dev -y
cargo install sqlx-cli --no-default-features --features postgres
SKIP_DOCKER=true ./scripts/init_db.sh
./scripts/init_db.sh
- name: Run tests
run: cargo test
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Enforce formatting
run: cargo fmt --check
clippy:
name: Clippy
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
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
coverage:
name: Code coverage
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Install libpq
run: sudo apt-get update && sudo apt-get install postgresql-client -y
- uses: Swatinem/rust-cache@v2
with:
key: sqlx-${{ env.SQLX_VERSION }}
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- 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: SKIP_DOCKER=true ./scripts/init_db.sh
- name: Generate code coverage
run: cargo tarpaulin --verbose --workspace

View File

@ -1,4 +1,3 @@
pub mod configuration;
pub mod routes;
pub mod startup;