File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change 9
9
CARGO_TERM_COLOR : always
10
10
RUST_BACKTRACE : 1
11
11
RUST_TEST_THREADS : 1
12
- SQL_URL : postgres://db_user:db_pass@localhost:15432 /test_db
12
+ SQL_URL : postgres://db_user:db_pass@localhost:5432 /test_db
13
13
14
14
jobs :
15
15
backend_test :
@@ -18,13 +18,24 @@ jobs:
18
18
defaults :
19
19
run :
20
20
working-directory : ./atcoder-problems-backend
21
+
22
+ services :
23
+ postgres :
24
+ image : postgres
25
+ env :
26
+ POSTGRES_USER : db_user
27
+ POSTGRES_PASSWORD : db_pass
28
+ POSTGRES_DB : test_db
29
+ POSTGRES_INITDB_ARGS : " --encoding=UTF8"
30
+ options : >-
31
+ --health-cmd pg_isready
32
+ --health-interval 10s
33
+ --health-timeout 5s
34
+ --health-retries 5
21
35
22
36
steps :
23
37
- uses : actions/checkout@v2
24
38
25
- - name : Start PostgreSQL server
26
- run : docker-compose up -d postgresql
27
-
28
39
- name : Cache cargo registry
29
40
uses : actions/cache@v2
30
41
with :
35
46
./atcoder-problems-backend/target
36
47
key : ${{ runner.os }}-cargo-${{ hashFiles('atcoder-problems-backend/Cargo.lock') }}
37
48
38
- - name : Wait for PostgreSQL
39
- run : |
40
- for i in `seq 20`
41
- do
42
- docker-compose exec -T pg_isready && break
43
- echo "Waiting for PostgreSQL for 3 seconds ..."
44
- sleep 3
45
- done
49
+ - name : Setup Postgresql
50
+ run : psql ${SQL_URL} < ../config/database-definition.sql
46
51
47
52
- name : Setup
48
53
run : rustup component add rustfmt
53
58
- name : Build
54
59
run : cargo build --verbose
55
60
56
- - name : env debug
57
- run : echo ${SQL_URL}
58
-
59
61
- name : Run tests
60
62
run : cargo test --verbose --workspace -- --test-threads=1
61
63
You can’t perform that action at this time.
0 commit comments