Skip to content

Commit

Permalink
feat: support database tests in coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasauler committed Sep 30, 2024
1 parent bed3e9b commit a1dfc53
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 9 deletions.
55 changes: 46 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ jobs:
security:
docker:
- image: cimg/rust:1.81.0
environment:
# Fail the build if there are warnings
RUSTFLAGS: "-D warnings"
CARGO_INCREMENTAL: 0
# RUSTC_WRAPPER: "sccache"
steps:
- checkout
- run:
Expand All @@ -87,6 +92,11 @@ jobs:
format:
docker:
- image: cimg/rust:1.81.0
environment:
# Fail the build if there are warnings
RUSTFLAGS: "-D warnings"
CARGO_INCREMENTAL: 0
# RUSTC_WRAPPER: "sccache"
steps:
- checkout
- run:
Expand All @@ -106,6 +116,11 @@ jobs:
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- image: cimg/rust:1.81.0
environment:
# Fail the build if there are warnings
RUSTFLAGS: "-D warnings"
CARGO_INCREMENTAL: 0
# RUSTC_WRAPPER: "sccache"
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps:
Expand All @@ -124,6 +139,11 @@ jobs:
doc:
docker:
- image: cimg/rust:1.81.0
environment:
# Fail the build if there are warnings
RUSTFLAGS: "-D warnings"
CARGO_INCREMENTAL: 0
# RUSTC_WRAPPER: "sccache"
steps:
- checkout
- run:
Expand All @@ -139,6 +159,16 @@ jobs:
coverage:
docker:
- image: cimg/rust:1.81.0
environment:
# Fail the build if there are warnings
RUSTFLAGS: "-D warnings"
CARGO_INCREMENTAL: 0
# RUSTC_WRAPPER: "sccache"
- image: cimg/postgres:17.0
environment:
POSTGRES_USER: postgres
environment:
DATABASE_URL: postgresql://postgres@localhost/circle_test
steps:
- checkout
- run:
Expand All @@ -158,6 +188,14 @@ jobs:
name: Install nextest
command: |
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- run:
name: Install sqlx-cli
command: cargo install sqlx-cli
- run:
name: Database setup
command: |
sqlx database create
sqlx migrate run
- run:
name: Setup test.env
command: |
Expand All @@ -167,8 +205,6 @@ jobs:
name: Running code coverage
command: |
rustup run nightly cargo llvm-cov nextest --locked --all-features --lcov --output-path lcov.info
environment:
DATABASE_URL: postgresql://postgres@localhost/circle_test
- codecov/upload:
file: "./lcov.info"
# token: $CODECOV_TOKEN already default
Expand Down Expand Up @@ -231,10 +267,11 @@ workflows:
filters:
tags:
only: /.*/
- shuttle-deploy:
requires:
- doc
- coverage
filters:
branches:
only: main
# skipping auto deploy for now
# - shuttle-deploy:
# requires:
# - doc
# - coverage
# filters:
# branches:
# only: main
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
buildInputs = [
bacon
cargo-expand
cargo-llvm-cov
cargo-nextest
cargo-watch
jq
Expand Down

0 comments on commit a1dfc53

Please sign in to comment.