Skip to content

Commit

Permalink
take 1
Browse files Browse the repository at this point in the history
  • Loading branch information
aljazerzen committed Feb 5, 2024
1 parent 437e60c commit 97184ea
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 19 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test
on:
- push
jobs:
test-job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Rust toolchain with rustup
run: nix develop --command cargo --version
- uses: Swatinem/rust-cache@v2

- name: Start databases
run: nix develop --command just dbs/start
- name: Seed databases
run: nix develop --command just dbs/seed

- name: Run tests
run: nix develop --command just test
21 changes: 11 additions & 10 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ export POSTGRES_URL := "postgres://root:root@localhost:5432/dummy"
export SQLITE_URL := "../dbs/sqlite.db"
export DUCKDB_URL := "../dbs/duckdb.db"


default:
just --list

build-release:
cargo build --release --features all

build-debug:
cargo build --features all

features_test := "--features=src_sqlite,src_duckdb,src_postgres"
test:
cargo nextest run {{features_test}}
cargo nextest run --features=all
cargo fmt --check
cargo clippy {{features_test}} -- -D warnings
cargo clippy --features=all -- -D warnings
just test-feature-gate

# run tests, importants things first, for development
test-fast:
cargo fmt
cargo nextest run --features=all
cargo insta review
cargo clippy --features=all

# test that all features work by themselves
test-feature-gate:
cargo check --features src_postgres
cargo check --features src_sqlite
Expand Down
16 changes: 8 additions & 8 deletions dbs/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ services:
POSTGRES_DB: dummy
POSTGRES_USER: root
POSTGRES_PASSWORD: root
mysql:
image: "mariadb:10"
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: dummy
MYSQL_ROOT_PASSWORD: root
command: --secure-file-priv=""
# mysql:
# image: "mariadb:10"
# ports:
# - "3306:3306"
# environment:
# MYSQL_DATABASE: dummy
# MYSQL_ROOT_PASSWORD: root
# command: --secure-file-priv=""
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
cargo-audit
cargo-release
pkg-config
openssl
docker-compose
];

dbs = with pkgs; [
Expand Down
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[toolchain]
# Generally run 1 behind latest
channel = "1.74.0"
components = ["rustfmt", "clippy"]

0 comments on commit 97184ea

Please sign in to comment.