diff --git a/.tangled/workflows/tests.yaml b/.tangled/workflows/tests.yaml new file mode 100644 index 0000000..19e949f --- /dev/null +++ b/.tangled/workflows/tests.yaml @@ -0,0 +1,39 @@ +when: + - event: ["pull_request"] + branch: ["main"] + +engine: "nixery" + +clone: + skip: false + depth: 1 + submodules: false + +dependencies: + nixpkgs: + - cargo + - diesel-cli + - postgresql + - rustc + +steps: + - name: "Start PostgreSQL" + command: | + initdb -D /tmp/pgdata + pg_ctl -D /tmp/pgdata -o "-k /tmp -p 5432" -w start + createdb -h 127.0.0.1 -p 5432 -U postgres app_test + + - name: "prepare DB" + command: | + cd rust + diesel setup + diesel migration run + environment: + DATABASE_URL: postgres://postgres:postgres@localhost:5432/henka + TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/henka_test + + - name: "run tests" + command: | + cargo test + environment: + TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/henka_test