File tree Expand file tree Collapse file tree 1 file changed +49
-6
lines changed Expand file tree Collapse file tree 1 file changed +49
-6
lines changed Original file line number Diff line number Diff line change 1
- name : Rust
1
+ name : CI
2
2
3
3
on :
4
4
push :
5
5
branches : [ "master" ]
6
+
6
7
pull_request :
7
- branches : [ "master" ]
8
+ types : [ opened, synchronize, reopened ]
9
+ branches :
10
+ - master
8
11
9
12
env :
10
13
CARGO_TERM_COLOR : auto
14
+ PGPASSWORD : password
15
+ DATABASE_TEST_URL : postgres://postgres:password@localhost:5432/testdb
11
16
12
17
jobs :
13
- build :
18
+ build-test :
19
+ name : Build + Test
20
+ runs-on : ubuntu-latest
21
+ services :
22
+ postgres :
23
+ image : postgres:14
24
+ env :
25
+ POSTGRES_USER : postgres
26
+ POSTGRES_PASSWORD : password
27
+ POSTGRES_DB : postgres
28
+ # Set health checks to wait until postgres has started
29
+ options : >-
30
+ --health-cmd pg_isready
31
+ --health-interval 10s
32
+ --health-timeout 5s
33
+ --health-retries 5
34
+ # Map ports on service container to the host
35
+ ports :
36
+ - 5432:5432
37
+ steps :
38
+ - uses : actions/checkout@v4
39
+ - uses : dtolnay/rust-toolchain@stable
40
+ - uses : Swatinem/rust-cache@v2
41
+ - name : Create database
42
+ run : |
43
+ sudo apt-get install libpq-dev -y
44
+ psql -h localhost -p 5432 -U postgres -d postgres -c 'create user testuser'
45
+ psql -h localhost -p 5432 -U postgres -d postgres -c 'create database testdb with owner = testuser'
46
+ - name : Test
47
+ run : cargo test -- --test-threads=1 --show-output
48
+
49
+ fmt-clippy :
50
+ name : Check
14
51
runs-on : ubuntu-latest
15
52
steps :
16
- - uses : actions/checkout@v4
17
- - name : Check
18
- run : cargo check
53
+ - uses : actions/checkout@v4
54
+ - uses : dtolnay/rust-toolchain@stable
55
+ with :
56
+ components : rustfmt, clippy
57
+ - uses : Swatinem/rust-cache@v2
58
+ - name : Check fmt
59
+ run : cargo fmt --check
60
+ - name : Clippy
61
+ run : cargo clippy -- -D warnings
You can’t perform that action at this time.
0 commit comments