Skip to content

Commit

Permalink
prepare sqlite database for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
KarnerTh committed Nov 21, 2023
1 parent 99be277 commit 3c12151
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
uses: actions/checkout@v3
- name: Start container with test databases
run: docker-compose -f test/docker-compose.yaml up -d
- name: Prepare sqlite database
run: make prepare-sqlite
- name: Wait for docker containers to start
run: sleep 30
- name: Set up Go
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
GIT_TAG := $(shell git describe --tags --abbrev=0)
test_target := "./..."

.PHONY: prepare-sqlite
prepare-sqlite:
rm mermerd_test.db
sqlite3 mermerd_test.db < <(cat test/db-table-setup.sql test/sqlite/sqlite-enum-setup.sql test/sqlite/sqlite-multiple-databases.sql)

.PHONY: test-coverage
test-coverage:
go test -cover -coverprofile=coverage.out ./...; go tool cover -html=coverage.out -o coverage.html; rm coverage.out
Expand Down
6 changes: 6 additions & 0 deletions test/sqlite/sqlite-enum-setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Test case for https://github.com/KarnerTh/mermerd/issues/15
-- only stub, because sqlite does not support enums
create table test_2_enum(
fruit TEXT CHECK( fruit IN ('apple','banana') )
);

8 changes: 8 additions & 0 deletions test/sqlite/sqlite-multiple-databases.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Test case for https://github.com/KarnerTh/mermerd/issues/23
-- only stub, becuase sqlite does not support multiple databases
create table test_3_a
(
id int not null primary key,
title varchar(255) not null
);

0 comments on commit 3c12151

Please sign in to comment.